Java Code Examples for javax.swing.JFrame#show()
The following examples show how to use
javax.swing.JFrame#show() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XMIllumDesktop.java From pdfxtk with Apache License 2.0 | 6 votes |
/** Sets up the desktop */ public JDesktopPane setupDesktop() { JDesktopPane desktop = new JDesktopPane(); Dimension size = Toolkit.getDefaultToolkit().getScreenSize(); size.width = size.width - 80; size.height = size.height - 40; JFrame window = new JFrame("XMIllum"); window.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { Preferences.store(); System.exit(0); } }); window.setContentPane(desktop); window.pack(); window.setSize(size); window.setLocation(0, 0); window.show(); Preferences.watch(window); return desktop; }
Example 2
Source File: TexturedText.java From mars-sim with GNU General Public License v3.0 | 6 votes |
public static void main(String[] args) { JFrame f = new JFrame(); WebLookAndFeel.install(); JPanel panel = new JPanel(new GridLayout(1, 17)); f.getContentPane().add(panel); // for (int i=0; i<17; i++) { // WebStyledLabel icon = new WebStyledLabel (WebLookAndFeel.getIcon(i)); // panel.add(icon); // } // f.getContentPane().add(new TexturedText()); f.setSize(800, 200); f.show(); }
Example 3
Source File: HilightImagePanel.java From pdfxtk with Apache License 2.0 | 6 votes |
/** Test program */ public static void main(String[] arg) { PlanarImage image = JAI.create("fileload", arg[0]); PlanarImage mask = JAI.create("fileload", arg[1]); JFrame window = new JFrame(); window.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); window.getContentPane().add(new HilightImagePanel(image, mask, Color.blue), BorderLayout.CENTER); window.pack(); window.setSize(300, 300); window.setLocation(40, 40); window.show(); }
Example 4
Source File: FocusAfterBadEditTest.java From netbeans with Apache License 2.0 | 5 votes |
public WaitWindow(JFrame f) { f.addWindowListener(this); f.show(); if (!shown) { synchronized(this) { try { //System.err.println("Waiting for window"); wait(5000); } catch (Exception e) {} } } }
Example 5
Source File: Flash.java From ETL_Unicorn with Apache License 2.0 | 5 votes |
@SuppressWarnings(StableData.TAG_DEPRECATION) public static void main(String args[]){ GUISample NE= new GUISample(); JFrame frame= new JFrame("Deta ETL 1.0.2"); frame.setLayout(null); frame.resize(800, 440); frame.show(); frame.add(NE); NE.init(); NE.start(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
Example 6
Source File: TreeModelExample3.java From netbeans with Apache License 2.0 | 5 votes |
public static void main (String[] args) { TreeModelExample3 tme = new TreeModelExample3 (); JComponent ttv = Models.createView ( tme, // TreeModel tme, // NodeModel null, // TableModel tme, // NodeActionsProvider new ArrayList () // list of ColumnModels ); JFrame f = new JFrame ("Tree Model Example 3"); f.getContentPane ().add (ttv); f.pack (); f.show (); }
Example 7
Source File: TreeModelExample3.java From netbeans with Apache License 2.0 | 5 votes |
public void performDefaultAction (Object node) { try { JFrame f = new JFrame ("View"); f.getContentPane ().add (new JEditorPane (((File) node).toURL ())); f.pack (); f.show (); } catch (Exception e) { e.printStackTrace(); } }
Example 8
Source File: TreeModelExample1.java From netbeans with Apache License 2.0 | 5 votes |
public static void main (String[] args) { TreeModelExample1 tme = new TreeModelExample1 (); JComponent ttv = Models.createView ( tme, // TreeModel null, // NodeModel null, // TableModel null, // NodeActionsProvider new ArrayList () // list of ColumnModels ); JFrame f = new JFrame ("Tree Model Example 1"); f.getContentPane ().add (ttv); f.pack (); f.show (); }
Example 9
Source File: EditableDisplayerTest.java From netbeans with Apache License 2.0 | 5 votes |
/** Implementation of assertPixel sans invokeAndWait */ private synchronized void doAssertPixel(final String msg, final Component c, final Color toMatch, final int x, final int y) throws Exception { final BufferedImage bi = new BufferedImage(700, 700, BufferedImage.TYPE_INT_RGB); sleep(); ((JComponent) c).paintAll(bi.getGraphics()); sleep(); int[] cArr = new int[3]; bi.getData().getPixel(x, y, cArr); checkColor = new Color(cArr[0], cArr[1], cArr[2]); //uncomment the code below for diagnosing painting problems //and seeing which pixel you'return really checking JFrame jf = new JFrame("Assert pixel test " + count + " (look for the yellow line)") { public void paint(Graphics g) { new ImageIcon(bi).paintIcon(this, g, 25, 25); g.setColor(Color.YELLOW); g.drawLine(x+20, y+25, x+25, y+25); } }; jf.setLocation(400,400); jf.setSize(500,500); jf.show(); count++; assertEquals("Pixel test " + (count-1) + " " + msg + " - Color at " + x + "," + y + " does not match", toMatch, checkColor); }
Example 10
Source File: EditableDisplayerTest.java From netbeans with Apache License 2.0 | 5 votes |
/** Asserts that a pixel at a given position in an image matches a * pixel in a given position in a component */ private synchronized void assertPixelFromImage(String msg, final Image i, final Component c, final int imageX, final int imageY, final int compX, final int compY) throws Exception { final BufferedImage bi = i instanceof BufferedImage ? (BufferedImage) i : toBufferedImage(i); throwMe = null; sleep(); int rgb = bi.getRGB(imageX, imageY); Color color = new Color(rgb); //uncomment the code below for diagnosing painting problems //and seeing which pixel you'return really checking JFrame jf = new JFrame("assertPixelFromImage " + count + " (look for the yellow line)") { public void paint(Graphics g) { new ImageIcon(bi).paintIcon(this, g, 25, 25); g.setColor(Color.YELLOW); g.drawLine(imageX+20, imageY+25, imageX+25, imageY+25); } }; jf.setLocation(500,500); jf.setSize(100,100); jf.show(); try { assertPixel(msg, c, color, compX, compY); } catch (Exception e) { throwMe = e; } if (throwMe != null) { throw throwMe; } }
Example 11
Source File: EditableDisplayerTest.java From netbeans with Apache License 2.0 | 5 votes |
public WaitWindow(JFrame f) { f.addWindowListener(this); f.show(); if (!shown) { synchronized(this) { try { //System.err.println("Waiting for window"); wait(5000); } catch (Exception e) {} } } }
Example 12
Source File: TreeModelExample2.java From netbeans with Apache License 2.0 | 5 votes |
public static void main (String[] args) { TreeModelExample2 tme = new TreeModelExample2 (); JComponent ttv = Models.createView ( tme, // TreeModel tme, // NodeModel null, // TableModel null, // NodeActionsProvider new ArrayList () // list of ColumnModels ); JFrame f = new JFrame ("Tree Model Example 2"); f.getContentPane ().add (ttv); f.pack (); f.show (); }
Example 13
Source File: DemoModule.java From beautyeye with Apache License 2.0 | 5 votes |
/** * Main impl. */ public void mainImpl() { JFrame frame = new JFrame(getName()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(getDemoPanel(), BorderLayout.CENTER); getDemoPanel().setPreferredSize(new Dimension(PREFERRED_WIDTH, PREFERRED_HEIGHT)); frame.pack(); frame.show(); }
Example 14
Source File: PropertyPanelInDialogTest.java From netbeans with Apache License 2.0 | 5 votes |
public WaitWindow(JFrame f) { f.addWindowListener(this); f.show(); if (!shown) { synchronized(this) { try { //System.err.println("Waiting for window"); wait(5000); } catch (Exception e) {} } } }
Example 15
Source File: SheetTableTest.java From netbeans with Apache License 2.0 | 5 votes |
public WaitWindow(JFrame f) { f.addWindowListener(this); f.show(); if (!shown) { synchronized(this) { try { //System.err.println("Waiting for window"); wait(5000); } catch (Exception e) {} } } }
Example 16
Source File: RendererDisplayerTest.java From netbeans with Apache License 2.0 | 5 votes |
public WaitWindow(JFrame f) { f.addWindowListener(this); f.show(); if (!shown) { synchronized(this) { try { //System.err.println("Waiting for window"); wait(5000); } catch (Exception e) {} } } }
Example 17
Source File: Swing1.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
public static void main(String args[]) { JFrame frame = new JFrame(); frame.setTitle("Title"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton button = new JButton(); button.setText("Hello, World!"); frame.getContentPane().add(button, BorderLayout.CENTER); frame.setSize(200, 100); frame.pack(); frame.setVisible(true); frame.show(); }
Example 18
Source File: PropertySheetTest.java From netbeans with Apache License 2.0 | 4 votes |
protected void setUp() throws Exception { if (setup) return; setup = true; // Create new TestProperty tp = new TProperty("TProperty", true); // Create new TEditor te = new TEditor(); // Create new TNode tn = new TNode(); LOG.info("RUNNING ON THREAD " + Thread.currentThread()); //Replacing NodeOp w/ JFrame to eliminate depending on full IDE init //and long delay while waiting for property sheet thus requested to //initialize final JFrame jf = new JFrame(); final PropertySheet ps = new PropertySheet(); jf.getContentPane().setLayout(new BorderLayout()); jf.getContentPane().add(ps, BorderLayout.CENTER); jf.setLocation(30,30); jf.setSize(500,500); final Node[] nodes = new Node[]{tn}; SwingUtilities.invokeAndWait(new Runnable() { public void run() { ps.setNodes(nodes); jf.show(); } }); jf.show(); new ExtTestCase.WaitWindow(jf); LOG.info("Current node set "); try { // Wait for the initialization for (int i = 0; i < 10; i++) { final String asText = te.getAsText(); if (asText == null || asText.equals("null")) { LOG.info("Checking editor getAsText - " + te.getAsText()); //System.out.println("null"); Thread.sleep(1000); } else break; } // Test if the initialization was successfull initEditorValue = te.getAsText(); LOG.info("Got initial editor value " + initEditorValue); initPropertyValue = tp.getValue().toString(); LOG.info("Got initial property value " + initPropertyValue); //Set new value to the Property tp.setValue("Test2"); postChangePropertyValue = tp.getValue().toString(); LOG.info("Post change property value is " + postChangePropertyValue); // Wait for the reinitialization for (int i = 0; i < 100; i++) { if (te.getAsText().equals(initEditorValue)) { //LOG.info(i + " value not updated ");; Thread.sleep(50); } else { LOG.info("value was updated"); break; } } //issues 39205 & 39206 - ensure the property sheet really repaints //before we get the value, or the value in the editor will not //have changed SwingUtilities.invokeAndWait(new Runnable() { public void run() { Graphics g = ps.getGraphics(); ps.paintImmediately(0,0,ps.getWidth(), ps.getHeight()); } }); // Test if the reinitialization was successfull postChangeEditorValue = te.getAsText(); LOG.info("postEditorChangeValue = " + postChangeEditorValue); } finally { jf.hide(); jf.dispose(); } }
Example 19
Source File: NodeDeletionTest.java From netbeans with Apache License 2.0 | 4 votes |
protected void setUp() throws Exception { // Create new TEditor te = new TEditor(); // Create new TNode tn = new TNode(); //Replacing NodeOp w/ JFrame to eliminate depending on full IDE init //and long delay while waiting for property sheet thus requested to //initialize final JFrame jf = new JFrame(); ps = new PropertySheet(); jf.getContentPane().setLayout(new BorderLayout()); jf.getContentPane().add(ps, BorderLayout.CENTER); jf.setLocation(30,30); jf.setSize(500,500); final Node[] nodes = new Node[]{tn}; SwingUtilities.invokeAndWait(new Runnable() { public void run() { ps.setNodes(nodes); //ps.setCurrentNode(tn); jf.show(); } }); jf.show(); new ExtTestCase.WaitWindow(jf); try { // Wait for the initialization for (int i = 0; i < 10; i++) { final String asText = te.getAsText(); if (asText == null || asText.equals("null")) { //System.out.println("null"); Thread.sleep(1000); } else break; } ensurePainted(ps); } catch (Exception e) { fail("FAILED - Exception thrown "+e.getClass().toString()); } }
Example 20
Source File: IndexedPropertyTest.java From netbeans with Apache License 2.0 | 4 votes |
protected void setUp() throws Exception { // Create new TEditor te = new TEditor(); // Create new TNode tn = new TNode(); //Replacing NodeOp w/ JFrame to eliminate depending on full IDE init //and long delay while waiting for property sheet thus requested to //initialize final JFrame jf = new JFrame(); ps = new PropertySheet(); jf.getContentPane().setLayout(new BorderLayout()); jf.getContentPane().add(ps, BorderLayout.CENTER); jf.setLocation(30,30); jf.setSize(500,500); SwingUtilities.invokeAndWait(new Runnable() { public void run() { ps.setNodes(new Node[] {tn}); //ps.setCurrentNode(tn); jf.show(); } }); jf.show(); new ExtTestCase.WaitWindow(jf); try { // Wait for the initialization for (int i = 0; i < 10; i++) { final String asText = te.getAsText(); if (asText == null || asText.equals("null")) { //System.out.println("null"); Thread.sleep(1000); } else break; } ensurePainted(ps); } catch (Exception e) { fail("FAILED - Exception thrown "+e.getClass().toString()); } }