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:teambootje.A2.java
public A2() { initComponents();/*from w w w . jav a2 s. c o m*/ setLocationRelativeTo(null); setLayout(new BorderLayout()); //Create and set up the window. setTitle("SS Rotterdam Analyse || Analyse 2"); ImageIcon icon = new ImageIcon("img/bootje.jpg"); setIconImage(icon.getImage()); // back BTN JButton back = new JButton("Back"); add(back, BorderLayout.NORTH); back.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); // panel en Label JPanel ana = new JPanel(); add(ana, BorderLayout.CENTER); //tabel String sql = "SELECT Datum, COUNT(*) AS Aantal FROM posts GROUP BY Datum"; List<Object[]> list = new ArrayList<Object[]>(); ResultSet rs = null; try { rs = db.runSql(sql); while (rs.next()) { String datum = rs.getString("Datum"); int aantal = rs.getInt("Aantal"); String[] row = new String[rs.getMetaData().getColumnCount()]; for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { row[i - 1] = rs.getString(i); } list.add(row); //chart JButton chart = new JButton("Chart"); add(chart, BorderLayout.SOUTH); chart.addActionListener(new ActionListener() { String dat = datum; int a1 = aantal; @Override public void actionPerformed(ActionEvent e) { DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue(dat, a1); pieDataset.setValue("2015-04-06", new Integer(5)); pieDataset.setValue("2015-04-05", new Integer(5)); pieDataset.setValue("2015-04-04", new Integer(14)); pieDataset.setValue("2015-04-03", new Integer(4)); pieDataset.setValue("2015-04-02", new Integer(1)); pieDataset.setValue("2015-04-01", new Integer(32)); pieDataset.setValue("2015-03-31", new Integer(32)); pieDataset.setValue("2015-03-30", new Integer(9)); pieDataset.setValue("2015-03-29", new Integer(4)); pieDataset.setValue("2015-03-28", new Integer(1)); pieDataset.setValue("2015-03-27", new Integer(3)); pieDataset.setValue("2015-03-26", new Integer(6)); pieDataset.setValue("2015-03-25", new Integer(1)); pieDataset.setValue("2015-03-24", new Integer(1)); pieDataset.setValue("2015-03-23", new Integer(1)); pieDataset.setValue("2015-03-22", new Integer(1)); pieDataset.setValue("2015-03-21", new Integer(1)); pieDataset.setValue("2015-03-20", new Integer(1)); pieDataset.setValue("2015-03-19", new Integer(1)); pieDataset.setValue("2015-03-18", new Integer(2)); pieDataset.setValue("2015-03-17", new Integer(1)); JFreeChart chart = ChartFactory.createPieChart3D("Aantal Posts per datum", pieDataset, true, true, true); PiePlot3D p = (PiePlot3D) chart.getPlot(); //p.setForegroundAlpha(TOP_ALIGNMENT); ChartFrame pie = new ChartFrame("Aantal Posts per datum", chart); pie.setVisible(true); pie.setSize(500, 500); pie.setLocationRelativeTo(null); //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); } } catch (SQLException e) { JOptionPane.showMessageDialog(null, e); } Object[][] array = new Object[list.size()][]; Object columnNames[] = { "Datum", "Aantal" }; list.toArray(array); JTable table = new JTable(array, columnNames); JScrollPane scroll = new JScrollPane(table); scroll.setPreferredSize(new Dimension(400, 400)); ana.add(scroll); }
From source file:teambootje.A9.java
/** * Creates new form A9/*from www .j a v a2s. c o m*/ */ public A9() { initComponents(); setLocationRelativeTo(null); setLayout(new BorderLayout()); //Create and set up the window. setTitle("SS Rotterdam Analyse || Analyse 9"); ImageIcon icon = new ImageIcon("img/bootje.jpg"); setIconImage(icon.getImage()); // back BTN JButton back = new JButton("Back"); add(back, BorderLayout.NORTH); back.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); // panel en Label JPanel ana = new JPanel(); add(ana, BorderLayout.CENTER); //tabel String sql = "SELECT persoon.Name, COUNT(post) AS Aantal FROM persoon, posts WHERE persoon.AID = posts.AID GROUP BY persoon.Name"; List<Object[]> list = new ArrayList<Object[]>(); ResultSet rs = null; try { rs = db.runSql(sql); while (rs.next()) { String name = rs.getString("persoon.Name"); int amount = rs.getInt("Aantal"); String[] row = new String[rs.getMetaData().getColumnCount()]; for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { row[i - 1] = rs.getString(i); } list.add(row); //chart JButton chart = new JButton("Chart"); add(chart, BorderLayout.SOUTH); chart.addActionListener(new ActionListener() { String n1 = name; int a1 = amount; @Override public void actionPerformed(ActionEvent e) { DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue(n1, a1); pieDataset.setValue("WestCordHotels", new Integer(1)); pieDataset.setValue("Voetbalr", new Integer(2)); pieDataset.setValue("VeraBauman", new Integer(1)); pieDataset.setValue("TonWesselink", new Integer(2)); pieDataset.setValue("Stoomschip Rotterdam", new Integer(25)); pieDataset.setValue("shirleys86", new Integer(2)); pieDataset.setValue("SevereWeather_N", new Integer(2)); pieDataset.setValue("SalvatoreOrtisi", new Integer(4)); pieDataset.setValue("RuudvEck", new Integer(2)); pieDataset.setValue("RuudvandenBos", new Integer(1)); pieDataset.setValue("Roffa85", new Integer(1)); pieDataset.setValue("RichardPh0t0", new Integer(2)); pieDataset.setValue("RebekkaKadijk", new Integer(2)); pieDataset.setValue("ray_rademaker", new Integer(6)); pieDataset.setValue("PoushNL", new Integer(1)); pieDataset.setValue("popupsquare", new Integer(2)); pieDataset.setValue("Plan_78", new Integer(3)); pieDataset.setValue("Petrahoogenboom", new Integer(1)); pieDataset.setValue("PatriciaBenard", new Integer(2)); pieDataset.setValue("OVKatendrecht", new Integer(2)); pieDataset.setValue("OdileHemmen", new Integer(2)); pieDataset.setValue("NLMaritiem", new Integer(2)); pieDataset.setValue("Nellyvdvlies", new Integer(1)); pieDataset.setValue("meerkatting", new Integer(2)); pieDataset.setValue("MeerkatsNow", new Integer(2)); pieDataset.setValue("marygoossens1", new Integer(1)); pieDataset.setValue("MarjoleinNagel", new Integer(1)); pieDataset.setValue("MaaikeMaasdijk", new Integer(1)); pieDataset.setValue("KidsErOpUit", new Integer(2)); pieDataset.setValue("Katendrechtnr1", new Integer(25)); pieDataset.setValue("jpsoree", new Integer(2)); pieDataset.setValue("JolandaBolscher", new Integer(2)); pieDataset.setValue("jes4life", new Integer(1)); pieDataset.setValue("JaccoScheer", new Integer(1)); pieDataset.setValue("GwNpop", new Integer(2)); pieDataset.setValue("Gerarddegraaff", new Integer(1)); pieDataset.setValue("FR12Patrick", new Integer(3)); pieDataset.setValue("FlorentinaNow", new Integer(1)); pieDataset.setValue("FIVBWorldChamps", new Integer(2)); pieDataset.setValue("FIVBVolleyball", new Integer(2)); pieDataset.setValue("FeestdjNik", new Integer(1)); pieDataset.setValue("ensanne", new Integer(1)); pieDataset.setValue("elsekramer", new Integer(1)); pieDataset.setValue("EelcoBeijl", new Integer(1)); pieDataset.setValue("EdwindeKoning1", new Integer(2)); pieDataset.setValue("DMiddelman", new Integer(3)); pieDataset.setValue("de_rotterdam", new Integer(2)); pieDataset.setValue("CvanAdrighem", new Integer(2)); pieDataset.setValue("carolinedejager", new Integer(1)); pieDataset.setValue("CaatVanEnst", new Integer(1)); pieDataset.setValue("BotlekBusiness", new Integer(2)); pieDataset.setValue("AnneWallisDeVri", new Integer(2)); pieDataset.setValue("010byday", new Integer(4)); JFreeChart chart = ChartFactory.createPieChart3D("Aantal posts per personen", pieDataset, true, true, true); PiePlot3D p = (PiePlot3D) chart.getPlot(); //p.setForegroundAlpha(TOP_ALIGNMENT); ChartFrame pie = new ChartFrame("Aantal posts per personen", chart); pie.setVisible(true); pie.setSize(500, 500); pie.setLocationRelativeTo(null); //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); } } catch (SQLException e) { JOptionPane.showMessageDialog(null, e); } Object[][] array = new Object[list.size()][]; Object columnNames[] = { "Naam", "Aantal" }; list.toArray(array); JTable table = new JTable(array, columnNames); JScrollPane scroll = new JScrollPane(table); scroll.setPreferredSize(new Dimension(400, 400)); ana.add(scroll); }
From source file:ProgressBarTest.java
public ProgressBarFrame() { setTitle("ProgressBarTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); // this text area holds the activity output textArea = new JTextArea(); // set up panel with button and progress bar final int MAX = 1000; JPanel panel = new JPanel(); startButton = new JButton("Start"); progressBar = new JProgressBar(0, MAX); progressBar.setStringPainted(true);/*www . j av a 2s .c o m*/ panel.add(startButton); panel.add(progressBar); checkBox = new JCheckBox("indeterminate"); checkBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { progressBar.setIndeterminate(checkBox.isSelected()); progressBar.setStringPainted(!progressBar.isIndeterminate()); } }); panel.add(checkBox); add(new JScrollPane(textArea), BorderLayout.CENTER); add(panel, BorderLayout.SOUTH); // set up the button action startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { startButton.setEnabled(false); activity = new SimulatedActivity(MAX); activity.execute(); } }); }
From source file:Branch.java
public void init() { Container cp = getContentPane(); root = new DefaultMutableTreeNode("root"); tree = new JTree(root); // Add it and make it take care of scrolling: cp.add(new JScrollPane(tree), BorderLayout.CENTER); // Capture the tree's model: model = (DefaultTreeModel) tree.getModel(); JButton test = new JButton("Press me"); test.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (i < data.length) { child = new Branch(data[i++]).node(); // What's the last one you clicked? chosen = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (chosen == null) chosen = root;//from w ww .j a va 2 s . c o m // The model will create the appropriate event. // In response, the tree will update itself: model.insertNodeInto(child, chosen, 0); // Puts the new node on the chosen node. } } }); // Change the button's colors: test.setBackground(Color.BLUE); test.setForeground(Color.WHITE); JPanel p = new JPanel(); p.add(test); cp.add(p, BorderLayout.SOUTH); }
From source file:BoxLayoutPane.java
public BoxLayoutPane() { // Use a BorderLayout layout manager to arrange various Box components this.setLayout(new BorderLayout()); // Give the entire panel a margin by adding an empty border // We could also do this by overriding getInsets() this.setBorder(new EmptyBorder(10, 10, 10, 10)); // Add a plain row of buttons along the top of the pane Box row = Box.createHorizontalBox(); for (int i = 0; i < 4; i++) { JButton b = new JButton("B" + i); b.setFont(new Font("serif", Font.BOLD, 12 + i * 2)); row.add(b);//from w ww . ja va 2 s. c om } this.add(row, BorderLayout.NORTH); // Add a plain column of buttons along the right edge // Use BoxLayout with a different kind of Swing container // Give the column a border: can't do this with the Box class JPanel col = new JPanel(); col.setLayout(new BoxLayout(col, BoxLayout.Y_AXIS)); col.setBorder(new TitledBorder(new EtchedBorder(), "Column")); for (int i = 0; i < 4; i++) { JButton b = new JButton("Button " + i); b.setFont(new Font("sanserif", Font.BOLD, 10 + i * 2)); col.add(b); } this.add(col, BorderLayout.EAST); // Add column to right of panel // Add a button box along the bottom of the panel. // Use "Glue" to space the buttons evenly Box buttonbox = Box.createHorizontalBox(); buttonbox.add(Box.createHorizontalGlue()); // stretchy space buttonbox.add(new JButton("Okay")); buttonbox.add(Box.createHorizontalGlue()); // stretchy space buttonbox.add(new JButton("Cancel")); buttonbox.add(Box.createHorizontalGlue()); // stretchy space buttonbox.add(new JButton("Help")); buttonbox.add(Box.createHorizontalGlue()); // stretchy space this.add(buttonbox, BorderLayout.SOUTH); // Create a component to display in the center of the panel JTextArea textarea = new JTextArea(); textarea.setText("This component has 12-pixel margins on left and top" + " and has 72-pixel margins on right and bottom."); textarea.setLineWrap(true); textarea.setWrapStyleWord(true); // Use Box objects to give the JTextArea an unusual spacing // First, create a column with 3 kids. The first and last kids // are rigid spaces. The middle kid is the text area Box fixedcol = Box.createVerticalBox(); fixedcol.add(Box.createVerticalStrut(12)); // 12 rigid pixels fixedcol.add(textarea); // Component fills in the rest fixedcol.add(Box.createVerticalStrut(72)); // 72 rigid pixels // Now create a row. Give it rigid spaces on the left and right, // and put the column from above in the middle. Box fixedrow = Box.createHorizontalBox(); fixedrow.add(Box.createHorizontalStrut(12)); fixedrow.add(fixedcol); fixedrow.add(Box.createHorizontalStrut(72)); // Now add the JTextArea in the column in the row to the panel this.add(fixedrow, BorderLayout.CENTER); }
From source file:UndoExample3.java
public UndoExample3() { super("Undo/Redo Example 3"); DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("root"); DefaultMutableTreeNode node = new DefaultMutableTreeNode("Apollo 8"); rootNode.add(node);//from w ww. j a v a2 s . 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")); UndoableTree tree = new UndoableTree(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:org.pmedv.core.dialogs.AbstractDialog.java
public AbstractDialog(String title, boolean modal, boolean showNewButton, boolean showOkButton, boolean showCancelButton) { setTitle(title);/* www . j a va 2 s .co m*/ ctx = AppContext.getApplicationContext(); resources = (ResourceService) ctx.getBean(BeanDirectory.SERVICE_RESOURCE); newIcon = resources.getIcon("icon.newdocument"); okIcon = resources.getIcon("icon.apply"); cancelIcon = resources.getIcon("icon.cancel"); contentPanel = new JPanel(new BorderLayout()); contentPanel.add(createButtonBar(showNewButton, showOkButton, showCancelButton), BorderLayout.SOUTH); add(contentPanel); initializeComponents(); // pack(); centerAndAdjustSize(); setModal(modal); setVisible(true); }
From source file:UndoDemo.java
/** Construct a GUI that demonstrates use of UndoManager */ public UndoDemo() { Container cp = getContentPane(); cp.add(ta = new JTextArea(20, 60), BorderLayout.CENTER); JPanel bp;/*from w ww . j a va2s .c o m*/ cp.add(bp = new JPanel(), BorderLayout.SOUTH); // Create a javax.swing.undo.UndoManager; this is an amazing class that // keeps a Stack of UndoableEdits and lets you invoke them; // by registering it as a Listener on the TextComponent.Document, // the Document will create the UndoableEdit objects and send them // to the UndoManager. Between them they do ALL the work! um = new UndoManager(); ta.getDocument().addUndoableEditListener(um); // Create the buttons JButton cutButton, copyButton, pasteButton, undoButton, redoButton; bp.add(cutButton = new JButton("Cut")); cutButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ta.cut(); } }); bp.add(copyButton = new JButton("Copy")); copyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ta.copy(); } }); bp.add(pasteButton = new JButton("Paste")); pasteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ta.paste(); } }); bp.add(undoButton = new JButton("UnDo")); undoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (um.canUndo()) { um.undo(); } else { warn("Can't undo"); } } }); bp.add(redoButton = new JButton("ReDo")); redoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (um.canRedo()) { um.redo(); } else { warn("Can't redo"); } } }); pack(); setDefaultCloseOperation(EXIT_ON_CLOSE); }
From source file:teambootje.A3.java
/** * Creates new form A3/*from ww w . jav a 2 s . c om*/ */ public A3() { initComponents(); setLocationRelativeTo(null); setLayout(new BorderLayout()); //Create and set up the window. setTitle("SS Rotterdam Analyse || Analyse 3"); ImageIcon icon = new ImageIcon("img/bootje.jpg"); setIconImage(icon.getImage()); // back BTN JButton back = new JButton("Back"); add(back, BorderLayout.NORTH); back.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); // panel en Label JPanel ana = new JPanel(); add(ana, BorderLayout.CENTER); //tabel String sql = "SELECT locatie.land, locatie.stad, COUNT(posts.PID) AS Aantal FROM persoon, locatie, posts WHERE persoon.LID = locatie.LID AND persoon.AID = posts.AID GROUP BY locatie.land ORDER BY count(posts.PID)"; List<Object[]> list = new ArrayList<Object[]>(); ResultSet rs = null; try { rs = db.runSql(sql); while (rs.next()) { String land = rs.getString("locatie.land"); String stad = rs.getString("locatie.stad"); int aantal = rs.getInt("Aantal"); String[] row = new String[rs.getMetaData().getColumnCount()]; for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) { row[i - 1] = rs.getString(i); } list.add(row); //chart JButton chart = new JButton("Chart"); add(chart, BorderLayout.SOUTH); chart.addActionListener(new ActionListener() { String l1 = land; String s1 = stad; int a1 = aantal; @Override public void actionPerformed(ActionEvent e) { DefaultPieDataset pieDataset = new DefaultPieDataset(); pieDataset.setValue(s1, a1); JFreeChart chart = ChartFactory.createPieChart3D("Aantal Posts per locatie", pieDataset, true, true, true); PiePlot3D p = (PiePlot3D) chart.getPlot(); //p.setForegroundAlpha(TOP_ALIGNMENT); ChartFrame pie = new ChartFrame("Aantal Posts per locatie", chart); pie.setVisible(true); pie.setSize(500, 500); pie.setLocationRelativeTo(null); // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }); } } catch (SQLException e) { JOptionPane.showMessageDialog(null, e); } Object[][] array = new Object[list.size()][]; Object columnNames[] = { "Land", "Stad", "Aantal" }; list.toArray(array); JTable table = new JTable(array, columnNames); JScrollPane scroll = new JScrollPane(table); scroll.setPreferredSize(new Dimension(400, 400)); ana.add(scroll); }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakAnnotationReportPanel.java
protected void initComponents() { setLayout(new BorderLayout()); // create chart theDataset = new DefaultXYDataset(); theChart = org.jfree.chart.ChartFactory.createScatterPlot("Annotation", "Count", "Intensity", theDataset, org.jfree.chart.plot.PlotOrientation.VERTICAL, true, false, false); thePlot = (XYPlot) theChart.getPlot(); thePlot.setRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.LINES)); theChartPanel = new ChartPanel(theChart); theChartPanel.setDomainZoomable(true); theChartPanel.setRangeZoomable(false); //theChartPanel.setPopupMenu(null); add(theChartPanel, BorderLayout.CENTER); // create toolbar theToolBar = createToolBar();/*from w w w.java 2 s . com*/ add(theToolBar, BorderLayout.SOUTH); }