List of usage examples for java.awt FlowLayout FlowLayout
public FlowLayout()
From source file:ApplicationModalDialogWithExcludeDemo.java
public static void main(String[] args) { final JFrame parent1 = new JFrame("Parent Frame 1"); parent1.setLayout(new FlowLayout()); parent1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); parent1.setBounds(100, 100, 200, 150); parent1.setVisible(true);/*ww w.j a v a 2 s . co m*/ JFrame parent2 = new JFrame("Parent Frame 2"); parent2.setBounds(500, 100, 300, 150); parent2.setVisible(true); JFrame parent3 = new JFrame("Parent Frame 3 - Excluded"); parent3.setBounds(300, 400, 300, 150); parent3.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE); parent3.setVisible(true); JDialog dialog = new JDialog(parent1, "Application-Modal Dialog", Dialog.ModalityType.APPLICATION_MODAL); dialog.setBounds(300, 200, 300, 150); dialog.setVisible(true); }
From source file:JListTest.java
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("JList Test"); frame.setLayout(new FlowLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); String[] selections = { "green", "red", "orange", "dark blue" }; JList list = new JList(selections); list.setSelectedIndex(1);/*from w ww .j a v a 2s . c o m*/ System.out.println(list.getSelectedValue()); frame.add(new JScrollPane(list)); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel buttonPanel = new JPanel(new FlowLayout()); buttonPanel.add(new JButton("A")); frame.add(buttonPanel);// w w w . java2s. co m frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel buttonPanel = new JPanel(new FlowLayout(), true); buttonPanel.add(new JButton("A")); frame.add(buttonPanel);/*from www .ja va 2 s.c om*/ frame.setSize(300, 200); frame.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { JTextField smallField = new JTextField(5); JTextField largeField = new JTextField(20); JPanel gui = new JPanel(new FlowLayout()); gui.add(smallField);/* w w w . j a v a2s .c om*/ gui.add(largeField); JFrame f = new JFrame("Text Field Size"); f.add(gui); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.pack(); f.setLocationByPlatform(true); f.setVisible(true); }
From source file:Main.java
public static void main(String[] args) { Frame f = new Frame("FlowLayout demo"); f.setLayout(new FlowLayout()); f.add(new Button("Red")); f.add(new Button("Blue")); f.add(new Button("White")); List list = new List(); for (int i = 0; i < args.length; i++) { list.add(args[i]);/*from w w w . j a va 2s. c o m*/ } f.add(list); f.add(new Checkbox("Pick me", true)); f.add(new Label("Enter name here:")); f.add(new TextField(20)); f.pack(); f.setVisible(true); }
From source file:Main.java
License:asdf
public static void main(String args[]) { JFrame f = new JFrame("Label Demo"); f.setLayout(new FlowLayout()); f.setSize(200, 360);/*w w w .jav a 2s . c om*/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("asdf"); Border border = BorderFactory.createLineBorder(Color.BLACK); label.setBorder(border); label.setPreferredSize(new Dimension(150, 100)); f.add(label); f.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("Label Demo"); f.setLayout(new FlowLayout()); f.setSize(200, 360);/* w w w.j av a 2 s . c o m*/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel( "<html>Use HTML to create<br>" + "a multiline message." + "<br>One<br>Two<br>Three"); Border border = BorderFactory.createLineBorder(Color.BLACK); label.setBorder(border); f.add(label); f.setVisible(true); }
From source file:JCheckBoxTest.java
public static void main(String[] args) { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("JCheckBox Test"); frame.setLayout(new FlowLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JCheckBox ac = new JCheckBox("A/C"); ac.setSelected(true);//www . ja v a 2 s . co m JCheckBox cdPlayer = new JCheckBox("A"); JCheckBox cruiseControl = new JCheckBox("B"); JCheckBox keylessEntry = new JCheckBox("C"); JCheckBox antiTheft = new JCheckBox("D"); JCheckBox centralLock = new JCheckBox("E"); frame.add(new JLabel("Car Features")); frame.add(ac); frame.add(cdPlayer); frame.add(cruiseControl); frame.add(keylessEntry); frame.add(antiTheft); frame.add(centralLock); frame.pack(); frame.setVisible(true); }
From source file:Main.java
public static void main(String args[]) { JFrame f = new JFrame("Label Demo"); f.setLayout(new FlowLayout()); f.setSize(300, 200);/*w ww .jav a2 s . c om*/ f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("java2s.com"); Border border = BorderFactory.createLineBorder(Color.BLACK); label.setBorder(border); label.setPreferredSize(new Dimension(150, 100)); label.setText("Centered"); label.setHorizontalAlignment(JLabel.CENTER); label.setVerticalAlignment(JLabel.CENTER); f.add(label); f.setVisible(true); }