List of usage examples for javax.swing Box createHorizontalBox
public static Box createHorizontalBox()
Box
that displays its components from left to right. From source file:Main.java
public static void main(String[] argv) throws Exception { JButton component1 = new JButton(); JButton component2 = new JButton(); Box box = new Box(BoxLayout.X_AXIS); box = Box.createHorizontalBox(); // Add components box.add(component1);//from w ww. ja va 2 s.com box.add(component2); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("Username")); rowOne.add(new JTextField()); Component rowTwo = Box.createHorizontalGlue(); f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200);//www.jav a 2 s. c o m f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("Username")); rowOne.add(new JTextField()); Box rowTwo = Box.createHorizontalBox(); rowTwo.add(new JLabel("Password")); rowTwo.add(new JPasswordField()); f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200);/*w w w . j a va 2 s .co m*/ f.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) { JFrame frame = new JFrame("Tree Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box box = Box.createHorizontalBox(); JTree tree1 = new JTree(); JScrollPane scrollPane1 = new JScrollPane(tree1); tree1.setAutoscrolls(true);// www . jav a 2 s . c o m JTree tree2 = new JTree(); tree2.putClientProperty("JTree.lineStyle", "None"); JScrollPane scrollPane2 = new JScrollPane(tree2); box.add(scrollPane1, BorderLayout.WEST); box.add(scrollPane2, BorderLayout.EAST); frame.add(box, BorderLayout.CENTER); frame.setSize(300, 240); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) { JFrame f = new JFrame("JPasswordField Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("Username")); rowOne.add(new JTextField()); Box rowTwo = Box.createHorizontalBox(); rowTwo.add(new JLabel("Password")); rowTwo.add(new JPasswordField()); f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200);/*from ww w . j a v a2 s.co m*/ f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("JPasswordField Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("Username")); rowOne.add(new JTextField()); Box rowTwo = Box.createHorizontalBox(); rowTwo.add(new JLabel("Password")); JPasswordField jpassword = new JPasswordField(); rowTwo.add(jpassword);/*from w w w .j a v a 2 s . co m*/ f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200); f.setVisible(true); System.out.println(jpassword.echoCharIsSet()); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("JPasswordField Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("Username")); rowOne.add(new JTextField()); Box rowTwo = Box.createHorizontalBox(); rowTwo.add(new JLabel("Password")); JPasswordField jpassword = new JPasswordField(); rowTwo.add(jpassword);/*from w w w . j ava 2 s. c om*/ f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200); f.setVisible(true); System.out.println(jpassword.getText()); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("JPasswordField Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("Username")); rowOne.add(new JTextField()); Box rowTwo = Box.createHorizontalBox(); rowTwo.add(new JLabel("Password")); JPasswordField jpassword = new JPasswordField(); rowTwo.add(jpassword);/*from ww w .java 2 s.co m*/ f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200); f.setVisible(true); jpassword.setEchoChar('#'); System.out.println(jpassword.getEchoChar()); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("Username")); rowOne.add(new JTextField()); Component rowTwo = Box.createHorizontalStrut(2); f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200);/*from ww w. java2 s . c om*/ f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("Username")); rowOne.add(new JTextField()); Component rowTwo = Box.createVerticalStrut(2); f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200);/* w ww .j a v a 2 s. c om*/ f.setVisible(true); }