Simple Ranking Application with JOptionPane showOptionDialog

Program       Program Source import javax.swing.JOptionPane; import javax.swing.ImageIcon; public class Javaapp { public static void main(String[] args) { int var1=0,var2=0,var3=0; ImageIcon icon = new ImageIcon(“WLive48x48.png”); String players[]={“Sachin Tendulkar”,”Sehwag”,”Dhoni”}; while(true) { int optionReturns = JOptionPane.showOptionDialog(null ,”Who is the best Indian cricket player?” ,”Player Ranking” ,JOptionPane.NO_OPTION ,JOptionPane.PLAIN_MESSAGE ,icon ,players ,”Sachin Tendulkar”); if(optionReturns == 0) var1++; … Read more…

JOptionPane showOptionDialog with ImageIcon

JOptionPane.showOptionDialog(null                                                         // position the dialog, the default position is center. , “Message”                               … Read more…

JOptionPane showOptionDialog Returns

Show a message and get a user option from a set of options. JOptionPane.showOptionDialog(null                                                       // position the dialog, the default position is center. , “Message?”         … Read more…

JOptionPane showOptionDialog

Show a message and get a user option from a set of options. JOptionPane.showOptionDialog(null                                                       // position the dialog, the default position is center. , “Message?”         … Read more…

JOptionPane showMessageDialog with Icon (Another Way to get ImageIcon)

showMessageDialog( Component parent, Object message, String title, int messageType, Icon icon) The first argument is the parent for the dialog that is used to position the dialog.The second argument specifies what is to be displayed in addition to the default OK button. Third argument specifies by the title. The fourth argument specifies messageType. if you … Read more…

JOptionPane showMessageDialog with Icon

showMessageDialog( Component parent, Object message, String title, int messageType, Icon icon) The first argument is the parent for the dialog that is used to position the dialog.The second argument specifies what is to be displayed in addition to the default OK button. Third argument specifies by the title. The fourth argument specifies messageType. if you … Read more…