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 args[]) { JFrame frame = new JFrame("DefaultButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Icon warnIcon = new ImageIcon("yourFile.gif"); JButton button2 = new JButton(warnIcon); frame.add(button2);//w ww . j a v a 2 s .co m frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame frame = new JFrame("DefaultButton"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Icon warnIcon = new ImageIcon("Warn.gif"); JButton button3 = new JButton("Warning", warnIcon); frame.add(button3);/* w w w . j av a 2 s.com*/ frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) throws Exception { JFrame frame = new JFrame("Indeterminate"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JProgressBar aJProgressBar = new JProgressBar(); aJProgressBar.setIndeterminate(true); frame.add(aJProgressBar, BorderLayout.NORTH); frame.setSize(300, 100);// ww w . java 2 s .com frame.setVisible(true); }
From source file:SplitPaneSample.java
public static void main(String args[]) { JFrame vFrame = new JFrame("JSplitPane Sample"); vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSplitPane vSplitPane = new JSplitPane(); vSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); vFrame.getContentPane().add(vSplitPane, BorderLayout.CENTER); vFrame.setSize(300, 150);/*from www . java 2 s . c o m*/ vFrame.setVisible(true); JFrame hFrame = new JFrame("JSplitPane Sample"); JSplitPane hSplitPane = new JSplitPane(); hFrame.getContentPane().add(hSplitPane, BorderLayout.CENTER); hFrame.setSize(300, 150); hFrame.setVisible(true); }
From source file:Main.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"); Color myBlack = new Color(0, 0, 0); // Color black // Color myWhite = new Color(255,255,255); // Color white // Color myGreen = new Color(0,200,0); // A shade of green button.setBackground(myBlack);//from w w w. j a va2 s . c om f.add(button, BorderLayout.CENTER); f.setSize(300, 200); f.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { JFrame frame = new JFrame("Filled Slider"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSlider js1 = new JSlider(); js1.putClientProperty("JSlider.isFilled", Boolean.TRUE); JSlider js2 = new JSlider(); js2.putClientProperty("JSlider.isFilled", Boolean.FALSE); frame.getContentPane().add(js1, BorderLayout.NORTH); frame.getContentPane().add(js2, BorderLayout.SOUTH); frame.setSize(300, 200);/*from w ww . j ava 2 s . co m*/ frame.setVisible(true); }
From source file:BoundedRangeModelInJSlider.java
public static void main(String args[]) { JFrame frame = new JFrame("Tick Slider"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSlider oneJSlider = new JSlider(); System.out.println(oneJSlider.getModel().getMaximum()); frame.add(oneJSlider, BorderLayout.NORTH); frame.setSize(300, 200);//from w w w. j av a2 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("."); fileChooser.ensureFileIsVisible(new File(".")); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();/*from w w w.j a va 2s .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("."); String f = fileChooser.getDescription(new File(".")); frame.add(fileChooser, BorderLayout.CENTER); frame.pack();// ww w. j ava2s . co m frame.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) { JFrame f = new JFrame("JTree Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JTree tree = new JTree(); JScrollPane scrollPane = new JScrollPane(tree); f.add(scrollPane, BorderLayout.CENTER); f.setSize(300, 200);//from w w w . ja va 2 s.co m f.setVisible(true); }