List of usage examples for javax.swing SwingUtilities invokeLater
public static void invokeLater(Runnable doRun)
From source file:dbmods.InsertTemplateName.java
/** * Auto-generated main method to display this JFrame *//*from w w w . j ava 2 s .c om*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { InsertTemplateName inst = new InsertTemplateName(); inst.setLocationRelativeTo(null); inst.setTitle("Insert Into parse_template"); Image icon = Toolkit.getDefaultToolkit().getImage("gf.png"); inst.setIconImage(icon); inst.setVisible(true); } }); }
From source file:StoppUhr.java
/** * Auto-generated main method to display this JFrame *//*w w w .j a v a 2 s . com*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { StoppUhr inst = new StoppUhr(); inst.setLocationRelativeTo(null); inst.setVisible(true); } }); }
From source file:br.usp.poli.lta.cereda.wsn2spa.Main.java
public static void main(String[] args) { Utils.printBanner();//from w w w. j av a 2 s . c om CommandLineParser parser = new DefaultParser(); try { CommandLine line = parser.parse(Utils.getOptions(), args); if (line.hasOption("g")) { System.out.println("Flag '-g' found, overriding other flags."); System.out.println("Please, wait..."); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception nothandled) { } SwingUtilities.invokeLater(() -> { Editor e = new Editor(); e.setVisible(true); }); } else { enableCLI(line); } } catch (ParseException nothandled) { Utils.printHelp(); } catch (Exception exception) { Utils.printException(exception); } }
From source file:com.SCI.centraltoko.Main.java
@SuppressWarnings("Convert2Lambda") public static void main(String[] args) { // TODO code application logic here // Memasang LookAndFeel try {// w w w . j a va 2 s. c o m for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } // Membuat tread try { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ApplicationContext applicationContext = new ClassPathXmlApplicationContext( "SpringXMLConfig.xml"); masterService = (MasterService) applicationContext.getBean("masterService"); transaksiService = (TransaksiSevice) applicationContext.getBean("transaksiSevice"); laporan = (Laporan) applicationContext.getBean("laporan"); mainFrame = new MainFrame(); mainFrame.setVisible(true); } }); } catch (Exception ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:gtu._work.ui.ObnfExceptionLogDownloadUI.java
/** * Auto-generated main method to display this JFrame *///from ww w .j a v a2 s.c om public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { ObnfExceptionLogDownloadUI inst = new ObnfExceptionLogDownloadUI(); inst.setLocationRelativeTo(null); gtu.swing.util.JFrameUtil.setVisible(true, inst); } }); }
From source file:gtu._work.etc.EnglishAdd.java
/** * Auto-generated main method to display this JFrame *///from ww w . ja v a 2 s . c om public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { EnglishAdd inst = new EnglishAdd(); inst.setLocationRelativeTo(null); gtu.swing.util.JFrameUtil.setVisible(true, inst); } }); }
From source file:de.codesourcery.eve.skills.ui.spreadsheet.SpreadSheetTableModel.java
public static void main(String[] args) { final ITableFactory cellFactory = new ITableFactory() { @Override/*from w w w. j ava2s. c om*/ public ITableCell createEmptyCell(int row, int column) { return new SimpleCell(); } @Override public TableRow createRow(SpreadSheetTableModel tableModel) { return new TableRow(tableModel); } }; final SpreadSheetTableModel model = new SpreadSheetTableModel(cellFactory); final JTable table = new JTable(model); table.setFillsViewportHeight(true); final JFrame frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // table.setPreferredSize( new Dimension(400,200 ) ); table.setBorder(BorderFactory.createLineBorder(Color.black)); frame.getContentPane().add(new JScrollPane(table)); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); model.addRow(new SimpleCell("First row") { public boolean isEditable() { return true; } public void setValue(Object value) { System.out.println("new value: " + value); } }); model.addRow(new SimpleCell("Second row #1"), new SimpleCell("Second row #2")); model.addRow(new SimpleCell("Third row #1"), new SimpleCell("Third row #2"), new SimpleCell("Third row #3")); JTextField tf = new JTextField(); table.setModel(model); table.setDefaultEditor(ITableCell.class, new DefaultCellEditor(tf)); } }); }
From source file:misc.TranslucentWindowDemo.java
public static void main(String[] args) { // Determine if the GraphicsDevice supports translucency. GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); //If translucent windows aren't supported, exit. if (!gd.isWindowTranslucencySupported(TRANSLUCENT)) { System.err.println("Translucency is not supported"); System.exit(0);/*from w ww .j a va2 s. c om*/ } JFrame.setDefaultLookAndFeelDecorated(true); // Create the GUI on the event-dispatching thread SwingUtilities.invokeLater(new Runnable() { @Override public void run() { TranslucentWindowDemo tw = new TranslucentWindowDemo(); // Set the window to 55% opaque (45% translucent). tw.setOpacity(0.55f); // Display the window. tw.setVisible(true); } }); }
From source file:gtu._work.ui.SaveFileToPropertiesUI.java
/** * Auto-generated main method to display this JFrame *//*from w ww . j av a 2 s . com*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { SaveFileToPropertiesUI inst = new SaveFileToPropertiesUI(); inst.setLocationRelativeTo(null); gtu.swing.util.JFrameUtil.setVisible(true, inst); } }); }
From source file:misc.TrayIconDemo.java
public static void main(String[] args) { /* Use an appropriate Look and Feel */ try {/* w w w . j a v a 2s . c o m*/ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } catch (IllegalAccessException ex) { ex.printStackTrace(); } catch (InstantiationException ex) { ex.printStackTrace(); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } /* Turn off metal's use of bold fonts */ UIManager.put("swing.boldMetal", Boolean.FALSE); //Schedule a job for the event-dispatching thread: //adding TrayIcon. SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); }