List of usage examples for java.lang Runnable Runnable
Runnable
From source file:gtu._work.ui.PropertyEditUI.java
/** * Auto-generated main method to display this JFrame *//*from w w w . j a va 2 s . c om*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { PropertyEditUI inst = new PropertyEditUI(); inst.setLocationRelativeTo(null); gtu.swing.util.JFrameUtil.setVisible(true, inst); } }); }
From source file:gtu._work.ui.SvnLastestCommitInfoUI.java
/** * Auto-generated main method to display this JFrame *///from www . j a v a 2s . c om public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { SvnLastestCommitInfoUI inst = new SvnLastestCommitInfoUI(); inst.setLocationRelativeTo(null); gtu.swing.util.JFrameUtil.setVisible(true, inst); } }); }
From source file:SwingThreadingWait.java
public static void main(String... args) { SwingUtilities.invokeLater(new Runnable() { public void run() { SwingThreadingWait edt = new SwingThreadingWait(); edt.setVisible(true);/*from w w w.ja va2 s.com*/ } }); }
From source file:com.adobe.aem.demo.gui.AemDemo.java
public static void main(String[] args) { String demoMachineRootFolder = null; // Command line options for this tool Options options = new Options(); options.addOption("f", true, "Path to Demo Machine root folder"); CommandLineParser parser = new BasicParser(); try {//from w ww . j av a 2 s. c om CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("f")) { demoMachineRootFolder = cmd.getOptionValue("f"); } } catch (ParseException ex) { logger.error(ex.getMessage()); } // Let's check if we have a valid build.xml file to work with... String buildFilePath = (demoMachineRootFolder != null ? demoMachineRootFolder : System.getProperty("user.dir")) + File.separator + "build.xml"; logger.debug("Trying to load build file from " + buildFilePath); buildFile = new File(buildFilePath); if (buildFile.exists() && !buildFile.isDirectory()) { // Launching the main window EventQueue.invokeLater(new Runnable() { public void run() { try { UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("Arial", Font.BOLD, 14)); AemDemo window = new AemDemo(); window.frameMain.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } else { logger.error("No valid build.xml file to work with"); System.exit(-1); } }
From source file:com.raddle.tools.ClipboardTransferMain.java
/** * Auto-generated main method to display this JFrame *//*from w ww . jav a2s. c o m*/ public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ClipboardTransferMain inst = new ClipboardTransferMain(); inst.setLocationRelativeTo(null); inst.setDefaultCloseOperation(EXIT_ON_CLOSE); if (args != null) { for (String string : args) { if ("-s".equals(string)) { inst.startServer(); } } for (String string : args) { if ("-m".equals(string)) { inst.setState(Frame.ICONIFIED); } } } if (inst.getState() != Frame.ICONIFIED) { inst.setVisible(true); } } }); }
From source file:cz.lidinsky.editor.Editor.java
/** * Entry point of the editor./*from w w w . j a va 2 s . co m*/ */ public static void main(String[] args) throws Exception { // create an instance of the editor instance = new Editor(); // load settings file java.io.InputStream settingsIS = instance.getClass().getResourceAsStream(settingsFilename); instance.settings.load(settingsIS); settingsIS.close(); // create and show gui instance.createMainFrame(); // load file from the command line if (args.length > 0) instance.filename = args[0]; javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { if (instance.filename != null) { try { java.io.File file = new java.io.File(instance.filename); instance.file.load(file); } catch (Exception e) { throw new CommonException().setCause(e) .set("message", "Exception while loading a file with gui!") .set("file name", instance.filename); } } else { instance.file.fileNew(); } } }); // show the window instance.show(); }
From source file:com.qawaa.gui.EventWebScanGUI.java
/** * Auto-generated main method to display this JFrame *//*from w ww .j a va2 s . c o m*/ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { EventWebScanGUI inst = new EventWebScanGUI(); inst.setLocationRelativeTo(null); inst.setVisible(true); inst.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFrame.setDefaultLookAndFeelDecorated(true); FlowLayout flowLayout = new FlowLayout(); flowLayout.setAlignment(FlowLayout.LEFT); flowLayout.setAlignOnBaseline(true); inst.setTitle(PROGRAM_NAME + " [" + PROGRAM_VERSION + "] " + " - " + DefaultMessage.SOFT_NAME + " - " + DefaultMessage.COMPANY_NAME); { consoleScrollPane = new JScrollPane(); inst.getContentPane().add(consoleScrollPane, BorderLayout.CENTER); { consolePane = new JEditorPane(); consoleScrollPane.setViewportView(consolePane); consolePane.setText(""); setConsoleRight(); jConsole = new JConsole(System.out, consolePane); System.setOut(jConsole); System.setErr(jConsole); consolePane.setEditable(false); consolePane.addMouseListener(new MouseAdapter() { /* (non-Javadoc) * @see java.awt.event.MouseAdapter#mouseReleased(java.awt.event.MouseEvent) */ public void mouseReleased(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3) { consolePane.add(consoleRight); consoleRight.show(e.getComponent(), e.getX(), e.getY()); } } }); } } { infoPanel = new JPanel(); inst.getContentPane().add(infoPanel, BorderLayout.SOUTH); infoPanel.setBorder(new LineBorder(new Color(0, 0, 0), 1, false)); infoPanel.setPreferredSize(new Dimension(784, 30)); infoPanel.setLayout(flowLayout); { { statusbar_count = new JTextPane(); infoPanel.add(statusbar_count); statusbar_count.setText( CONTEXT.getMessage("event.web.scan.statusbar.count", null, Locale.CHINA)); statusbar_count.setBackground(null); statusbar_count.setEditable(false); } { statusbar_count_value = new JTextPane(); infoPanel.add(statusbar_count_value); statusbar_count_value.setText(String.valueOf(SCAN_COUNT)); statusbar_count_value.setBackground(null); statusbar_count_value.setEditable(false); statusbar_count_value.setEnabled(false); } { programPID = new JTextPane(); infoPanel.add(programPID); programPID.setText("PID:"); programPID.setBackground(null); programPID.setEditable(false); } { programPID_value = new JTextPane(); infoPanel.add(programPID_value); programPID_value.setText(JvmPid.getPID()); programPID_value.setBackground(null); programPID_value.setEditable(false); programPID_value.setEnabled(false); } { memory = new JTextPane(); infoPanel.add(memory); memory.setText(CONTEXT.getMessage("gobal.gui.memory", null, Locale.CHINA)); memory.setBackground(null); memory.setEditable(false); } { memory_value = new JTextPane(); infoPanel.add(memory_value); memory_value.setText("0KB"); memory_value.setBackground(null); memory_value.setEditable(false); memory_value.setEnabled(false); MemoryListener memory = new MemoryListener(memory_value); memory.start(); } { runtime = new JTextPane(); infoPanel.add(runtime); runtime.setText(CONTEXT.getMessage("gobal.gui.runtime", null, Locale.CHINA)); runtime.setBackground(null); runtime.setEditable(false); } { runtime_value = new JTextPane(); infoPanel.add(runtime_value); runtime_value.setText("NULL"); runtime_value.setBackground(null); runtime_value.setEditable(false); runtime_value.setEnabled(false); } } } { shortcut = new JPanel(); inst.getContentPane().add(shortcut, BorderLayout.NORTH); shortcut.setSize(784, 35); shortcut.setPreferredSize(new Dimension(784, 35)); shortcut.setBorder(new LineBorder(new Color(0, 0, 0), 1, false)); shortcut.setLayout(new BorderLayout()); { eventText = new JTextPane(); shortcut.add(eventText, BorderLayout.WEST); eventText.setText(CONTEXT.getMessage("event.web.scan.name", null, Locale.CHINA) + ": "); eventText.setEditable(false); eventText.setEnabled(true); eventText.setBackground(null); eventText.setCaretColor(new Color(0, 0, 0)); } { eventTextField = new JTextField(); shortcut.add(eventTextField, BorderLayout.CENTER); eventTextField.setSize(500, 25); eventTextField.setText(""); eventTextField.setPreferredSize(new Dimension(500, 25)); eventTextField.setEditable(false); } { submit = new JButton(); shortcut.add(submit, BorderLayout.EAST); submit.setText(CONTEXT.getMessage("gobal.gui.button.run", null, Locale.CHINA)); submit.setSize(new Dimension(75, 25)); submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { submitActionPerformed(evt); } catch (InterruptedException e) { e.printStackTrace(); } } }); } } } }); }
From source file:org.eclipse.swt.snippets.Snippet209.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Composite comp = new Composite(shell, SWT.NONE); comp.setLayout(new FillLayout()); GLData data = new GLData(); data.doubleBuffer = true;/*from ww w . j av a2 s. c o m*/ final GLCanvas canvas = new GLCanvas(comp, SWT.NONE, data); canvas.setCurrent(); final GLContext context = GLDrawableFactory.getFactory(GLProfile.getGL2GL3()).createExternalGLContext(); ; canvas.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event event) { Rectangle bounds = canvas.getBounds(); float fAspect = (float) bounds.width / (float) bounds.height; canvas.setCurrent(); context.makeCurrent(); GL2 gl = (GL2) context.getGL(); gl.glViewport(0, 0, bounds.width, bounds.height); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); GLU glu = new GLU(); glu.gluPerspective(45.0f, fAspect, 0.5f, 400.0f); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glLoadIdentity(); context.release(); } }); context.makeCurrent(); GL2 gl = (GL2) context.getGL(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); gl.glColor3f(1.0f, 0.0f, 0.0f); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); gl.glClearDepth(1.0); gl.glLineWidth(2); gl.glEnable(GL.GL_DEPTH_TEST); context.release(); shell.setText("SWT/JOGL Example"); shell.setSize(640, 480); shell.open(); display.asyncExec(new Runnable() { int rot = 0; @Override public void run() { if (!canvas.isDisposed()) { canvas.setCurrent(); context.makeCurrent(); GL2 gl = (GL2) context.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glClearColor(.3f, .5f, .8f, 1.0f); gl.glLoadIdentity(); gl.glTranslatef(0.0f, 0.0f, -10.0f); float frot = rot; gl.glRotatef(0.15f * rot, 2.0f * frot, 10.0f * frot, 1.0f); gl.glRotatef(0.3f * rot, 3.0f * frot, 1.0f * frot, 1.0f); rot++; gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2.GL_LINE); gl.glColor3f(0.9f, 0.9f, 0.9f); drawTorus(gl, 1, 1.9f + ((float) Math.sin((0.004f * frot))), 15, 15); canvas.swapBuffers(); context.release(); display.asyncExec(this); } } }); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:havocx42.Program.java
public static void main(String[] args) throws ParseException { try {/*from w w w . j av a 2 s .c om*/ initRootLogger(); } catch (SecurityException | IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); return; } try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) { LOGGER.log(Level.WARNING, "Unable to set Look and Feel", e1); } Options options = new Options(); options.addOption("nogui", false, "run as a command line tool, must also supply -target and -source arguments"); options.addOption("source", true, "source directory where the PR weapons folder has been extracted"); options.addOption("target", true, "target file to write to"); options.addOption("version", false, "print the version information and exit"); options.addOption("help", false, "print this message"); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("version")) { System.out.println("PRStats " + VERSION); System.out.println("Written by havocx42"); return; } if ((cmd.hasOption("nogui") && (!cmd.hasOption("source") || !cmd.hasOption("target"))) || cmd.hasOption("help")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("PRStats", options); return; } final String target; final String source; source = cmd.getOptionValue("source"); target = cmd.getOptionValue("target"); LOGGER.info("Source Argument: " + source); LOGGER.info("Target Argument: " + target); if (!cmd.hasOption("nogui")) { EventQueue.invokeLater(new Runnable() { @SuppressWarnings("unused") public void run() { try { Gui window = new Gui(source, target); } catch (Exception e) { e.printStackTrace(); } } }); return; } File targetFile = new File(target); File sourceFile = new File(source); Controller controller = new Controller(); controller.run(sourceFile, targetFile); }
From source file:StylesExample8.java
public static void main(String[] args) { try {//from w w w . j a va 2 s .com UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception evt) { } JFrame f = new JFrame("Styles Example 8"); // Create the StyleContext, the document and the pane final StyleContext sc = new StyleContext(); final DefaultStyledDocument doc = new DefaultStyledDocument(sc); final JTextPane pane = new JTextPane(doc); // Build the styles createDocumentStyles(sc); try { // Add the text and apply the styles SwingUtilities.invokeAndWait(new Runnable() { public void run() { // Add the text addText(pane, sc, sc.getStyle(mainStyleName), content); } }); } catch (Exception e) { System.out.println("Exception when constructing document: " + e); System.exit(1); } f.getContentPane().add(new JScrollPane(pane)); f.setSize(500, 300); f.setVisible(true); }