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) throws Exception { JFileChooser chooser = new JFileChooser(); File file = new File("filename.txt"); Icon icon = chooser.getIcon(file); JLabel label = new JLabel("" + file); label.setIcon(icon);/*from w ww.j a v a 2s .c o m*/ JFrame frame = new JFrame(); frame.getContentPane().add(label, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame f = new Main("JRadioButtonDemo"); f.setSize(300, 200);/*from w w w . j a va 2s . c om*/ f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JTree tree = new JTree(); TreeSelectionListener treeSelectionListener = new TreeSelectionListener() { @Override/*w w w. ja v a 2 s .co m*/ public void valueChanged(TreeSelectionEvent treeSelectionEvent) { JTree treeSource = (JTree) treeSelectionEvent.getSource(); System.out.println("Min: " + treeSource.getMinSelectionRow()); System.out.println("Max: " + treeSource.getMaxSelectionRow()); System.out.println("Lead: " + treeSource.getLeadSelectionRow()); System.out.println("Row: " + treeSource.getSelectionRows()[0]); } }; tree.addTreeSelectionListener(treeSelectionListener); JFrame frame = new JFrame(); frame.add(new JScrollPane(tree)); frame.setSize(300, 150); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { File f = new File("your.ttf"); FileInputStream in = new FileInputStream(f); Font dynamicFont = Font.createFont(Font.TRUETYPE_FONT, in); Font dynamicFont32Pt = dynamicFont.deriveFont(32f); JLabel testLabel = new JLabel(dynamicFont.getName()); testLabel.setFont(dynamicFont32Pt);/* w w w . ja v a 2s. c om*/ JFrame frame = new JFrame("Font Loading Demo"); frame.getContentPane().add(testLabel); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new Main(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack();// ww w . j a va 2s. c o m frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { JFrame frame = new ImageProcessingFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }/*from ww w . j a v a 2s .co m*/ }); }
From source file:JTextAreaI18N.java
public static void main(String[] args) { JFrame frame = new JTextAreaI18N(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack();/*from w ww .ja v a 2 s . co m*/ frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new Main(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack();/*from w ww .j a v a2 s. co m*/ frame.setVisible(true); }
From source file:MyCanvas.java
public static void main(String[] a) { JFrame window = new JFrame(); window.setBounds(30, 30, 300, 300);/* ww w. j a v a 2s. com*/ window.getContentPane().add(new MyCanvas()); window.setVisible(true); }
From source file:Main.java
public static void main(String[] args) throws Exception { File f = new File("your.ttf"); FileInputStream in = new FileInputStream(f); Font dynamicFont = Font.createFont(Font.TRUETYPE_FONT, in); Font dynamicFont32Pt = dynamicFont.deriveFont(32f); JLabel testLabel = new JLabel("Dynamically loaded font \"" + dynamicFont.getName() + "\""); testLabel.setFont(dynamicFont32Pt);//ww w . j a v a 2s . c o m JFrame frame = new JFrame("Font Loading Demo"); frame.getContentPane().add(testLabel); frame.pack(); frame.setVisible(true); }