List of usage examples for java.awt BorderLayout PAGE_START
String PAGE_START
To view the source code for java.awt BorderLayout PAGE_START.
Click Source Link
From source file:ToolBarDemo2.java
public ToolBarDemo2() { super(new BorderLayout()); //Create the toolbar. JToolBar toolBar = new JToolBar("Still draggable"); addButtons(toolBar);/*from ww w . ja v a 2 s . c o m*/ toolBar.setFloatable(false); toolBar.setRollover(true); //Create the text area used for output. Request //enough space for 5 rows and 30 columns. textArea = new JTextArea(5, 30); textArea.setEditable(false); JScrollPane scrollPane = new JScrollPane(textArea); //Lay out the main panel. setPreferredSize(new Dimension(450, 130)); add(toolBar, BorderLayout.PAGE_START); add(scrollPane, BorderLayout.CENTER); }
From source file:ProgressBarDemo.java
public ProgressBarDemo() { super(new BorderLayout()); // Create the demo's UI. startButton = new JButton("Start"); startButton.setActionCommand("start"); startButton.addActionListener(this); progressBar = new JProgressBar(0, 100); progressBar.setValue(0);/*from w ww .j ava2 s .c o m*/ progressBar.setStringPainted(true); taskOutput = new JTextArea(5, 20); taskOutput.setMargin(new Insets(5, 5, 5, 5)); taskOutput.setEditable(false); JPanel panel = new JPanel(); panel.add(startButton); panel.add(progressBar); add(panel, BorderLayout.PAGE_START); add(new JScrollPane(taskOutput), BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:Main.java
public Main() { super(new BorderLayout()); // Create the demo's UI. startButton = new JButton("Start"); startButton.setActionCommand("start"); startButton.addActionListener(this); progressBar = new JProgressBar(0, 100); progressBar.setValue(0);//from w w w .jav a 2 s . co m // Call setStringPainted now so that the progress bar height // stays the same whether or not the string is shown. progressBar.setStringPainted(true); taskOutput = new JTextArea(5, 20); taskOutput.setMargin(new Insets(5, 5, 5, 5)); taskOutput.setEditable(false); JPanel panel = new JPanel(); panel.add(startButton); panel.add(progressBar); add(panel, BorderLayout.PAGE_START); add(new JScrollPane(taskOutput), BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:view.ResultsPanel.java
public ResultsPanel(final MainControler controler, String[] command, String resultsName) { this.resultsName = resultsName; this.controler = controler; this.command = command; modeTable = new JTable(0, 2); DefaultTableModel model = new MyTableModel(); model.addColumn("Stoichiometry"); model.addColumn("Enzyme name"); model.addColumn("Equation"); modeTable.setModel(model);//from w w w .j av a 2 s.c om JPanel logPanel = new JPanel(new BorderLayout()); log = new JTextArea(); log.setEditable(false); log.setBackground(new Color(0, 0, 0)); log.setForeground(new Color(255, 255, 255)); logPanel.add(new JLabel("Genereted log", JLabel.CENTER), BorderLayout.PAGE_START); logPanel.add(new JScrollPane(log), BorderLayout.CENTER); addToProject.setName("add"); addToProject.setToolTipText("Attach this result to the project"); removeFromProject.setName("remove"); removeFromProject.setToolTipText("Remove this result from the project"); removeFromProject.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removeFromProject(); updateToolbar(); } }); addToProject.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addToProject(); updateToolbar(); } }); if (!resultsName.startsWith("saved/")) { isAttached = false; } else { isAttached = true; } filterButton.setToolTipText("Filter the results"); filterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { FilterFrame ff = new FilterFrame(GeneralFrame.getInstance(controler), allModes, filter, controler); if (ff.okPressed()) { displayFrame(ff.getNewModes(), ff.getIndices()); } } }); scriptButton.setToolTipText("Download the command as a script"); scriptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String scriptString = makeScript(); new Download(scriptString, "Download the command as a script", ""); } }); download = new JButton(new ImageIcon("src/icons/download.png")); download.setToolTipText("Download results"); histoButton.setToolTipText("Statistics"); searchField.setMaximumSize(new Dimension(20, 30)); readLog(); allModes = readResultsFile(); List<Integer> indices = new ArrayList<Integer>(); for (int i = 0; i < allModes.size(); i++) { indices.add((i + 1)); } displayFrame(allModes, indices); }
From source file:ProgressBarDemo2.java
public ProgressBarDemo2() { super(new BorderLayout()); // Create the demo's UI. startButton = new JButton("Start"); startButton.setActionCommand("start"); startButton.addActionListener(this); progressBar = new JProgressBar(0, 100); progressBar.setValue(0);//from ww w. j av a 2s . co m // Call setStringPainted now so that the progress bar height // stays the same whether or not the string is shown. progressBar.setStringPainted(true); taskOutput = new JTextArea(5, 20); taskOutput.setMargin(new Insets(5, 5, 5, 5)); taskOutput.setEditable(false); JPanel panel = new JPanel(); panel.add(startButton); panel.add(progressBar); add(panel, BorderLayout.PAGE_START); add(new JScrollPane(taskOutput), BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:SwingFileChooserDemo.java
public SwingFileChooserDemo() { super(new BorderLayout()); //Create the log first, because the action listeners //need to refer to it. log = new JTextArea(5, 20); log.setMargin(new Insets(5, 5, 5, 5)); log.setEditable(false);//from w w w .j av a 2s . co m JScrollPane logScrollPane = new JScrollPane(log); //Create a file chooser fc = new JFileChooser(); //Uncomment one of the following lines to try a different //file selection mode. The first allows just directories //to be selected (and, at least in the Java look and feel, //shown). The second allows both files and directories //to be selected. If you leave these lines commented out, //then the default mode (FILES_ONLY) will be used. // //fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); //fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); //Create the open button. We use the image from the JLF //Graphics Repository (but we extracted it from the jar). openButton = new JButton("Open a File...", createImageIcon("images/Open16.gif")); openButton.addActionListener(this); //Create the save button. We use the image from the JLF //Graphics Repository (but we extracted it from the jar). saveButton = new JButton("Save a File...", createImageIcon("images/Save16.gif")); saveButton.addActionListener(this); //For layout purposes, put the buttons in a separate panel JPanel buttonPanel = new JPanel(); //use FlowLayout buttonPanel.add(openButton); buttonPanel.add(saveButton); //Add the buttons and the log to this panel. add(buttonPanel, BorderLayout.PAGE_START); add(logScrollPane, BorderLayout.CENTER); }
From source file:com.yosanai.java.aws.console.AWSConsole.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from www . j av a 2s. c om */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" // <editor-fold defaultstate="collapsed" // <editor-fold defaultstate="collapsed" // <editor-fold defaultstate="collapsed" // desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { tlMain = new javax.swing.JToolBar(); btnAccess = new javax.swing.JButton(); btnConfig = new javax.swing.JButton(); btnExit = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Yosanai - AWS Console"); tlMain.setRollover(true); btnAccess.setText("Console"); btnAccess.setFocusable(false); btnAccess.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btnAccess.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btnAccess.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAccessActionPerformed(evt); } }); tlMain.add(btnAccess); btnConfig.setText("Config"); btnConfig.setFocusable(false); btnConfig.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btnConfig.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btnConfig.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnConfigActionPerformed(evt); } }); tlMain.add(btnConfig); btnExit.setText("Exit"); btnExit.setFocusable(false); btnExit.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btnExit.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); btnExit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnExitActionPerformed(evt); } }); tlMain.add(btnExit); getContentPane().add(tlMain, java.awt.BorderLayout.PAGE_START); pack(); }
From source file:events.KeyEventDemo.java
private void addComponentsToPane() { JButton button = new JButton("Clear"); button.addActionListener(this); typingArea = new JTextField(20); typingArea.addKeyListener(this); //Uncomment this if you wish to turn off focus //traversal. The focus subsystem consumes //focus traversal keys, such as Tab and Shift Tab. //If you uncomment the following line of code, this //disables focus traversal and the Tab events will //become available to the key event listener. //typingArea.setFocusTraversalKeysEnabled(false); displayArea = new JTextArea(); displayArea.setEditable(false);//www.ja v a2 s .c o m JScrollPane scrollPane = new JScrollPane(displayArea); scrollPane.setPreferredSize(new Dimension(375, 125)); getContentPane().add(typingArea, BorderLayout.PAGE_START); getContentPane().add(scrollPane, BorderLayout.CENTER); getContentPane().add(button, BorderLayout.PAGE_END); }
From source file:streaming.swing.JFramePrincipal.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//ww w .j av a 2 s . c om */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jToolBar1 = new javax.swing.JToolBar(); jBFilm = new javax.swing.JButton(); jBRealisateur = new javax.swing.JButton(); jBPays = new javax.swing.JButton(); jBGenre = new javax.swing.JButton(); jBSerie = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jToolBar1.setRollover(true); jBFilm.setText("Films"); jBFilm.setFocusable(false); jBFilm.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jBFilm.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jBFilm.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBFilmActionPerformed(evt); } }); jToolBar1.add(jBFilm); jBRealisateur.setText("Ralisateurs"); jBRealisateur.setFocusable(false); jBRealisateur.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jBRealisateur.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jBRealisateur.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBRealisateurActionPerformed(evt); } }); jToolBar1.add(jBRealisateur); jBPays.setText("Pays"); jBPays.setFocusable(false); jBPays.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jBPays.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jBPays.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBPaysActionPerformed(evt); } }); jToolBar1.add(jBPays); jBGenre.setText("Genres"); jBGenre.setFocusable(false); jBGenre.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jBGenre.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jBGenre.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBGenreActionPerformed(evt); } }); jToolBar1.add(jBGenre); jBSerie.setText("Sries"); jBSerie.setFocusable(false); jBSerie.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jBSerie.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jBSerie.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBSerieActionPerformed(evt); } }); jToolBar1.add(jBSerie); getContentPane().add(jToolBar1, java.awt.BorderLayout.PAGE_START); pack(); }
From source file:events.ListSelectionDemo.java
public ListSelectionDemo() { super(new BorderLayout()); String[] listData = { "one", "two", "three", "four", "five", "six", "seven" }; String[] columnNames = { "French", "Spanish", "Italian" }; list = new JList(listData); listSelectionModel = list.getSelectionModel(); listSelectionModel.addListSelectionListener(new SharedListSelectionHandler()); JScrollPane listPane = new JScrollPane(list); JPanel controlPane = new JPanel(); String[] modes = { "SINGLE_SELECTION", "SINGLE_INTERVAL_SELECTION", "MULTIPLE_INTERVAL_SELECTION" }; final JComboBox comboBox = new JComboBox(modes); comboBox.setSelectedIndex(2);//w w w. j av a2 s.c o m comboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String newMode = (String) comboBox.getSelectedItem(); if (newMode.equals("SINGLE_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } else if (newMode.equals("SINGLE_INTERVAL_SELECTION")) { listSelectionModel.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); } else { listSelectionModel.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); } output.append("----------" + "Mode: " + newMode + "----------" + newline); } }); controlPane.add(new JLabel("Selection mode:")); controlPane.add(comboBox); //Build output area. output = new JTextArea(1, 10); output.setEditable(false); JScrollPane outputPane = new JScrollPane(output, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); //Do the layout. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); add(splitPane, BorderLayout.CENTER); JPanel topHalf = new JPanel(); topHalf.setLayout(new BoxLayout(topHalf, BoxLayout.LINE_AXIS)); JPanel listContainer = new JPanel(new GridLayout(1, 1)); listContainer.setBorder(BorderFactory.createTitledBorder("List")); listContainer.add(listPane); topHalf.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); topHalf.add(listContainer); //topHalf.add(tableContainer); topHalf.setMinimumSize(new Dimension(100, 50)); topHalf.setPreferredSize(new Dimension(100, 110)); splitPane.add(topHalf); JPanel bottomHalf = new JPanel(new BorderLayout()); bottomHalf.add(controlPane, BorderLayout.PAGE_START); bottomHalf.add(outputPane, BorderLayout.CENTER); //XXX: next line needed if bottomHalf is a scroll pane: //bottomHalf.setMinimumSize(new Dimension(400, 50)); bottomHalf.setPreferredSize(new Dimension(450, 135)); splitPane.add(bottomHalf); }