List of usage examples for javax.swing JFrame setVisible
public void setVisible(boolean b)
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new BorderLayout()); f.add(new TestPane()); f.pack();//from www . ja v a 2 s . c om f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JTabbedPane tp = new JTabbedPane(); tp.addTab("Dates", new JPanel()); tp.addTab("Deliveries", new JPanel()); tp.addTab("Exports", new JPanel()); tp.setTabComponentAt(0, new JLabel("Dates")); tp.setTabComponentAt(1, new JLabel("Deliveries")); tp.setTabComponentAt(2, new JLabel("Exports")); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(tp);// w w w. ja v a 2s .co m frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { final JTextPane textPane = new JTextPane(); final JScrollPane scrollPane = new JScrollPane(textPane); String text = "Lorem ipsum dolor sit amet, " + "consectetur adipiscing elit." + "Fusce nec sapien id diam consequat adipiscing."; textPane.setText(text);/*from ww w . j a v a2 s . c o m*/ JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(scrollPane); frame.setSize(new Dimension(200, 200)); frame.setVisible(true); FontMetrics metrics = textPane.getFontMetrics(textPane.getFont()); textPane.setMargin(new Insets(scrollPane.getViewport().getHeight() - metrics.getHeight(), 0, 0, 0)); }
From source file:ScrollBarSample.java
public static void main(String args[]) { AdjustmentListener adjustmentListener = new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent adjustmentEvent) { System.out.println("Adjusted: " + adjustmentEvent.getValue()); }/*w w w .j av a 2 s.c om*/ }; JScrollBar oneJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); oneJScrollBar.addAdjustmentListener(adjustmentListener); JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(oneJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(final String[] av) { JFrame frame = new JFrame(); Container cp = frame.getContentPane(); cp.add(new FileTree(new File("."))); frame.pack();//from ww w.j a v a2 s . c om frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:Main.java
public static void main(String s[]) { JFrame frame = new JFrame("Scroll Bar Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new Main()); frame.setSize(200, 200);// w ww. j av a2s. c om frame.setVisible(true); }
From source file:GridBagConstraintsSimplePanel.java
public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new GridBagConstraintsSimplePanel()); f.setSize(400, 300);//w ww . j a va 2 s.co m f.setVisible(true); }
From source file:MatteExample.java
public static void main(String s[]) { JFrame frame = new JFrame("Matte Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(500, 200);/*from www . j av a 2s . co m*/ frame.setContentPane(new MatteExample()); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new HighlightLineTextPane()); frame.setBounds(100, 100, 300, 400); frame.setVisible(true); }
From source file:MaxLengthDocument.java
public static void main(String[] args) { Document doc = new MaxLengthDocument(5); JTextField field = new JTextField(doc, "", 8); JPanel flowPanel = new JPanel(); flowPanel.add(field);/*from w w w.ja v a 2 s . c om*/ JFrame frame = new JFrame("MaxLengthDocument demo"); frame.setContentPane(flowPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(160, 80); frame.setVisible(true); }