List of usage examples for javax.swing JFrame setVisible
public void setVisible(boolean b)
From source file:Main.java
public static void main(String[] args) { Color myBlack = new Color(0, 0, 0, 120); // Color black JLabel label = new JLabel("First Name"); label.setForeground(myBlack);/*ww w.j a va2 s. com*/ JFrame frame = new JFrame(); frame.add(label); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Box box = Box.createVerticalBox(); for (int i = 1; i < 4; i++) { JPanel panel = new JPanel() { @Override/*from ww w . j ava2 s . c o m*/ public Dimension getMaximumSize() { return getPreferredSize(); } }; JLabel label1 = new JLabel("Label"); JLabel label2 = new JLabel(String.valueOf(i)); panel.add(label1); panel.add(label2); box.add(panel); } JFrame frame = new JFrame(); frame.add(box); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
From source file:PanelWithComponents.java
public static void main(String[] a) { JPanel panel = new JPanel(); JButton okButton = new JButton("OK"); panel.add(okButton);//from ww w. j a va2s. c o m JButton cancelButton = new JButton("Cancel"); panel.add(cancelButton); JFrame frame = new JFrame("Oval Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel); frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Color myColor = Color.RED; JLabel label = new JLabel("First Name"); label.setForeground(myColor.brighter()); JFrame frame = new JFrame(); frame.add(label);//from www .j a v a2s . c o m frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JPanel panel = new JPanel(); panel.add(new JTextField(10)); panel.add(new JButton("button")); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(panel);// www .j a v a 2 s . co m frame.pack(); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { @Override public void windowIconified(WindowEvent wEvt) { ((JFrame) wEvt.getSource()).dispose(); } @Override public void windowDeactivated(WindowEvent wEvt) { ((JFrame) wEvt.getSource()).dispose(); } }); }
From source file:Main.java
public static void main(String[] args) { Color myColor = Color.decode("0XFFFFFF"); JLabel label = new JLabel("First Name"); label.setForeground(myColor);//from www .j a v a 2 s .co m JFrame frame = new JFrame(); frame.add(label); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Color myColor = new Color(0.1F, 0.2F, 0.3F); JLabel label = new JLabel("First Name"); label.setForeground(myColor);//from w w w. j av a 2s . c o m JFrame frame = new JFrame(); frame.add(label); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { try {// ww w . jav a2 s . c o m UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception e) { System.err.println("Look and feel not set."); } JFrame aWindow = new JFrame("This is the Window Title"); aWindow.setBounds(50, 100, 300, 300); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setVisible(true); }
From source file:ChangeLookFeelToMotifLookAndFeel.java
public static void main(String[] args) { try {//from w ww . j a va 2s . c o m UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); } catch (Exception e) { System.err.println("Look and feel not set."); } JFrame aWindow = new JFrame("This is the Window Title"); aWindow.setBounds(50, 100, 300, 300); aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); aWindow.setVisible(true); }
From source file:ricecompression.RiceCompression.java
/** * @param args the command line arguments *///from w ww .j a va 2 s.c o m public static void main(String[] args) { RiceCompression rice = new RiceCompression(); XYSeries data = new XYSeries("RICE"); for (int i = -1023; i < 1024; i++) { String riceCode = rice.compress(32, i); data.add(i, riceCode.length()); } XYSeriesCollection collection = new XYSeriesCollection(data); JFreeChart grafica = ChartFactory.createXYLineChart("RICE", "Nmero a codificar", "Longitud del codi Rice", collection, PlotOrientation.VERTICAL, true, true, false); ChartPanel Panel = new ChartPanel(grafica); JFrame Ventana = new JFrame("JFreeChart"); Ventana.getContentPane().add(Panel); Ventana.pack(); Ventana.setVisible(true); Ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }