Example usage for javax.swing SwingUtilities invokeLater

List of usage examples for javax.swing SwingUtilities invokeLater

Introduction

In this page you can find the example usage for javax.swing SwingUtilities invokeLater.

Prototype

public static void invokeLater(Runnable doRun) 

Source Link

Document

Causes doRun.run() to be executed asynchronously on the AWT event dispatching thread.

Usage

From source file:gtu.jpa.hibernate.Rcdf002eDBUI.java

/**
* Auto-generated main method to display this JFrame
*//*from  www  .j  av a  2  s  . com*/
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            Rcdf002eDBUI inst = new Rcdf002eDBUI();
            inst.setLocationRelativeTo(null);
            gtu.swing.util.JFrameUtil.setVisible(true, inst);
        }
    });
}

From source file:gtu._work.ui.RegexCatchReplacer.java

/**
 * Auto-generated main method to display this JFrame
 *//*from  w  w  w  . ja va  2 s  .c  om*/
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            RegexCatchReplacer inst = new RegexCatchReplacer();
            inst.setLocationRelativeTo(null);
            gtu.swing.util.JFrameUtil.setVisible(true, inst);
        }
    });
}

From source file:gtu._work.ui.CheckJavaClassPathUI.java

/**
* Auto-generated main method to display this JFrame
*///from w ww. j  a  v  a  2 s. co  m
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            CheckJavaClassPathUI inst = new CheckJavaClassPathUI();
            inst.setLocationRelativeTo(null);
            gtu.swing.util.JFrameUtil.setVisible(true, inst);
        }
    });
}

From source file:gtu._work.ui.EstoreCodeGenerateUI.java

/**
 * Auto-generated main method to display this JFrame
 *///  w w  w. j  a va 2 s . com
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            EstoreCodeGenerateUI inst = new EstoreCodeGenerateUI();
            inst.setLocationRelativeTo(null);
            gtu.swing.util.JFrameUtil.setVisible(true, inst);
        }
    });
}

From source file:RadialGradientApp.java

public static void main(String... args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new RadialGradientApp().setVisible(true);
        }//  w w w. j ava  2s.c o m
    });
}

From source file:SwingThreading.java

public static void main(String... args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            edt = new SwingThreading();
            edt.setVisible(true);/* www  .  j  a v  a 2  s  . c om*/

            new Thread(new Runnable() {
                public void run() {
                    while (true) {
                        try {
                            Thread.sleep(300);
                        } catch (InterruptedException e) {
                        }
                        edt.incrementLabel();
                    }
                }
            }).start();
        }
    });
}

From source file:CreateColorSamplePopup.java

public static void main(String args[]) {
    JFrame frame = new JFrame("JColorChooser Create Popup Sample");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = frame.getContentPane();

    final JButton button = new JButton("Pick to Change Background");

    ActionListener actionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            Color initialBackground = button.getBackground();

            final JColorChooser colorChooser = new JColorChooser(initialBackground);
            //        colorChooser.setPreviewPanel(new JPanel());
            final JLabel previewLabel = new JLabel("I Love Swing", JLabel.CENTER);
            previewLabel.setFont(new Font("Serif", Font.BOLD | Font.ITALIC, 48));
            colorChooser.setPreviewPanel(previewLabel);
            // Bug workaround
            colorChooser.updateUI();/*from   www  . ja  v  a2 s . c  o m*/

            // For okay button selection, change button background to
            // selected color
            ActionListener okActionListener = new ActionListener() {
                public void actionPerformed(ActionEvent actionEvent) {
                    Color newColor = colorChooser.getColor();
                    if (newColor.equals(button.getForeground())) {
                        System.out.println("Color change rejected");
                    } else {
                        button.setBackground(colorChooser.getColor());
                    }
                }
            };

            // For cancel button selection, change button background to red
            ActionListener cancelActionListener = new ActionListener() {
                public void actionPerformed(ActionEvent actionEvent) {
                    button.setBackground(Color.red);
                }
            };

            final JDialog dialog = JColorChooser.createDialog(null, "Change Button Background", true,
                    colorChooser, okActionListener, cancelActionListener);

            // Wait until current event dispatching completes before showing
            // dialog
            Runnable showDialog = new Runnable() {
                public void run() {
                    dialog.show();
                }
            };
            SwingUtilities.invokeLater(showDialog);
        }
    };
    button.addActionListener(actionListener);
    contentPane.add(button, BorderLayout.CENTER);

    frame.setSize(300, 100);
    frame.setVisible(true);
}

From source file:gtu._work.ui.TextScanUI.java

/**
 * Auto-generated main method to display this JFrame
 *//*from ww w .j ava  2  s. c  o  m*/
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            TextScanUI inst = new TextScanUI();
            inst.setLocationRelativeTo(null);
            gtu.swing.util.JFrameUtil.setVisible(true, inst);
        }
    });
}

From source file:edu.cmu.cs.diamond.pathfind.main.PathFindDjango.java

public static void main(String[] args) {
    if (args.length != 4 && args.length != 5) {
        System.out.println("usage: " + PathFindDjango.class.getName()
                + " predicate_dir interface_map slide_map annotation_uri");
        return;//from ww  w.ja v  a2 s .co  m
    }

    final String predicateDir = args[0];
    final String interfaceMap = args[1];
    final String slideMap = args[2];
    final String annotationUri = args[3];

    final File slide;
    if (args.length == 5) {
        slide = new File(args[4]);
    } else {
        slide = null;
    }

    final AnnotationStore annotationStore = new DjangoAnnotationStore(new HttpClient(), annotationUri);

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                new PathFindFrame(predicateDir, annotationStore, interfaceMap, slideMap, slide, false);
            } catch (IOException e) {
                e.printStackTrace();
                JOptionPane.showMessageDialog(null, e, "Error", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
}

From source file:gtu._work.ui.RegexCatchReplacer_Ebao.java

/**
 * Auto-generated main method to display this JFrame
 *///from  www  .  jav  a2 s.c om
public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            RegexCatchReplacer_Ebao inst = new RegexCatchReplacer_Ebao();
            inst.setLocationRelativeTo(null);
            gtu.swing.util.JFrameUtil.setVisible(true, inst);
        }
    });
}