Swing - How to Run-On-UI-Thread



JAVA-SWING:

Is your UI changes are not reflecting when your Java-Swing application is running? OR Do you want to run UI stuffs from non-UI thread? Below snippet will be handy for you..


EventQueue.invokeLater(
new Runnable()
 {
            public void run()
{
                  //UI processing done here..
                  //Finally validate..
                  validate();
            }
      }
);


           
Happy coding


.

Java-Swing UI Types



For desired [Among available types :P ] look and feel for your Java-swing application, you may set like below..

UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ());
           
setLookAndFeel() method takes a String argument   which is one of below available look and feel:


  1. ·         UIManager.getSystemLookAndFeelClassName (); //Windows style..
  2. ·         UIManager.getCrossPlatformLookAndFeelClassName();//Java swing standard
  3. ·         "com.sun.java.swing.plaf.motif.MotifLookAndFeel" //Moti style.



Happy coding :)