List of usage examples for java.awt BorderLayout BorderLayout
public BorderLayout()
From source file:app.gui.ViewGraphic.java
public ViewGraphic(String title) { setSize(600, 400);//from ww w. j a v a2s . c o m setLocationRelativeTo(this); setTitle(title); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent arg0) { dispose(); } }); setLayout(new BorderLayout()); serieError = new XYSeries(title); dataset = new XYSeriesCollection(); dataset.addSeries(serieError); chart = ChartFactory.createXYLineChart(title, Translate.get("GUI_PERIODS"), Translate.get("GUI_ERROR"), dataset, PlotOrientation.VERTICAL, true, true, false); add(new ChartPanel(chart), BorderLayout.CENTER); JPanel south = new JPanel(new MigLayout()); lblError = new JLabel(""); lblError.setHorizontalTextPosition(SwingConstants.LEFT); lblError.setFont(new Font("ARIAL", Font.BOLD, 26)); JLabel lblErrorTitle = new JLabel(Translate.get("GUI_ERROR") + ": "); lblErrorTitle.setFont(new Font("ARIAL", Font.BOLD, 26)); south.add(lblErrorTitle); south.add(lblError, "wrap"); add(south, BorderLayout.SOUTH); setVisible(true); }
From source file:CascadeDemo.java
public CascadeDemo() { super("CascadeDemo"); EARTH = new ImageIcon("earth.jpg"); m_count = m_tencount = 0;//from www . ja v a2 s. c om m_desktop = new JDesktopPane(); m_desktop.putClientProperty("JDesktopPane.dragMode", "outline"); m_newFrame = new JButton("New Frame"); m_newFrame.addActionListener(this); m_infos = UIManager.getInstalledLookAndFeels(); String[] LAFNames = new String[m_infos.length]; for (int i = 0; i < m_infos.length; i++) { LAFNames[i] = m_infos[i].getName(); } m_UIBox = new JComboBox(LAFNames); m_UIBox.addActionListener(this); JPanel topPanel = new JPanel(true); topPanel.add(m_newFrame); topPanel.add(new JLabel("Look & Feel:", SwingConstants.RIGHT)); topPanel.add(m_UIBox); getContentPane().setLayout(new BorderLayout()); getContentPane().add("North", topPanel); getContentPane().add("Center", m_desktop); setSize(570, 400); Dimension dim = getToolkit().getScreenSize(); setLocation(dim.width / 2 - getWidth() / 2, dim.height / 2 - getHeight() / 2); setVisible(true); WindowListener l = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(l); }
From source file:MainClass.java
MainClass(String title) { super(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JToolBar toolBar = new JToolBar(); Action a = new AbstractAction("Demo") { public void actionPerformed(ActionEvent e) { System.out.println("Action taken."); }//ww w .java 2s . co m }; JButton b = toolBar.add(a); b.setText("Demo Button"); b.setToolTipText("Press me to take action."); JMenu mainMenu = new JMenu("Menu"); JMenuItem mi = mainMenu.add(a); mi.getAccessibleContext().setAccessibleName("Menu item"); JMenuBar mb = new JMenuBar(); mb.add(mainMenu); setJMenuBar(mb); JPanel pane = new JPanel(); pane.setLayout(new BorderLayout()); pane.setPreferredSize(new Dimension(200, 100)); pane.add(toolBar, BorderLayout.NORTH); setContentPane(pane); pack(); setVisible(true); }
From source file:de.mpicbg.knime.hcs.core.view.OverlayLegendDialog.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Open Source Project license - Sphinx-4 (cmusphinx.sourceforge.net/sphinx4/) scrollPane1 = new JScrollPane(); legendContainer = new JPanel(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== scrollPane1 ======== {/*from w w w. j ava 2 s . co m*/ //======== legendContainer ======== { legendContainer.setLayout(new GridLayout(0, 1)); } scrollPane1.setViewportView(legendContainer); } contentPane.add(scrollPane1, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }
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; }/*from ww w . j a v a 2 s. c o 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:teambootje.A9.java
/** * Creates new form A9/*from w w w. j av a2 s. 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:api3.transform.PlotWave.java
public PlotWave() { frame = new JFrame(); panel = new JPanel(); panel.setLayout(new BorderLayout()); slider = new JSlider(0, 200, SLIDER_DEFAULT_VALUE); lastValue = SLIDER_DEFAULT_VALUE;/*from w w w.j a v a 2s .c om*/ }
From source file:unusedClasses.MemoryUsageDemo.java
public MemoryUsageDemo(int paramInt) { super(new BorderLayout()); this.total.setMaximumItemAge(paramInt); this.free = new TimeSeries("Free Memory"); this.free.setMaximumItemAge(paramInt); TimeSeriesCollection localTimeSeriesCollection = new TimeSeriesCollection(); localTimeSeriesCollection.addSeries(this.total); localTimeSeriesCollection.addSeries(this.free); DateAxis localDateAxis = new DateAxis("Time"); NumberAxis localNumberAxis = new NumberAxis("Memory"); localDateAxis.setTickLabelFont(new Font("SansSerif", 0, 12)); localNumberAxis.setTickLabelFont(new Font("SansSerif", 0, 12)); localDateAxis.setLabelFont(new Font("SansSerif", 0, 14)); localNumberAxis.setLabelFont(new Font("SansSerif", 0, 14)); XYLineAndShapeRenderer localXYLineAndShapeRenderer = new XYLineAndShapeRenderer(true, false); localXYLineAndShapeRenderer.setSeriesPaint(0, Color.red); localXYLineAndShapeRenderer.setSeriesPaint(1, Color.green); localXYLineAndShapeRenderer.setSeriesStroke(0, new BasicStroke(3.0F, 0, 2)); localXYLineAndShapeRenderer.setSeriesStroke(1, new BasicStroke(3.0F, 0, 2)); XYPlot localXYPlot = new XYPlot(localTimeSeriesCollection, localDateAxis, localNumberAxis, localXYLineAndShapeRenderer); localDateAxis.setAutoRange(true);// w w w. jav a2s. co m localDateAxis.setLowerMargin(0.0D); localDateAxis.setUpperMargin(0.0D); localDateAxis.setTickLabelsVisible(true); localNumberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); JFreeChart localJFreeChart = new JFreeChart("JVM Memory Usage", new Font("SansSerif", 1, 24), localXYPlot, true); ChartUtilities.applyCurrentTheme(localJFreeChart); ChartPanel localChartPanel = new ChartPanel(localJFreeChart, true); localChartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4), BorderFactory.createLineBorder(Color.black))); add(localChartPanel); }
From source file:com.intuit.tank.tools.debugger.RequestResponsePanel.java
public RequestResponsePanel(AgentDebuggerFrame parent) { super(new BorderLayout()); this.parent = parent; parent.addScriptChangedListener(this); parent.addStepChangedListener(this); }
From source file:de.rbs90.fwdisp.settingsgui.gui.tabs.statistics.TimeStatisticsPanel.java
public TimeStatisticsPanel() { setName("Uhrzeit"); setLayout(new BorderLayout()); DefaultCategoryDataset dataset = new DefaultCategoryDataset(); int alarmCount[] = new int[24]; try {//from w w w .j a v a2 s .c o m ResultSet resultSet = Starter.getDatabase().getStatement().executeQuery( "SELECT STARTTIME_HOUR, COUNT(*) AS COUNT FROM ALARMHISTORY GROUP BY STARTTIME_HOUR"); while (resultSet.next()) { alarmCount[resultSet.getInt("STARTTIME_HOUR")] = resultSet.getInt("COUNT"); } } catch (SQLException e) { e.printStackTrace(); } for (int i = 0; i < 24; i++) { dataset.addValue(alarmCount[i], "", "" + i); } JFreeChart chart = ChartFactory.createBarChart3D("Zeitbersicht", "Uhrzeit", "Einstze", dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(getBackground()); ChartPanel panel = new ChartPanel(chart); panel.setPopupMenu(null); add(panel, BorderLayout.CENTER); }