List of usage examples for javax.swing JFrame setVisible
public void setVisible(boolean b)
From source file:Main.java
public static void main(String[] argv) { DefaultTableModel model = new DefaultTableModel() { public Class getColumnClass(int mColIndex) { int rowIndex = 0; Object o = getValueAt(rowIndex, mColIndex); if (o == null) { return Object.class; } else { return o.getClass(); }/* www .j a v a2 s . c om*/ } }; JTable table = new JTable(model); model.addColumn("Col1", new Object[] { Color.red }); model.addRow(new Object[] { Color.green }); model.addRow(new Object[] { Color.blue }); table.setDefaultRenderer(Color.class, new ColorTableCellRenderer()); JFrame f = new JFrame(); f.setSize(300, 300); f.add(new JScrollPane(table)); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new Main().getFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack();//from ww w. j a v a 2s .c o m frame.setVisible(true); }
From source file:ImageTest.java
public static void main(String[] args) { JPanel panel = new JPanel(); final ImageButton button = new ImageButton("button.png"); button.setPressedIcon(new ImageIcon("down.png")); button.setRolloverIcon(new ImageIcon("over.png")); button.setSelectedIcon(new ImageIcon("sel.png")); button.setRolloverSelectedIcon(new ImageIcon("sel-over.png")); button.setDisabledIcon(new ImageIcon("disabled.png")); button.setDisabledSelectedIcon(new ImageIcon("disabled-selected.png")); button.setLocation(60, 74);//from ww w . jav a2s.co m button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { button.setSelected(!button.isSelected()); System.out.println("selecting"); } }); // button.setSelected(true); // button.setDisabled(false); panel.add(button); JFrame frame = new JFrame(); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); MyTextPane textPane = new MyTextPane(); frame.add(textPane);//from ww w.ja v a2 s .co m frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JButton("Press Me"); jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.out.println(((JComponent) arg0.getSource()).getFont()); }//from w w w. jav a 2 s . c om }); jb.doClick(1000); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack(); f.setVisible(true); }
From source file:JComboBoxDemo.java
public static void main(String[] args) { JFrame frame = new JComboBoxDemo(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack();/*from w ww. j a va 2s . c o m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JButton("Press Me"); jb.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent ev) { System.out.println("ChangeEvent!"); }//from ww w .j a v a2 s . co m }); ChangeListener[] lis = jb.getChangeListeners(); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JButton("Press Me"); jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.out.println(((JComponent) arg0.getSource()).getFont()); }/*from ww w. j ava 2s .c o m*/ }); jb.doClick(); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack(); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JButton("Press Me"); jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.out.println(((JComponent) arg0.getSource()).getFont()); }//from w ww . j a v a 2 s . c om }); System.out.println(jb.getActionCommand()); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb); f.pack(); f.setVisible(true); }
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);// ww w.j av a 2 s . co m 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); }