List of usage examples for javax.swing JFrame setSize
public void setSize(int width, int height)
The width and height values are automatically enlarged if either is less than the minimum size as specified by previous call to setMinimumSize .
From source file:TextHitInfoDemo.java
public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new TextHitInfoDemo()); f.setSize(200, 200); f.show();//from w w w. java 2s.c o m }
From source file:TitledExample.java
public static void main(String s[]) { JFrame frame = new JFrame("Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 100); frame.setContentPane(new TitledExample()); frame.setVisible(true);//from w w w. j a v a 2s. c o m }
From source file:Main.java
public static void main(String[] a) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(200, 300); PaintSurface canvas = new PaintSurface(); ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(3); executor.scheduleAtFixedRate(canvas, 0L, 100L, TimeUnit.MILLISECONDS); f.add(canvas);/*from ww w . j ava 2 s . c o m*/ f.setVisible(true); }
From source file:MainClass.java
public static void main(String[] args) { JFrame frame = new JFrame("MoveButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(250, 200); frame.setLocation(200, 200);/*from www. j a v a2 s . co m*/ frame.setContentPane(new MainClass()); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new Main(); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setSize(20, 200); frame.setVisible(true);// w w w. j a v a 2 s .co m }
From source file:ParagraphLayout.java
public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new ParagraphLayout()); f.setSize(350, 250); f.show();/*from www . java 2s.c o m*/ }
From source file:Main.java
public static void main(String[] args) { JFrame f = new JFrame(); f.setSize(300, 500); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel pan = new JPanel(new GridLayout(1, 1)); XmlJTree myTree = new XmlJTree(null); f.add(new JScrollPane(myTree)); JButton button = new JButton("Choose file"); button.addActionListener(e -> {// w ww . ja v a2 s .c om JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("XML file", "xml"); chooser.setFileFilter(filter); int returnVal = chooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { myTree.setPath(chooser.getSelectedFile().getAbsolutePath()); } }); pan.add(button); f.add(pan, BorderLayout.SOUTH); f.setVisible(true); }
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); f.setVisible(true);/*from w w w . jav a 2 s.co m*/ FontMetrics metrics = f.getFontMetrics(f.getFont()); int widthX = metrics.charsWidth(new char[] { 'a', 'b' }, 1, 2); 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); f.setVisible(true);/*from ww w.j a v a2 s . co m*/ 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); f.setVisible(true);/*from ww w. ja v a 2s . c o m*/ FontMetrics metrics = f.getFontMetrics(f.getFont()); int widthX = metrics.charWidth('X'); System.out.println(widthX); }