List of usage examples for java.awt BorderLayout SOUTH
String SOUTH
To view the source code for java.awt BorderLayout SOUTH.
Click Source Link
From source file:TRescaleOp.java
public TRescaleOp() { super();/*from w w w.j a v a 2s. c o m*/ Container container = getContentPane(); displayPanel = new DisplayPanel(); container.add(displayPanel); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(2, 2)); panel.setBorder(new TitledBorder("Click a Button to Perform the Associated Operation...")); brightenButton = new JButton("Brightness >>"); brightenButton.addActionListener(new ButtonListener()); darkenButton = new JButton("Brightness <<"); darkenButton.addActionListener(new ButtonListener()); contIncButton = new JButton("Contrast >>"); contIncButton.addActionListener(new ButtonListener()); contDecButton = new JButton("Contrast <<"); contDecButton.addActionListener(new ButtonListener()); panel.add(brightenButton); panel.add(darkenButton); panel.add(contIncButton); panel.add(contDecButton); container.add(BorderLayout.SOUTH, panel); addWindowListener(new WindowEventHandler()); setSize(displayPanel.getWidth(), displayPanel.getHeight() + 10); show(); // Display the frame }
From source file:Main.java
public Main() { super(new BorderLayout()); DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series"); createNodes(top);//from ww w .ja v a 2 s. co m model = new DefaultTreeModel(top); tree = new JTree(model); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); JScrollPane treeView = new JScrollPane(tree); add(treeView); btnAdd.addActionListener(e -> { TreePath treePath = tree.getSelectionPath(); if (treePath != null) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) treePath.getLastPathComponent(); DefaultMutableTreeNode child = new DefaultMutableTreeNode("Child " + (++childCount)); model.insertNodeInto(child, node, node.getChildCount()); } }); add(btnAdd, BorderLayout.SOUTH); }
From source file:MainClass.java
public MainClass() { final JTree tree; final JTextField jtf; DefaultMutableTreeNode top = new DefaultMutableTreeNode("Options"); DefaultMutableTreeNode a = new DefaultMutableTreeNode("A"); top.add(a);// ww w .j av a 2 s . c o m DefaultMutableTreeNode a1 = new DefaultMutableTreeNode("A1"); a.add(a1); DefaultMutableTreeNode a2 = new DefaultMutableTreeNode("A2"); a.add(a2); DefaultMutableTreeNode b = new DefaultMutableTreeNode("B"); top.add(b); DefaultMutableTreeNode b1 = new DefaultMutableTreeNode("B1"); b.add(b1); DefaultMutableTreeNode b2 = new DefaultMutableTreeNode("B2"); b.add(b2); DefaultMutableTreeNode b3 = new DefaultMutableTreeNode("B3"); b.add(b3); tree = new JTree(top); JScrollPane jsp = new JScrollPane(tree); add(jsp, BorderLayout.CENTER); jtf = new JTextField("", 20); add(jtf, BorderLayout.SOUTH); tree.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent me) { TreePath tp = tree.getPathForLocation(me.getX(), me.getY()); if (tp != null) jtf.setText(tp.toString()); else jtf.setText(""); } }); }
From source file:Main.java
public Main() { setSize(300, 300);/*www. ja v a 2 s . co m*/ setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel controlPane = new JPanel(new GridLayout(2, 1)); controlPane.setOpaque(false); controlPane.add(new JLabel("Please wait...")); controlPane.add(waiter); glass.setOpaque(false); glass.add(padding); glass.add(new JLabel()); glass.add(controlPane); glass.add(new JLabel()); glass.add(new JLabel()); glass.setSize(new Dimension(300, 300)); setGlassPane(glass); JButton startB = new JButton("Start!"); startB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent A) { glass.setVisible(true); padding.requestFocus(); } }); Container contentPane = getContentPane(); contentPane.add(startB, BorderLayout.SOUTH); }
From source file:AddButtonToTabBar.java
public AddButtonToTabBar() { super("Browser"); setDefaultCloseOperation(EXIT_ON_CLOSE); JMenuBar mb = new JMenuBar(); JMenu mFile = new JMenu("File"); JMenuItem mi = new JMenuItem("Add Tab"); ActionListener addTabl = new ActionListener() { public void actionPerformed(ActionEvent e) { addTab();// w ww . j av a 2s . c o m } }; mi.addActionListener(addTabl); mFile.add(mi); mb.add(mFile); setJMenuBar(mb); JPanel pnlURL = new JPanel(); tp = new JTabbedPane(); addTab(); getContentPane().add(tp, BorderLayout.CENTER); lblStatus = new JLabel(" "); getContentPane().add(lblStatus, BorderLayout.SOUTH); setSize(300, 300); setVisible(true); }
From source file:Main.java
public Main() { super(new BorderLayout()); amountDisplayFormat = NumberFormat.getCurrencyInstance(); System.out.println(amountDisplayFormat.format(1200)); amountDisplayFormat.setMinimumFractionDigits(0); amountEditFormat = NumberFormat.getNumberInstance(); amountField = new JFormattedTextField(new DefaultFormatterFactory(new NumberFormatter(amountDisplayFormat), new NumberFormatter(amountDisplayFormat), new NumberFormatter(amountEditFormat))); amountField.setValue(new Double(amount)); amountField.setColumns(10);/* ww w .ja v a 2 s. c om*/ amountField.addPropertyChangeListener("value", this); JPanel fieldPane = new JPanel(new GridLayout(0, 1)); fieldPane.add(amountField); add(fieldPane, BorderLayout.LINE_END); add(new JButton("Hello"), BorderLayout.SOUTH); }
From source file:Main.java
public static boolean showModalDialogOnEDT(JComponent contents, String title, String okButtonMessage, String cancelButtonMessage, ModalityType modalityType, final boolean systemExitOnDisposed) { class Result { boolean OK = false; }// www .ja v a 2 s .co m final Result result = new Result(); final JDialog dialog = new JDialog((Frame) null, title, true) { @Override public void dispose() { super.dispose(); if (systemExitOnDisposed) { System.exit(0); } } }; // ensure it doesn't block other dialogs if (modalityType != null) { dialog.setModalityType(modalityType); } // See http://stackoverflow.com/questions/1343542/how-do-i-close-a-jdialog-and-have-the-window-event-listeners-be-notified dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); if (okButtonMessage != null) { buttonPane.add(new JButton(new AbstractAction(okButtonMessage) { @Override public void actionPerformed(ActionEvent e) { result.OK = true; dialog.dispose(); } })); } if (cancelButtonMessage != null) { buttonPane.add(new JButton(new AbstractAction(cancelButtonMessage) { @Override public void actionPerformed(ActionEvent e) { dialog.dispose(); } })); } JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); panel.setLayout(new BorderLayout()); panel.add(contents, BorderLayout.CENTER); panel.add(buttonPane, BorderLayout.SOUTH); // startup frame dialog.getContentPane().add(panel); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.pack(); // This hopefully centres the dialog even though the parameter is null // see http://stackoverflow.com/questions/213266/how-do-i-center-a-jdialog-on-screen dialog.setLocationRelativeTo(null); dialog.setVisible(true); return result.OK; }
From source file:Main.java
public SplashScreen() { Container container = getContentPane(); JPanel panel = new JPanel(); panel.setBorder(new EtchedBorder()); container.add(panel, BorderLayout.CENTER); JLabel label = new JLabel("Hello World!"); label.setFont(new Font("Verdana", Font.BOLD, 14)); panel.add(label);//from w ww . j av a2 s . co m progressBar.setMaximum(PROGBAR_MAX); container.add(progressBar, BorderLayout.SOUTH); pack(); setVisible(true); startProgressBar(); }
From source file:AppletJDBCDrop.java
public void init() { Connection connection;/*w w w . j a v a 2 s . c om*/ try { Class.forName("com.mysql.jdbc.Driver").newInstance(); connection = DriverManager .getConnection("jdbc:mysql://192.168.1.25/accounts?user=spider&password=spider"); } catch (Exception connectException) { connectException.printStackTrace(); } Container c = getContentPane(); tableList = new JList(); loadTables(); c.add(new JScrollPane(tableList), BorderLayout.NORTH); dropButton = new JButton("Drop Table"); dropButton.addActionListener(this); c.add(dropButton, BorderLayout.SOUTH); }
From source file:Main.java
public Main() { list.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); JPanel panel = new JPanel(); panel.add(new JButton(new AbstractAction("Add") { @Override//from w w w . ja v a 2s.c o m public void actionPerformed(ActionEvent e) { append(); if (count <= N) { list.setVisibleRowCount(count); dlg.pack(); } } })); panel.add(new JButton(new AbstractAction("Remove") { @Override public void actionPerformed(ActionEvent e) { int itemNo = list.getSelectedIndex(); if (itemNo > -1) { removeActionPerformed(e, itemNo); } } })); for (int i = 0; i < N - 2; i++) { this.append(); } list.setVisibleRowCount(N - 2); dlg.add(sp, BorderLayout.CENTER); dlg.add(panel, BorderLayout.SOUTH); dlg.pack(); dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dlg.setVisible(true); }