List of usage examples for java.lang Runnable Runnable
Runnable
From source file:gtu._work.ui.ObnfJetDeleteUI.java
/** * Auto-generated main method to display this JFrame *//*from ww w . j av a 2 s.c o m*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { ObnfJetDeleteUI inst = new ObnfJetDeleteUI(); inst.setLocationRelativeTo(null); gtu.swing.util.JFrameUtil.setVisible(true, inst); } }); }
From source file:XPathTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new XPathFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);/*w ww . j av a2 s. com*/ } }); }
From source file:ProgressMonitorInputStreamTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new TextFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);//w ww. ja v a 2 s. c om } }); }
From source file:PreferencesTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { PreferencesFrame frame = new PreferencesFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);/* w w w . ja v a 2 s.c om*/ } }); }
From source file:InvokeExample.java
public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel p = new JPanel(); p.add(good);//from w w w. j a v a 2 s . co m p.add(bad); p.add(bad2); Container c = f.getContentPane(); c.setLayout(new BorderLayout()); c.add(p, BorderLayout.CENTER); c.add(resultLabel, BorderLayout.SOUTH); good.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { resultLabel.setText("Working . . ."); setEnabled(false); Thread worker = new Thread() { public void run() { try { Thread.sleep(5000); } catch (InterruptedException ex) { } SwingUtilities.invokeLater(new Runnable() { public void run() { resultLabel.setText("Ready"); setEnabled(true); } }); } }; worker.start(); } }); bad.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { resultLabel.setText("Working . . ."); setEnabled(false); try { Thread.sleep(5000); } catch (InterruptedException ex) { } resultLabel.setText("Ready"); setEnabled(true); } }); bad2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { resultLabel.setText("Working . . . "); setEnabled(false); SwingUtilities.invokeLater(new Runnable() { public void run() { try { Thread.sleep(5000); // Dispatch thread is starving! } catch (InterruptedException ex) { } resultLabel.setText("Ready"); setEnabled(true); } }); } }); f.setSize(300, 100); f.setVisible(true); }
From source file:LDAPTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new LDAPFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);//from www . ja va2 s . c o m } }); }
From source file:MenuTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { MenuFrame frame = new MenuFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);//ww w .j a v a2s .co m } }); }
From source file:EditorPaneTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new EditorPaneFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);//from ww w . j a v a 2 s . co m } }); }
From source file:TabbedPaneTest.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new TabbedPaneFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);/*from ww w. j a va2 s. c o m*/ } }); }
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 originalImage = ImageIO.read(url); int width = originalImage.getWidth(); int height = originalImage.getHeight(); final BufferedImage textImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = textImage.createGraphics(); FontRenderContext frc = g.getFontRenderContext(); Font font = new Font("Arial", Font.BOLD, 50); GlyphVector gv = font.createGlyphVector(frc, "java2s.com"); int xOff = 0; int yOff = 50; Shape shape = gv.getOutline(xOff, yOff); g.setClip(shape);//from ww w .jav a 2s .c o m g.drawImage(originalImage, 0, 0, null); g.setStroke(new BasicStroke(2f)); g.setColor(Color.BLACK); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.draw(shape); g.dispose(); ImageIO.write(textImage, "png", new File("cat-text.png")); SwingUtilities.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(null, new JLabel(new ImageIcon(textImage))); } }); }