List of usage examples for javax.swing JFrame pack
@SuppressWarnings("deprecation") public void pack()
From source file:TextQualityDemoVALUE_TEXT_ANTIALIAS_LCD_HBGR.java
public static void main(String[] args) { JFrame frame = new JFrame("LCD Text Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(630, 460)); frame.setContentPane(new MyPanel(RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HBGR)); frame.pack(); frame.setVisible(true);//w ww . j av a 2 s . c o m }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame("JFileChooser Popup"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFileChooser fileChooser = new JFileChooser("."); fileChooser.ensureFileIsVisible(new File(".")); frame.add(fileChooser, BorderLayout.CENTER); frame.pack(); frame.setVisible(true);//from w w w . j a v a 2s. c o m }
From source file:TextQualityDemoVALUE_TEXT_ANTIALIAS_LCD_VBGR.java
public static void main(String[] args) { JFrame frame = new JFrame("LCD Text Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(630, 460)); frame.setContentPane(new MyPanel(RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VBGR)); frame.pack(); frame.setVisible(true);// ww w . j a v a2s . co m }
From source file:WindowsLookAndFeelDemo.java
public static void main(String[] args) { try {//from w w w .j av a 2 s .c o m UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } JLabel label = new JLabel("Label"); JTextField field = new JTextField("www.java2s.com!"); JList list = new JList(new String[] { "A", "B", "C" }); JScrollPane listPane = new JScrollPane(list); listPane.setPreferredSize(new Dimension(250, 100)); JScrollPane treePane = new JScrollPane(new JTree()); treePane.setPreferredSize(new Dimension(250, 100)); JButton button = new JButton("Click me"); JPanel cp = new JPanel(); cp.add(label); cp.add(field); cp.add(listPane); cp.add(treePane); cp.add(button); JFrame frame = new JFrame(); frame.setTitle("Windows Look and Feel Demo"); frame.setPreferredSize(new Dimension(280, 300)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(cp); frame.pack(); frame.setVisible(true); }
From source file:TextQualityDemoVALUE_TEXT_ANTIALIAS_LCD_HRGB.java
public static void main(String[] args) { JFrame frame = new JFrame("LCD Text Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(630, 460)); frame.setContentPane(new MyPanel(RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB)); frame.pack(); frame.setVisible(true);//from w w w.ja v a 2 s . c o m }
From source file:TextQualityDemoVALUE_TEXT_ANTIALIAS_LCD_VRGB.java
public static void main(String[] args) { JFrame frame = new JFrame("LCD Text Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(630, 460)); frame.setContentPane(new MyPanel(RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_VRGB)); frame.pack(); frame.setVisible(true);//from w ww . j av a 2s. c o m }
From source file:GTKLookAndFeelDemo.java
public static void main(String[] args) { try {// w ww.ja v a 2 s . c om UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } JLabel label = new JLabel("Label"); JTextField field = new JTextField("www.java2s.com!"); JList list = new JList(new String[] { "A", "B", "C" }); JScrollPane listPane = new JScrollPane(list); listPane.setPreferredSize(new Dimension(250, 100)); JScrollPane treePane = new JScrollPane(new JTree()); treePane.setPreferredSize(new Dimension(250, 100)); JButton button = new JButton("Click me"); JPanel cp = new JPanel(); cp.add(label); cp.add(field); cp.add(listPane); cp.add(treePane); cp.add(button); JFrame frame = new JFrame(); frame.setTitle("Windows Look and Feel Demo"); frame.setPreferredSize(new Dimension(280, 300)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(cp); frame.pack(); frame.setVisible(true); }
From source file:com.google.code.facebook.graph.sna.applet.VertexLabelAsShapeDemo.java
/** * a driver for this demo/*from w w w. j ava2 s. com*/ */ public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new VertexLabelAsShapeDemo()); f.pack(); f.setVisible(true); }
From source file:MainClass.java
public static void main(String argv[]) { java.net.URL u = null;/*from w ww . j a va2s . c om*/ try { u = new java.net.URL("http://www.java2s.com/"); } catch (java.net.MalformedURLException ignored) { } JFormattedTextField ftf1 = new JFormattedTextField(u); JFormattedTextField ftf2 = new JFormattedTextField(u); ftf2.setInputVerifier(new InputVerifier() { public boolean verify(JComponent input) { if (!(input instanceof JFormattedTextField)) return true; return ((JFormattedTextField) input).isEditValid(); } }); JPanel p = new JPanel(new GridLayout(0, 2, 3, 8)); p.add(new JLabel("plain JFormattedTextField:")); p.add(ftf1); p.add(new JLabel("FTF with InputVerifier:")); p.add(ftf2); p.add(new JLabel("plain JTextField:")); p.add(new JTextField(u.toString())); JFrame f = new JFrame("MainClass"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new JLabel("Try to delete the colon in each field."), "North"); f.getContentPane().add(p, "Center"); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("JLabel Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("First Name"); label.setFont(new Font("Courier New", Font.ITALIC, 18)); label.setForeground(Color.RED); frame.add(label);/* ww w . j av a2s. c o m*/ frame.pack(); frame.setVisible(true); }