List of usage examples for javax.swing JFrame JFrame
public JFrame(String title) throws HeadlessException
Frame
with the specified title. From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame("JFileChooser Popup"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFileChooser fileChooser = new JFileChooser("."); String f = fileChooser.getDialogTitle(); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();//from w w w . jav a 2 s . c o m frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame("JFileChooser Popup"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFileChooser fileChooser = new JFileChooser("."); int type = fileChooser.getDialogType(); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();/* www. ja va2 s . c om*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame("JFileChooser Popup"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFileChooser fileChooser = new JFileChooser("."); boolean f = fileChooser.getDragEnabled(); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();//from ww w .j av a2 s . c om frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("JSeparator Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new GridLayout(0, 1)); JLabel above = new JLabel("Above Separator"); f.add(above);/*from w w w.j av a2 s. c om*/ JSeparator separator = new JSeparator(); f.add(separator); JLabel below = new JLabel("Below Separator"); f.add(below); f.setSize(300, 100); f.setVisible(true); }
From source file:MainClass.java
public static void main(final String args[]) { JFrame frame = new JFrame("Double Color Choosers"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JColorChooser left = new JColorChooser(); left.setDragEnabled(true);// w w w . j a v a 2s . c o m frame.add(left, BorderLayout.WEST); JColorChooser right = new JColorChooser(); right.setDragEnabled(true); frame.add(right, BorderLayout.EAST); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) throws Exception { JFrame frame = new JFrame("ProgressBars"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JProgressBar dJProgressBar = new JProgressBar(); dJProgressBar.setValue(100);//from ww w. j av a 2s . c o m dJProgressBar.setBorderPainted(false); dJProgressBar.setString("Ack"); dJProgressBar.setStringPainted(true); frame.add(dJProgressBar, BorderLayout.WEST); frame.setSize(300, 200); frame.setVisible(true); }
From source file:DrivedFont.java
public static void main(String args[]) { JFrame f = new JFrame("JColorChooser Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final JButton button = new JButton("Pick to Change Background"); Font myFont = new Font("Serif", Font.ITALIC | Font.BOLD, 12); Font newFont = myFont.deriveFont(50F); button.setFont(newFont);// w w w .j av a 2 s . c o m f.add(button, BorderLayout.CENTER); f.setSize(300, 200); f.setVisible(true); }
From source file:CreatingCursors.java
public static void main(String[] args) { JFrame aWindow = new JFrame("This is the Window Title"); Toolkit theKit = aWindow.getToolkit(); // Get the window toolkit Dimension wndSize = theKit.getScreenSize(); // Get screen size // Set the position to screen center & size to half screen size aWindow.setBounds(wndSize.width / 4, wndSize.height / 4, // Position wndSize.width / 2, wndSize.height / 2); // Size aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); aWindow.setVisible(true); // Display the window }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame("Layout"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container contentPane = frame.getContentPane(); contentPane.setLayout(new FlowLayout()); for (int i = 1; i <= 5; i++) { contentPane.add(new JButton("Button " + i)); }//from w w w . j a va2s . c o m frame.pack(); frame.setVisible(true); }
From source file:ButtonTipTest.java
public static void main(String args[]) { JFrame frame = new JFrame("Tool Tips"); Container contentPane = frame.getContentPane(); JButton b = new JButton("Button"); b.setToolTipText("Go Away"); contentPane.add(b, BorderLayout.NORTH); frame.setSize(300, 200);//w ww . j a va 2 s .co m frame.show(); }