List of usage examples for javax.swing SwingUtilities invokeLater
public static void invokeLater(Runnable doRun)
From source file:Main.java
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); BufferedImage image = new BufferedImage(400, 300, BufferedImage.TYPE_INT_RGB); Graphics2D imageGraphics = image.createGraphics(); GradientPaint gp = new GradientPaint(20f, 20f, Color.red, 380f, 280f, Color.orange); imageGraphics.setPaint(gp);/*from www. ja va 2 s .c om*/ imageGraphics.fillRect(0, 0, 400, 300); JLabel textLabel = new JLabel("java2s.com"); textLabel.setSize(textLabel.getPreferredSize()); Dimension d = textLabel.getPreferredSize(); BufferedImage bi = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_ARGB); Graphics g = bi.createGraphics(); g.setColor(new Color(255, 200, 255, 128)); g.fillRoundRect(0, 0, bi.getWidth(f), bi.getHeight(f), 15, 10); g.setColor(Color.black); textLabel.paint(g); Graphics g2 = image.getGraphics(); g2.drawImage(bi, 20, 20, f); ImageIcon ii = new ImageIcon(image); JLabel imageLabel = new JLabel(ii); f.getContentPane().add(imageLabel); f.pack(); f.setVisible(true); } }); }
From source file:Main.java
public static void main(String[] args) throws Exception { SwingUtilities.invokeLater(new Main()); }
From source file:Main.java
public static void main(String[] args) throws Exception { URL url = new URL("http://www.java2s.com/style/download.png"); final BufferedImage bi = ImageIO.read(url); final String size = bi.getWidth() + "x" + bi.getHeight(); SwingUtilities.invokeLater(new Runnable() { public void run() { JLabel l = new JLabel(size, new ImageIcon(bi), SwingConstants.RIGHT); JOptionPane.showMessageDialog(null, l); }// w ww . j a va 2 s.c o m }); }
From source file:Main.java
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override//from w ww . j a v a2 s .c om public void run() { new TimeZoneSpinners().makeUI(); } }); }
From source file:Main.java
public static void main(String[] args) throws Exception { URL url = new URL("http://www.java2s.com/style/download.png"); final Image img = ImageIO.read(url); Runnable r = new Runnable() { @Override/*from w w w . ja va 2 s . co m*/ public void run() { JOptionPane.showMessageDialog(null, new JLabel(new ImageIcon(img))); } }; SwingUtilities.invokeLater(r); }
From source file:dev.dposadsky.java.swingteacherdesktop.main.Start.java
public static void main(String[] args) throws SQLException { SwingUtilities.invokeLater(new Runnable() { @Override/*from w w w.j a va2 s.com*/ public void run() { ApplicationContext context = new ClassPathXmlApplicationContext("context.xml"); MainFrameController mainFrameController = (MainFrameController) context .getBean("mainFrameController"); } }); }
From source file:Main.java
public static void main(String[] a) { final JTextField textField = new JTextField(5); textField.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) { }/*from ww w .jav a2 s .c om*/ public void focusLost(FocusEvent e) { if (!e.isTemporary()) { String content = textField.getText(); if (!content.equals("a")) { System.out.println("illegal value! " + content); SwingUtilities.invokeLater(new FocusGrabber(textField)); } } } }); JFrame frame = new JFrame(); frame.add(textField, BorderLayout.CENTER); frame.setSize(300, 300); frame.setVisible(true); }
From source file:com.milkdairy.admin.MilkDairyManagement.java
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { Resource resource = new ClassPathResource("applicationContext.xml"); BeanFactory factory = new XmlBeanFactory(resource); JPanel milkDairyManagementJPanel = (MilkDairyManagementJPanel) factory .getBean("milkDairyManagementJPanel"); UIManager.put("swing.boldmetal", Boolean.FALSE); new LoginJFrame(milkDairyManagementJPanel, (LoggingService) factory.getBean("loggingService")) .setVisible(true);/*from w w w .jav a2s . co m*/ } }); }
From source file:iqq.app.IMLauncher.java
/** * ??/*from ww w. j a va 2 s . com*/ * * @param args */ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { init(); startup(); } }); }
From source file:Main.java
public static void main(String[] arguments) { SwingUtilities.invokeLater(new Runnable() { @Override//from w w w . java 2s . c o m public void run() { initAndShowGUI(); } }); }