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: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 .j ava 2 s .c om*/ 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:BallRoom.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.getContentPane().add(canvas);/*w ww. j a v a 2s. c o m*/ f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { String[] columnNames = { "Date", "Field", "Home Team", "Visitor Team", "Score" }; JFrame guiFrame = new JFrame(); guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); guiFrame.setSize(500, 500); JPanel panel = new JPanel(); panel.setSize(450, 450);//from ww w . j a v a 2 s . c om JLabel titleLabel = new JLabel("OK"); String[][] data = new String[0][0]; JTable scheduleTable = new JTable(data, columnNames); JScrollPane scrollPane = new JScrollPane(scheduleTable); panel.add(scrollPane); panel.add(titleLabel); guiFrame.add(panel); guiFrame.setVisible(true); }
From source file:MouseTest.java
public static void main(String args[]) { JFrame frame = new MouseTest(); frame.setSize(300, 300); frame.show();/* w w w. ja v a2 s. c o m*/ }
From source file:TexturedText.java
public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new TexturedText()); f.setSize(800, 250); f.show();/*from w ww . j a v a 2s . c om*/ }
From source file:MyCheckBoxUI.java
public static void main(String[] argv) { JFrame f = new JFrame(); f.setSize(400, 300); f.getContentPane().setLayout(new FlowLayout()); JPanel p = new JPanel(); JCheckBox bt1 = new JCheckBox("Click Me"); bt1.setUI(new MyCheckBoxUI()); p.add(bt1);// www . jav a2 s . co m f.getContentPane().add(p); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; f.addWindowListener(wndCloser); f.setVisible(true); }
From source file:Main.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 w w w. j a v a 2 s. c om frame.setContentPane(new Main()); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("Sketch"); frame.setSize(300, 200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); contentPane.add(new Main()); frame.setVisible(true);/*from w ww . j a v a2 s . c o m*/ }
From source file:Main.java
public static void main(String[] argv) throws Exception { boolean resizable = true; boolean closeable = true; boolean maximizable = true; boolean iconifiable = true; String title = "Frame Title"; JInternalFrame iframe = new JInternalFrame(title, resizable, closeable, maximizable, iconifiable); iframe.setSize(300, 300);//from w ww . j a va 2s . c om iframe.setVisible(true); iframe.getContentPane().add(new JTextArea()); JDesktopPane desktop = new JDesktopPane(); desktop.add(iframe); JFrame frame = new JFrame(); frame.getContentPane().add(desktop, BorderLayout.CENTER); frame.setSize(300, 300); frame.setVisible(true); }
From source file:ColorPan.java
public static void main(String[] args) { JFrame f = new JFrame("ColorPan"); f.getContentPane().add(new ColorPan()); f.setSize(300, 300); f.setLocation(100, 100);/*from w w w. ja va 2 s .c om*/ f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); f.setVisible(true); }