JOptionPane title bar icon

前端 未结 1 454
余生分开走
余生分开走 2021-01-20 05:18

I\'d like to replace the icon in a JOptionPane title bar (as it currently shows the default Java coffee logo).

I tried the following:

JOptionPane.sho         


        
相关标签:
1条回答
  • 2021-01-20 06:03

    Use it like this:

    Icon icon = new ImageIcon("d:/temp/CheckBox.gif");  
    JOptionPane jp = new JOptionPane("Session Expired - Please Re Login"),   
      JOptionPane.INFORMATION_MESSAGE,   
      JOptionPane.WARNING_MESSAGE,   
      icon);  
    JDialog dialog = jp.createDialog(null, "Session Expired - Please Re Login");
    ((Frame)dialog.getParent()).setIconImage(((ImageIcon)icon).getImage());  
    dialog.setResizable(true);  
    dialog.setVisible(true); 
    
    0 讨论(0)
提交回复
热议问题