List of usage examples for javax.swing JFrame add
public Component add(Component comp)
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextField component = new JTextField(); component.addFocusListener(new MyFocusListener()); JFrame f = new JFrame(); f.add(component); f.setSize(300, 300);//from w ww . ja v a 2 s .c o m f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JTable table = new JTable(22, 5); table.setPreferredScrollableViewportSize(new Dimension(400, 300)); final JScrollPane scrollPane = new JScrollPane(table); JButton cornerButton = new JButton("#"); scrollPane.setCorner(JScrollPane.UPPER_TRAILING_CORNER, cornerButton); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); JFrame frame = new JFrame(); frame.add(scrollPane); frame.pack();/*www .j av a 2s .c o m*/ frame.setVisible(true); }
From source file:MyButton.java
public static void main(String[] args) { MyButton close = new MyButton("Close"); JFrame f = new JFrame(); f.add(close); f.setSize(300, 200);/*from w w w .j a v a2 s.co m*/ f.setLocationRelativeTo(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new JScrollPane(new Main())); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setVisible(true);//from ww w.j a v a2s. c o m }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextField component = new JTextField(); component.addMouseMotionListener(new MyMouseMotionListener()); JFrame f = new JFrame(); f.add(component); f.setSize(300, 300);//from ww w. j a v a2 s . c om f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Color myBlack = new Color(0, 0, 0, 0.5F); // Color black // Color myWhite = new Color(255,255,255); // Color white // Color myGreen = new Color(0,200,0); // A shade of green JLabel label = new JLabel("First Name"); label.setForeground(myBlack);//from ww w .j av a2 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:BasicDraw.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new MyComponent()); frame.setSize(300, 300);//from w w w .j a va2 s . com frame.setVisible(true); }
From source file:RotateTransformed.java
public static void main(String[] args) { JFrame frame = new JFrame(); frame.add(new RotateTransformed()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 400);// ww w . j a va 2 s . co m frame.setVisible(true); }
From source file:RussiaUnicode.java
public static void main(String[] args) { JFrame frame = new JFrame("Unicode"); frame.add(new RussiaUnicode()); frame.setSize(520, 220);// w w w . ja v a 2s . c o m frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { 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 JLabel label = new JLabel("First Name"); label.setForeground(myBlack);//from w w w .j a v a2 s .c om JFrame frame = new JFrame(); frame.add(label); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(20, 20, 500, 500); frame.setVisible(true); }