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:UndoExample4.java
public UndoExample4() { super("Undo/Redo Example 4"); DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("root"); DefaultMutableTreeNode node = new DefaultMutableTreeNode("Apollo 8"); rootNode.add(node);//from www . j av a 2s .c o m node.add(new DefaultMutableTreeNode("Borman")); node.add(new DefaultMutableTreeNode("Lovell")); node.add(new DefaultMutableTreeNode("Anders")); node = new DefaultMutableTreeNode("Apollo 11"); rootNode.add(node); node.add(new DefaultMutableTreeNode("Armstrong")); node.add(new DefaultMutableTreeNode("Aldrin")); node.add(new DefaultMutableTreeNode("Collins")); node = new DefaultMutableTreeNode("Apollo 12"); rootNode.add(node); node.add(new DefaultMutableTreeNode("Conrad")); node.add(new DefaultMutableTreeNode("Gordon")); node.add(new DefaultMutableTreeNode("Bean")); UndoableTree2 tree = new UndoableTree2(rootNode); getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER); // Create the undo manager and actions UndoManager manager = new UndoManager(); tree.addUndoableEditListener(manager); Action undoAction = new UndoAction(manager); Action redoAction = new RedoAction(manager); // Add the actions to buttons JPanel panel = new JPanel(); JButton undoButton = new JButton("Undo"); JButton redoButton = new JButton("Redo"); undoButton.addActionListener(undoAction); redoButton.addActionListener(redoAction); panel.add(undoButton); panel.add(redoButton); getContentPane().add(panel, BorderLayout.SOUTH); // Assign the actions to keys ((JComponent) getContentPane()).registerKeyboardAction(undoAction, KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW); ((JComponent) getContentPane()).registerKeyboardAction(redoAction, KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW); }
From source file:endrov.typeTimeRemap.TimeRemapWindow.java
/** * Make a new window/*from ww w.j a v a 2 s .c o m*/ */ public TimeRemapWindow() { bAdd.addActionListener(this); bRefresh.addActionListener(this); objectCombo.addActionListener(this); XYDataset xyDataset = new XYSeriesCollection(frametimeSeries); JFreeChart chart = ChartFactory.createXYLineChart("", "New time", "Original time", xyDataset, PlotOrientation.HORIZONTAL, false/*legend*/, false/*tooltips*/, false/*urls*/); ChartPanel graphpanel = new ChartPanel(chart); //Put GUI together JPanel datapanel = new JPanel(new BorderLayout()); JPanel dataparto = new JPanel(new BorderLayout()); dataparto.add(datapart, BorderLayout.NORTH); JScrollPane datapartscroll = new JScrollPane(dataparto, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); JPanel buttonpanel = new JPanel(new GridLayout(1, 2)); buttonpanel.add(bAdd); buttonpanel.add(bRefresh); datapanel.add(buttonpanel, BorderLayout.SOUTH); datapanel.add(datapartscroll, BorderLayout.CENTER); setLayout(new BorderLayout()); add(datapanel, BorderLayout.EAST); JPanel leftPanel = new JPanel(new BorderLayout()); leftPanel.add(graphpanel, BorderLayout.CENTER); leftPanel.add(objectCombo, BorderLayout.SOUTH); add(leftPanel, BorderLayout.CENTER); loadData(); //Window overall things setTitleEvWindow("Time remapper"); packEvWindow(); setBoundsEvWindow(new Rectangle(100, 100, 1000, 600)); setVisibleEvWindow(true); }
From source file:com.stam.batchmove.BatchMoveUtils.java
public static void showFilesFrame(Object[][] data, String[] columnNames, final JFrame callerFrame) { final FilesFrame filesFrame = new FilesFrame(); DefaultTableModel model = new DefaultTableModel(data, columnNames) { private static final long serialVersionUID = 1L; @Override/*from w w w . j av a2s .c o m*/ public Class<?> getColumnClass(int column) { return getValueAt(0, column).getClass(); } @Override public boolean isCellEditable(int row, int column) { return column == 0; } }; DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setHorizontalAlignment(JLabel.CENTER); final JTable table = new JTable(model); for (int i = 1; i < table.getColumnCount(); i++) { table.setDefaultRenderer(table.getColumnClass(i), renderer); } // table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setRowHeight(30); table.getTableHeader().setFont(new Font("Serif", Font.BOLD, 14)); table.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 14)); table.setRowSelectionAllowed(false); table.getColumnModel().getColumn(0).setMaxWidth(35); table.getColumnModel().getColumn(1).setPreferredWidth(350); table.getColumnModel().getColumn(2).setPreferredWidth(90); table.getColumnModel().getColumn(2).setMaxWidth(140); table.getColumnModel().getColumn(3).setMaxWidth(90); JPanel tblPanel = new JPanel(); JPanel btnPanel = new JPanel(); tblPanel.setLayout(new BorderLayout()); if (table.getRowCount() > 15) { JScrollPane scrollPane = new JScrollPane(table); tblPanel.add(scrollPane, BorderLayout.CENTER); } else { tblPanel.add(table.getTableHeader(), BorderLayout.NORTH); tblPanel.add(table, BorderLayout.CENTER); } btnPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); filesFrame.setMinimumSize(new Dimension(800, 600)); filesFrame.setLayout(new BorderLayout()); filesFrame.add(tblPanel, BorderLayout.NORTH); filesFrame.add(btnPanel, BorderLayout.SOUTH); final JLabel resultsLabel = new JLabel(); JButton cancelBtn = new JButton("Cancel"); cancelBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { filesFrame.setVisible(false); callerFrame.setVisible(true); } }); JButton moveBtn = new JButton("Copy"); moveBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setDialogTitle("Choose target directory"); int selVal = fileChooser.showOpenDialog(null); if (selVal == JFileChooser.APPROVE_OPTION) { File selection = fileChooser.getSelectedFile(); String targetPath = selection.getAbsolutePath(); DefaultTableModel dtm = (DefaultTableModel) table.getModel(); int nRow = dtm.getRowCount(); int copied = 0; for (int i = 0; i < nRow; i++) { Boolean selected = (Boolean) dtm.getValueAt(i, 0); String filePath = dtm.getValueAt(i, 1).toString(); if (selected) { try { FileUtils.copyFileToDirectory(new File(filePath), new File(targetPath)); dtm.setValueAt("Copied", i, 3); copied++; } catch (Exception ex) { Logger.getLogger(SelectionFrame.class.getName()).log(Level.SEVERE, null, ex); dtm.setValueAt("Failed", i, 3); } } } resultsLabel.setText(copied + " files copied. Finished!"); } } }); btnPanel.add(cancelBtn); btnPanel.add(moveBtn); btnPanel.add(resultsLabel); filesFrame.revalidate(); filesFrame.setVisible(true); callerFrame.setVisible(false); }
From source file:BooksDemo.java
public BooksDemo() { super("AmazonPick"); JButton cover1 = UIHelper.createButton("", "cover1_small_button", true); cover1.addActionListener(new CoverSwitcher("cover1")); JButton cover2 = UIHelper.createButton("", "cover2_small_button", true); cover2.addActionListener(new CoverSwitcher("cover2")); JButton cover3 = UIHelper.createButton("", "cover3_small_button", true); cover3.addActionListener(new CoverSwitcher("cover3")); JPanel buttons = new JPanel(); buttons.add(cover1);/*from ww w . j a v a2 s . c o m*/ buttons.add(cover2); buttons.add(cover3); buttons.setOpaque(false); c3d = new Canvas3D(SimpleUniverse.getPreferredConfiguration()); c3d.setSize(CANVAS3D_WIDTH, CANVAS3D_HEIGHT); xpanel.add(c3d); xpanel.setOpaque(false); this.setContentPane(new GradientPanel()); this.getContentPane().setLayout(new BorderLayout()); this.getContentPane().add(xpanel, BorderLayout.CENTER); this.getContentPane().add(buttons, BorderLayout.SOUTH); this.pack(); this.setResizable(false); this.setDefaultCloseOperation(EXIT_ON_CLOSE); UIHelper.centerOnScreen(this); }
From source file:net.sf.profiler4j.console.ClassListPanel.java
/** * This method initializes this// www. j av a2s. c o m */ private void initialize() { this.setLayout(new BorderLayout()); this.setSize(582, 200); this.add(getClassesScrollPane(), java.awt.BorderLayout.CENTER); this.add(getBottomPanel(), java.awt.BorderLayout.SOUTH); this.add(getTopPanel(), java.awt.BorderLayout.NORTH); }
From source file:ViewDB.java
public ViewDBFrame() { setTitle("ViewDB"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); tableNames = new JComboBox(); tableNames.addActionListener(new ActionListener() {/*from w w w . j a v a 2s . c o m*/ public void actionPerformed(ActionEvent event) { showTable((String) tableNames.getSelectedItem()); } }); add(tableNames, BorderLayout.NORTH); try { readDatabaseProperties(); Connection conn = getConnection(); try { DatabaseMetaData meta = conn.getMetaData(); ResultSet mrs = meta.getTables(null, null, null, new String[] { "TABLE" }); while (mrs.next()) tableNames.addItem(mrs.getString(3)); } finally { conn.close(); } } catch (SQLException e) { JOptionPane.showMessageDialog(this, e); } catch (IOException e) { JOptionPane.showMessageDialog(this, e); } JPanel buttonPanel = new JPanel(); add(buttonPanel, BorderLayout.SOUTH); previousButton = new JButton("Previous"); previousButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { showPreviousRow(); } }); buttonPanel.add(previousButton); nextButton = new JButton("Next"); nextButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { showNextRow(); } }); buttonPanel.add(nextButton); deleteButton = new JButton("Delete"); deleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { deleteRow(); } }); buttonPanel.add(deleteButton); saveButton = new JButton("Save"); saveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { saveChanges(); } }); buttonPanel.add(saveButton); }
From source file:com.intuit.tank.tools.debugger.VariableDialog.java
public VariableDialog(AgentDebuggerFrame f, Map<String, String> variables) { super(f, true); this.f = f;/*from www . j a v a 2s .co m*/ setLayout(new BorderLayout()); setTitle("View Edit Project Variables"); DefaultTableModel model = new DefaultTableModel(); model.addColumn("Variable Name"); model.addColumn("Variable Value"); List<String> keys = new ArrayList<String>(variables.keySet()); Collections.sort(keys); for (String key : keys) { Object[] data = new Object[2]; data[0] = key; data[1] = variables.get(key); model.addRow(data); } table = new JTable(model); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getSelectionModel().addListSelectionListener(this); table.setGridColor(Color.GRAY); table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); table.setBorder(BorderFactory.createLineBorder(Color.GRAY)); table.setShowGrid(true); table.getTableHeader().setReorderingAllowed(false); JScrollPane sp = new JScrollPane(table); JPanel panel = new JPanel(new BorderLayout()); panel.add(table.getTableHeader(), BorderLayout.NORTH); panel.add(sp, BorderLayout.CENTER); add(panel, BorderLayout.CENTER); add(createButtonPanel(), BorderLayout.SOUTH); setSize(new Dimension(800, 600)); setBounds(new Rectangle(getSize())); setPreferredSize(getSize()); WindowUtil.centerOnParent(this); }
From source file:gui.TraitViewerDialog.java
TraitViewerDialog(AppFrame appFrame, TraitFile tFile) { super(appFrame, "Trait Selection", true); this.tFile = tFile; addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { setVisible(false);/*from www.java 2 s.c om*/ } }); add(createControls()); add(createButtons(), BorderLayout.SOUTH); // setSize(300, 250); setSize(500, 450); // pack(); setLocationRelativeTo(appFrame); setResizable(false); setVisible(true); }
From source file:org.encog.workbench.tabs.visualize.scatter.ScatterPlotTab.java
public ScatterPlotTab(EncogAnalyst analyst, String className, List<String> axisList) { super(null);/*from w ww . j a v a2s . c o m*/ this.analyst = analyst; this.file = new ScatterFile(this.analyst, className, axisList); if (axisList.size() <= 2) { this.add(createPanel(0, 1, true)); return; } else { JPanel panel = new JPanel(); int count = axisList.size(); panel.setLayout(new GridLayout(count, count)); for (int col = 0; col < count; col++) { for (int row = 0; row < count; row++) { if (col == row) { panel.add(new ScatterLabelPane(axisList.get(row))); } else { panel.add(createPanel(row, col, false)); } } } this.setLayout(new BorderLayout()); this.add(panel, BorderLayout.CENTER); LegendPanel legend = new LegendPanel(this.samplePlot); this.add(legend, BorderLayout.SOUTH); } }
From source file:org.jdal.swing.ViewDialog.java
public void init() { if (view == null) return;/*from ww w . jav a 2 s .c om*/ acceptAction.setView(view); cancelAction.setView(view); add(view.getPanel(), BorderLayout.CENTER); if (view.getModel() != null && StringUtils.isEmpty(getTitle())) setTitle(view.getModel().toString()); add(createButtonBox(), BorderLayout.SOUTH); setSize(windowWidth, windowHeight); setLocationRelativeTo(null); }