List of usage examples for javax.swing Box add
public Component add(Component comp)
From source file:MainClass.java
public static void main(String args[]) { JFrame f = new JFrame("JFormattedTextField Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("SSN:")); try {/* w ww.j a v a2 s. com*/ MaskFormatter mf1 = new MaskFormatter("(###) ###-####"); rowOne.add(new JFormattedTextField(mf1)); } catch (ParseException e) { } f.add(rowOne, BorderLayout.NORTH); f.setSize(300, 100); f.setVisible(true); }
From source file:MainClass.java
public static void main(String args[]) { JFrame f = new JFrame("JFormattedTextField Sample"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box rowOne = Box.createHorizontalBox(); rowOne.add(new JLabel("SSN:")); try {/*from w w w .jav a 2 s. co m*/ MaskFormatter mf1 = new MaskFormatter("###-##-####"); rowOne.add(new JFormattedTextField(mf1)); } catch (ParseException e) { } f.add(rowOne, BorderLayout.NORTH); f.setSize(300, 100); 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 = new Box(BoxLayout.Y_AXIS); rowOne.add(new JLabel("Username")); rowOne.add(Box.createRigidArea(new Dimension(20, 20))); rowOne.add(new JTextField()); Component rowTwo = Box.createVerticalStrut(2); f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200);/*from w w w.ja v a 2 s . c om*/ 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); Container content = f.getContentPane(); content.setLayout(new BorderLayout()); 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()); content.add(rowOne, BorderLayout.NORTH); content.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200);/*from www. j a va 2 s .co 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(); AccessibleContext context = rowTwo.getAccessibleContext(); System.out.println(context);/*from ww w. ja v a 2s .c o m*/ rowTwo.add(new JLabel("Password")); rowTwo.add(new JPasswordField()); f.add(rowOne, BorderLayout.NORTH); f.add(rowTwo, BorderLayout.SOUTH); f.setSize(300, 200); f.setVisible(true); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JButton component1 = new JButton(); Box box = new Box(BoxLayout.X_AXIS); int width = 10; box.add(Box.createHorizontalStrut(width)); box.add(component1);// w ww .j av a2s .c o m }
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);// www . j a v a2 s. c o 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 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.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);/* w ww . ja v a 2 s . c om*/ 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:TripleListSample.java
public static void main(String args[]) { String labels[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; JFrame f = new JFrame("Selection Modes"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList list1 = new JList(labels); JList list2 = new JList(labels); JList list3 = new JList(labels); Container c = f.getContentPane(); JScrollPane sp1 = new JScrollPane(list1); sp1.setColumnHeaderView(new JLabel("Single Selection")); JScrollPane sp2 = new JScrollPane(list2); sp2.setColumnHeaderView(new JLabel("Single Interval")); JScrollPane sp3 = new JScrollPane(list3); sp3.setColumnHeaderView(new JLabel("Multi Interval")); Box box = Box.createHorizontalBox(); box.add(sp1); box.add(sp2);//from w ww. j ava2s . co m box.add(sp3); c.add(box, BorderLayout.CENTER); f.setSize(300, 200); f.setVisible(true); }