我想用一个命令来实现这样功能:按下按键button1后,弹出来一个我自制的小图片,不要JOptionPane.showMessageDialog这样弹出来提示文本的形式,就是要换红色的地方。 JButton button1 = new JButton("Pause");
            button1.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    JOptionPane.showMessageDialog(null,"Yes! We go! ");
                }
            });
            this.add(button1);

解决方案 »

  1.   

    楼上真闲,我看了这么多帖子,都看到他在回个标题了事。楼主可以继承jdialog,自己写个对话框

    JButton button1 = new JButton("Pause");
                button1.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                      new 自定义dialog(传递图片image做参数).show();                }
                });
                this.add(button1);

    给个思路,还是等高手拍砖
      

  2.   

    JOptionPane.showMessageDialog有相应方法的,你看看参数多的都不看API吗?
      

  3.   

    我经常看 API咋没发现showMessageDialog 可以弹出图片?用jpopupmenu.add(new JLabel(ImageIcon)).show....
    如果要持续带在那 那就用 dialog吧 header去掉(setUndecorated(false)) 响应时间过后 程序关闭此提示
      

  4.   

    用JWindow,第当点击按钮后,弹出JWindow,JWindow内容就一个JLable,其ICON就是你想弹出的图片。