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:PrintLineByLine.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new PrintLineByLine()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(420, 250); frame.setVisible(true);/*from www. java2 s.c o m*/ }
From source file:Main.java
public static void main(String[] args) { JTextPane pane = new JTextPane(); TabStop[] tabs = new TabStop[2]; tabs[0] = new TabStop(60, TabStop.ALIGN_RIGHT, TabStop.LEAD_NONE); tabs[1] = new TabStop(100, TabStop.ALIGN_LEFT, TabStop.LEAD_NONE); TabSet tabset = new TabSet(tabs); StyleContext sc = StyleContext.getDefaultStyleContext(); AttributeSet aset = sc.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.TabSet, tabset); pane.setParagraphAttributes(aset, false); pane.setText("\tright\tleft\tcenter\tValue\n" + "\t200.002\t200.002\t200.002\t200.002\n"); JFrame d = new JFrame(); d.setContentPane(new JScrollPane(pane)); d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); d.setSize(360, 120); d.setVisible(true);// w w w .j a v a 2s. co m }
From source file:Main.java
public static void main(String[] args) { JEditorPane jep = new JEditorPane(); jep.setEditable(false);//w ww .ja v a 2 s. c o m try { jep.setPage("http://www.google.com"); } catch (IOException e) { jep.setContentType("text/html"); jep.setText("<html>Could not load http://www.google.com </html>"); } JScrollPane scrollPane = new JScrollPane(jep); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(scrollPane); f.setSize(512, 342); f.show(); }
From source file:MainClass.java
public static void main(String[] args) throws Exception { JFrame jf = new JFrame("Demo"); Container cp = jf.getContentPane(); MyCanvas tl = new MyCanvas(); cp.add(tl);/*ww w . j a v a2s.co m*/ jf.setSize(300, 200); jf.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("GradientsRedYellow"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Main()); frame.setSize(350, 350); frame.setLocationRelativeTo(null);//ww w. j a v a 2 s . co m frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.getContentPane().add(new MainClass()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200); frame.setVisible(true);/* w w w .j a v a 2 s. co m*/ }
From source file:Textures.java
public static void main(String[] args) { JFrame frame = new JFrame("Textures"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Textures()); frame.setSize(360, 120); frame.setVisible(true);/*from w w w. jav a2s .com*/ }
From source file:Main.java
public static void main(String[] a) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new JScrollPaneDemo()); f.setSize(500, 500); f.setVisible(true);/*from ww w .ja v a 2 s .co m*/ }
From source file:Scale.java
public static void main(String[] args) { JFrame frame = new JFrame("Scaling"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Scale()); frame.setSize(330, 160); frame.setLocationRelativeTo(null);//from w ww . j a v a 2 s . c o m frame.setVisible(true); }
From source file:Shear.java
public static void main(String[] args) { JFrame frame = new JFrame("Shearing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Shear()); frame.setSize(330, 270); frame.setLocationRelativeTo(null);/*from w w w . j a v a2 s .com*/ frame.setVisible(true); }