每次运行任务栏都没有相应的图标,怎么才能在任务栏显示出来呢?

解决方案 »

  1.   

    有个变通的方法import javax.swing.JDialog;
    import javax.swing.JFrame;public class T {
    public static void main(String[] args)
    {
    JFrame f = new JFrame("我的Dialog");
    f.setBounds(-100, -100, 10, 10);
    f.setVisible(true);

    JDialog dialog = new JDialog(f, "我的Dialog", true);
    dialog.setBounds(200, 200, 200, 200);
    dialog.setVisible(true);
    System.exit(0);
    }
    }
      

  2.   

    to  aaa2003gf :
    窗口上本来就显示了一个咖啡杯的小图标啊
      

  3.   

    图标应该是一直都有的,没有在任务栏显示是否可以setAlwaysOnTop(true);
      

  4.   

    public void setIconImage(Image image)
    Description copied from class: Frame 
    Sets the image to be displayed in the minimized icon for this frame. Not all platforms support the concept of minimizing a window. Overrides:
    setIconImage in class Frame
    Parameters:
    image - the icon image to be displayed. If this parameter is null then the icon image is set to the default image, which may vary with platform.
    See Also:
    Frame.getIconImage()