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:TextAttributesUnderline.java
public static void main(String[] args) { JFrame frame = new JFrame("Text attributes"); frame.add(new TextAttributesUnderline()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(620, 190); frame.setLocationRelativeTo(null);/*from www . jav a 2 s . c o m*/ frame.setVisible(true); }
From source file:TextAttributesBackground.java
public static void main(String[] args) { JFrame frame = new JFrame("Text attributes"); frame.add(new TextAttributesBackground()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(620, 190); frame.setLocationRelativeTo(null);/*from www . j a v a2s .c o m*/ frame.setVisible(true); }
From source file:ClippedDragImage.java
public static void main(String[] args) { String imageFile = "A.jpg"; Image image = Toolkit.getDefaultToolkit().getImage(ClippedDragImage.class.getResource(imageFile)); image = image.getScaledInstance(imageWidth, imageHeight, Image.SCALE_DEFAULT); JFrame frame = new JFrame("ClippedDragImage"); frame.getContentPane().add(new ClippedDragImage(image)); frame.setSize(300, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true);//from w ww . j av a 2s. c o m }
From source file:TextAttributesSuperscript.java
public static void main(String[] args) { JFrame frame = new JFrame("Text attributes"); frame.add(new TextAttributesSuperscript()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(620, 190); frame.setLocationRelativeTo(null);// w w w .j av a 2 s . c o m frame.setVisible(true); }
From source file:ScrollBarSample.java
public static void main(String args[]) { AdjustmentListener adjustmentListener = new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent adjustmentEvent) { System.out.println("Adjusted: " + adjustmentEvent.getValue()); }/*from w w w. j a va2s .c o m*/ }; JScrollBar oneJScrollBar = new JScrollBar(JScrollBar.HORIZONTAL); oneJScrollBar.addAdjustmentListener(adjustmentListener); JFrame frame = new JFrame("ScrollBars R Us"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(oneJScrollBar, BorderLayout.NORTH); frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String s[]) { JFrame frame = new JFrame("Scroll Bar Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setContentPane(new Main()); frame.setSize(200, 200); frame.setVisible(true);/*from ww w . j a va 2s. co m*/ }
From source file:MouseDragActionPanel.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("MouseTest"); frame.setSize(300, 200); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0);// ww w.j a v a 2s. c om } }); Container contentPane = frame.getContentPane(); contentPane.add(new MouseDragActionPanel()); frame.show(); }
From source file:TransformTransRotation.java
public static void main(String[] a) { JFrame f = new JFrame(); f.getContentPane().add(new TransformTransRotation()); f.setSize(450, 350); f.show();//from w ww. jav a 2 s.c o m }
From source file:Main.java
public static void main(String[] args) { SpringLayout layout = new SpringLayout(); JPanel p = new JPanel(layout); p.setBorder(BorderFactory.createLineBorder(Color.GREEN, 10)); JLabel l1 = new JLabel("label: width=90%", SwingConstants.CENTER); l1.setBorder(BorderFactory.createLineBorder(Color.RED, 1)); JButton l2 = new JButton("button: width=50%"); Spring panelw = layout.getConstraint(WIDTH, p); SpringLayout.Constraints c1 = layout.getConstraints(l1); c1.setX(Spring.constant(0));// ww w .j a v a 2s .co m c1.setY(Spring.constant(20)); c1.setWidth(Spring.scale(panelw, 0.9f)); p.add(l1); SpringLayout.Constraints c2 = layout.getConstraints(l2); c2.setWidth(Spring.scale(panelw, 0.5f)); layout.putConstraint(SOUTH, l2, -20, SOUTH, p); layout.putConstraint(EAST, l2, -20, EAST, p); p.add(l2); JFrame f = new JFrame(); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.getContentPane().add(p); f.setSize(320, 240); f.setVisible(true); }
From source file:JTableFilterDemo.java
public static void main(String[] args) { Object[][] data = { { "A", 5 }, { "B", 2 }, { "C", 4 }, { "D", 8 } }; String columnNames[] = { "Item", "Value" }; TableModel model = new DefaultTableModel(data, columnNames) { public Class<?> getColumnClass(int column) { return getValueAt(0, column).getClass(); }//from www . j av a2s . com }; JTable table = new JTable(model); RowFilter<Object, Object> filter = new RowFilter<Object, Object>() { public boolean include(Entry entry) { Integer population = (Integer) entry.getValue(1); return population.intValue() > 3; } }; TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model); sorter.setRowFilter(filter); table.setRowSorter(sorter); JScrollPane scrollPane = new JScrollPane(table); JFrame frame = new JFrame("Filtering Table"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(scrollPane); frame.setSize(300, 200); frame.setVisible(true); }