List of usage examples for javax.swing JFrame pack
@SuppressWarnings("deprecation") public void pack()
From source file:Main.java
public static void main(String[] av) { JFrame frame = new JFrame(); Container cp = frame.getContentPane(); cp.add(new DriveTree(new File("."))); frame.pack(); frame.setVisible(true);/*from www. jav a 2 s.c om*/ frame.setSize(300, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:Main.java
public static void main(String s[]) { JFrame frame = new JFrame("List Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new Main()); frame.pack(); frame.setVisible(true);/*from ww w.j av a2 s . c o m*/ }
From source file:Main.java
public static void main(String[] args) { JPanel ui = new JPanel(new BorderLayout(2, 2)); ui.setBorder(new EmptyBorder(4, 4, 4, 4)); JPanel controls = new JPanel(new BorderLayout(2, 2)); ui.add(controls, BorderLayout.PAGE_START); String s = new String(Character.toChars(8594)); String[] items = { "Choice: right " + s + " arrow" }; JComboBox cb = new JComboBox(items); controls.add(cb, BorderLayout.CENTER); controls.add(new JButton("Button"), BorderLayout.LINE_END); JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JTextArea(4, 40), new JTextArea(4, 40)); ui.add(sp, BorderLayout.CENTER); JFrame f = new JFrame("Stretch Combo Layout"); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setContentPane(ui);// w w w .j a va 2 s. c o m f.pack(); f.setLocationByPlatform(true); f.setVisible(true); }
From source file:Main.java
public static void main(String arg[]) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add("Center", new Main()); frame.pack(); frame.setSize(new Dimension(350, 400)); frame.setVisible(true);//from ww w . j a v a 2 s . c om }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.getContentPane().add(new Main()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo(null);/*ww w . j a va2s . c o m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JTextArea textArea = new JTextArea(10, 30); AbstractDocument doc = (AbstractDocument) textArea.getDocument(); doc.setDocumentFilter(new EndOfLineFilter()); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new JScrollPane(textArea)); frame.pack(); frame.setVisible(true);/*from w w w . ja v a 2 s. com*/ }
From source file:TableDemoApplet.java
public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(3); createGUI(frame.getContentPane()); frame.pack(); frame.setVisible(true);/*from w ww. jav a 2 s . c o m*/ } }); }
From source file:Main.java
public static void main(String[] args) throws Exception { JTextField textField = new JTextField("Prefix_", 20); textField.setNavigationFilter(new NavigationFilterPrefixWithBackspace(7, textField)); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(textField); frame.pack(); frame.setVisible(true);// ww w .ja v a2 s .c o m }
From source file:Main.java
public static void main(String[] args) { JTextField firstField = new JTextField(10); JTextField middleField = new JTextField(10); JTextField lastField = new JTextField(10); JLabel firstLabel = new JLabel("First Name", JLabel.RIGHT); firstLabel.setDisplayedMnemonic('F'); firstLabel.setLabelFor(firstField);//www. j a v a 2 s .c o m JLabel middleLabel = new JLabel("Middle Initial", JLabel.RIGHT); middleLabel.setDisplayedMnemonic('I'); middleLabel.setDisplayedMnemonicIndex(7); middleLabel.setLabelFor(middleField); JLabel lastLabel = new JLabel("Last Name", JLabel.RIGHT); lastLabel.setDisplayedMnemonic('L'); lastLabel.setLabelFor(lastField); JPanel p = new JPanel(); p.setLayout(new GridLayout(3, 2, 5, 5)); p.add(firstLabel); p.add(firstField); p.add(middleLabel); p.add(middleField); p.add(lastLabel); p.add(lastField); JFrame f = new JFrame("MnemonicLabels"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setContentPane(p); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new Main()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationByPlatform(true);/*from w ww .j a v a 2 s . c o m*/ frame.pack(); frame.setVisible(true); }