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) { final JTabbedPane jTabbedPane = new JTabbedPane(); jTabbedPane.addTab("Red", new JLabel("Roses")); jTabbedPane.addTab("Blue", new JLabel("Skies")); jTabbedPane.addTab("Green", new JLabel("Grass")); for (int i = 0; i < jTabbedPane.getTabCount(); i++) { final JLabel tabComponent = new JLabel(jTabbedPane.getTitleAt(i)); tabComponent.addMouseMotionListener(new MouseMotionAdapter() { @Override/*from ww w .ja va2s .c o m*/ public void mouseDragged(MouseEvent e) { System.out.println("tabComponent dragging"); } }); tabComponent.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { int x = tabComponent.getLocationOnScreen().x - jTabbedPane.getLocationOnScreen().x; int y = tabComponent.getLocationOnScreen().y - jTabbedPane.getLocationOnScreen().y; MouseEvent me = new MouseEvent((JLabel) e.getSource(), e.getID(), e.getWhen(), e.getModifiers(), x, y, e.getLocationOnScreen().x, e.getLocationOnScreen().y, e.getClickCount(), e.isPopupTrigger(), e.getButton()); jTabbedPane.getMouseListeners()[0].mousePressed(me); System.out.println("tabComponent mousePressed e=" + e); } }); jTabbedPane.setTabComponentAt(i, tabComponent); } JFrame jFrame = new JFrame(); jFrame.add(jTabbedPane); jFrame.setSize(400, 500); jFrame.setVisible(true); jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:Main.java
static public void main(String args[]) throws Exception { JFrame frame = new JFrame(); Panel panel = new Main(); frame.add(panel);/*from w ww . j a v a 2 s .c om*/ frame.setSize(400, 400); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] args) { JFrame frame = new JFrame("GridBag1"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(225, 150); frame.setLocation(200, 200);//from w w w.j a v a 2s .c o m frame.setContentPane(new MainClass()); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Main"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 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("Main"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(250, 250); frame.setLocation(200, 200);//from w w w . j a v a 2s . c o m frame.setContentPane(new Main()); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame jFrame = new JFrame(); jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); jFrame.setSize(400, 300); JPanel panel = new JPanel(new FlowLayout()); jFrame.setContentPane(panel);/* w w w . j a v a 2s. co m*/ JEditorPane editor = new JEditorPane(); new Main().remove_border(editor); panel.add(editor); jFrame.setVisible(true); }
From source file:GridBag2.java
public static void main(String[] args) { JFrame frame = new JFrame("GridBag2"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(225, 150); frame.setLocation(200, 200);//w w w .j a v a2s . c o m frame.setContentPane(new GridBag2()); frame.setVisible(true); }
From source file:GridBag4.java
public static void main(String[] args) { JFrame frame = new JFrame("GridBag4"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 100); frame.setLocation(200, 200);// w w w .jav a 2s.co m frame.setContentPane(new GridBag4()); frame.setVisible(true); }
From source file:Slice.java
public static void main(String[] argv) { JFrame frame = new JFrame(); frame.getContentPane().add(new MyComponent()); frame.setSize(300, 200); frame.setVisible(true);//from ww w .j a v a2 s. c o m }
From source file:Main.java
public static void main(String[] a) { final JTextField textField = new JTextField(5); textField.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) { }/* w ww.j a va 2 s . c om*/ public void focusLost(FocusEvent e) { if (!e.isTemporary()) { String content = textField.getText(); if (!content.equals("a")) { System.out.println("illegal value! " + content); SwingUtilities.invokeLater(new FocusGrabber(textField)); } } } }); JFrame frame = new JFrame(); frame.add(textField, BorderLayout.CENTER); frame.setSize(300, 300); frame.setVisible(true); }