Java Code Examples for javax.swing.JFrame.show()

The following are Jave code examples for showing how to use show() of the javax.swing.JFrame class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: geomapapp   File: DBFFile.java   View Source Code Vote up 6 votes
public static void main(String[] args) {
	javax.swing.JFileChooser c = new javax.swing.JFileChooser(
			System.getProperty( "user.dir" ));
	int ok = c.showOpenDialog(null);
	if( ok==c.CANCEL_OPTION) System.exit(0);
	File f = c.getSelectedFile();
	String path = f.getParent();
	String prefix = f.getName();
	prefix = prefix.substring(0, prefix.indexOf(".dbf"));
	try {
		DBFFile dbf = new DBFFile(path, prefix);
		JTable t = new JTable(dbf);
		JFrame frame = new JFrame(f.getName());
		frame.getContentPane().add(new JScrollPane(t));
		frame.pack();
		frame.show();
		frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
	} catch(IOException ex) {
		ex.printStackTrace();
		System.exit(-1);
	}
//	System.exit(0);
}
 
Example 2
Project: geomapapp   File: ShapeSuite.java   View Source Code Vote up 6 votes
public static void main(String[] args) {
	ShapeSuite suite = new ShapeSuite();
	try {
		suite.addShapeFile();
	} catch(IOException e) {
		e.printStackTrace(System.err);
		System.exit(0);
	}
	MapApp app = new MapApp(MapApp.MERCATOR_MAP);
	suite.setMap( app.getMap() );
	suite.setParent( app.getMap().getTopLevelAncestor(), null );
	JTable table = new JTable(suite);
	JFrame frame = new JFrame();
	frame.getContentPane().add(new JScrollPane(table));
	frame.pack();
	frame.show();
}
 
Example 3
Project: geomapapp   File: SymbolScaleTool.java   View Source Code Vote up 6 votes
public static void main(String[] args) {
	float[] data = new float[1000];
	for(int k=0 ; k<1000 ; k++) data[k]=(float)Math.random();
	SymbolScaleTool tools = new SymbolScaleTool(data, null);
	tools.addPropertyChangeListener( 
		new PropertyChangeListener() {
			public void propertyChange(PropertyChangeEvent evt) {
				System.out.println( evt.getPropertyName() );
			}
		});
//	tools.showDialog( (JFrame)null );
	JFrame frame = new JFrame("test");
	frame.getContentPane().add(tools);
	frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE);
	frame.pack();
	frame.show();
}
 
Example 4
Project: incubator-netbeans   File: FocusAfterBadEditTest.java   View Source Code Vote up 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
Project: incubator-netbeans   File: RendererDisplayerTest.java   View Source Code Vote up 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 6
Project: incubator-netbeans   File: SheetTableTest.java   View Source Code Vote up 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 7
Project: incubator-netbeans   File: PropertyPanelInDialogTest.java   View Source Code Vote up 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 8
Project: geomapapp   File: GTable.java   View Source Code Vote up 5 votes
public static void main(String[] args) {
	try {
		JFileChooser c = new JFileChooser(System.getProperty("user.dir"));
		int ok = c.showOpenDialog(null);
		if( ok==c.CANCEL_OPTION )System.exit(0);
		GTable t = new GTable(c.getSelectedFile());
		XBTable table = t.createTable();
		table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
		table.setScrollableTracksViewportWidth(false);

		MapApp app = null;
		if( args.length>0 ) {
			PC pc = new PC();
			app = pc.getApp();
		} else {
			app = new MapApp();
		}
		XMap map = app.getMap();
		t.setMap( map);

		map.addOverlay( t );

		JFrame f = new JFrame( c.getSelectedFile().getName() );
		f.getContentPane().add(new JScrollPane(table));
		f.pack();
		f.show();
	//	f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
		map.repaint();
	} catch(Throwable e) {
		e.printStackTrace();
		System.exit(-1);
	}
}
 
Example 9
Project: incubator-netbeans   File: ComboTest.java   View Source Code Vote up 5 votes
public WaitWindow(JFrame f) {
    f.addWindowListener(this);
    f.show();
    if (!shown) {
        synchronized(this) {
            try {
                wait(5000);
            } catch (Exception e) {}
        }
    }
}
 
Example 10
Project: cuttlefish   File: StaticGraphDraw.java   View Source Code Vote up 5 votes
/**
     * @param g
     * @param startup
     * @param layout
     * @param d
     */
    public static void main( String[] s ) {
//        StaticLayout start = new CircleLayout();
        StaticLayout end = new IterableToStaticLayout(new CircleLayout(), new KKLayout());
        Graph g = TestGraphs.getDemoGraph(); 
        Dimension d = new Dimension( 200, 200);
        end.initializeLocations(d, g);
        VertexRenderer vr = new SimpleVertexRenderer();
        EdgeRenderer er = new SimpleEdgeRenderer();
        
        GraphLayoutPanel jgp = new GraphLayoutPanel(g, d, vr, er);
        jgp.addClickListener(new ClickListener() {

            public void edgeClicked(ClickEvent ece) {
                System.out.println( ece );
            }

            public void vertexClicked(ClickEvent vce) {
                System.out.println( vce );
            }           
            
        });
        jgp.setLayoutDisplay( end.emit() );
        
        JFrame jf = new JFrame();
        jf.getContentPane().add( jgp );
        jf.pack();
        jf.show();
        jf.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    }
 
Example 11
Project: geomapapp   File: GMATable.java   View Source Code Vote up 5 votes
public static void main(String[] args) {
	try {
		JFileChooser c = new JFileChooser(System.getProperty("user.dir"));
		int ok = c.showOpenDialog(null);
		if( ok==c.CANCEL_OPTION )System.exit(0);
		GMATable t = new GMATable(c.getSelectedFile());
		XBTable table = t.createTable();
		table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
		table.setScrollableTracksViewportWidth(false);

		MapApp app = null;
		if( args.length>0 ) {
			PC pc = new PC();
			app = pc.getApp();
		} else {
			app = new MapApp();
		}
		XMap map = app.getMap();
		t.setMap( map);

		map.addOverlay( t );

		JFrame f = new JFrame( c.getSelectedFile().getName() );
		f.getContentPane().add(new JScrollPane(table));
		f.pack();
		f.show();
	//	f.setDefaultCloseOperation(f.EXIT_ON_CLOSE);
		map.repaint();
	} catch(Throwable e) {
		e.printStackTrace();
		System.exit(-1);
	}
}
 
Example 12
Project: DicomViewer   File: DicomViewer.java   View Source Code Vote up 5 votes
public static void main(String[] args) throws Exception {
    JFrame frame = new JFrame("OpenCL Editor");
    frame.setResizable(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    DicomViewer ch = new DicomViewer();
    ch.setPreferredSize(new Dimension(800, 600));
    frame.setLayout(new BorderLayout());
    frame.add(ch, BorderLayout.CENTER);
    frame.pack();
    frame.show();
    ch.onLoadProgram();
}
 
Example 13
Project: geomapapp   File: BalancePanel.java   View Source Code Vote up 5 votes
public static void main(String[] args) {
	BalancePanel bp = new BalancePanel();
	bp.addPropertyChangeListener( 
		new java.beans.PropertyChangeListener() {
			public void propertyChange(java.beans.PropertyChangeEvent evt) {
				System.out.println(evt.getPropertyName());
			}
		});
	JFrame colorDialog = new JFrame( "color balance" );
	colorDialog.getContentPane().add( bp );
	colorDialog.pack();
	colorDialog.show();
	colorDialog.setDefaultCloseOperation( colorDialog.EXIT_ON_CLOSE );
}
 
Example 14
Project: incubator-netbeans   File: TreeModelExample3.java   View Source Code Vote up 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 15
Project: incubator-netbeans   File: TreeModelExample3.java   View Source Code Vote up 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 16
Project: incubator-netbeans   File: TreeModelExample4.java   View Source Code Vote up 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 17
Project: incubator-netbeans   File: TreeModelExample4.java   View Source Code Vote up 5 votes
public static void main (String[] args) {
    TreeModelExample4 tme = new TreeModelExample4 ();
    ArrayList columns = new ArrayList ();
    columns.add (new ColumnModel () {
        public String getID () {
            return "sizeID";
        }

        public String getDisplayName () {
            return "size";
        }

        public Class getType () {
            return String.class;
        }
    });
    JComponent ttv = Models.createView (
        tme,              // TreeModel
        tme,              // NodeModel
        tme,              // TableModel
        tme,              // NodeActionsProvider
        columns           // list of ColumnModels
    );
    JFrame f = new JFrame ("Tree Model Example 4");
    f.getContentPane ().add (ttv);
    f.pack ();
    f.show ();
}
 
Example 18
Project: geomapapp   File: StartUp.java   View Source Code Vote up 5 votes
public static void main(String[] args) {
	StartUp s = new StartUp(1);
	JFrame frame = new JFrame("startup");
	frame.getContentPane().add(s);
	frame.pack();
	frame.show();
}
 
Example 19
Project: incubator-netbeans   File: IndexedPropertyTest.java   View Source Code Vote up 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());
    }
}
 
Example 20
Project: incubator-netbeans   File: NodeDeletionTest.java   View Source Code Vote up 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());
    }
}