List of usage examples for javax.swing JFrame JFrame
public JFrame(String title) throws HeadlessException
Frame
with the specified title. From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("JColorChooser Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(300, 200);//from www . ja v a2 s .c o m f.setVisible(true); FontMetrics metrics = f.getFontMetrics(f.getFont()); int widthX = metrics.charWidth((int) 'C'); System.out.println(widthX); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("JColorChooser Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(300, 200);//w w w . j a v a 2 s.c o m f.setVisible(true); FontMetrics metrics = f.getFontMetrics(f.getFont()); int widthX = metrics.charWidth('X'); System.out.println(widthX); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("JColorChooser Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(300, 200);/*from w w w . j a va 2 s. co m*/ f.setVisible(true); FontMetrics metrics = f.getFontMetrics(f.getFont()); int widthX = metrics.bytesWidth(new byte[] { 66, 67, 68, 69 }, 1, 2); System.out.println(widthX); }
From source file:HelloWorldSwing.java
public static void main(String[] args) { JFrame frame = new JFrame("HelloWorldSwing"); final JLabel label = new JLabel("Hello World"); frame.getContentPane().add(label);/* w w w. j a v a 2 s . co m*/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:GettingFontMetrics.java
public static void main(String args[]) { JFrame f = new JFrame("JColorChooser Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); FontMetrics metrics = f.getFontMetrics(f.getFont()); f.setSize(300, 200);/* w ww . j av a 2s . c o m*/ f.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Adornment Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setUndecorated(true);/*from w ww. j a va 2s. co m*/ frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); frame.setSize(300, 100); frame.setVisible(true); }
From source file:AdornSample.java
public static void main(final String args[]) { JFrame frame = new JFrame("Adornment Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setUndecorated(true);//w w w . ja v a2s.co m frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); frame.setSize(300, 100); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { JFrame f = new JFrame("Test"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTree tree = new JTree(); tree.putClientProperty("JTree.lineStyle", "Angled"); // tree.putClientProperty("JTree.lineStyle", "Horizontal"); // tree.putClientProperty("JTree.lineStyle", "None"); for (int i = 0; i < tree.getRowCount(); i++) { tree.expandRow(i);/* w ww . ja v a2 s . co m*/ } f.add(tree); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("Label Demo"); f.setLayout(new FlowLayout()); f.setSize(300, 200);/*from w w w.j a va 2 s . c o m*/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("java2s.com"); f.add(label); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame("Test"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTable table = new JTable(new String[][] { { "One" }, { "Two" }, { "Three" } }, new String[] { "Ordinal" }); table.addRowSelectionInterval(1, 1); f.add(new JScrollPane(table)); f.pack();/*from w w w . j a va 2 s.com*/ f.setLocationRelativeTo(null); f.setVisible(true); }