List of usage examples for java.awt FlowLayout FlowLayout
public FlowLayout()
From source file:org.jfree.chart.demo.CyclicXYPlotDemo.java
/** * A demonstration application showing an XY plot, with a cyclic axis and renderer * * @param title the frame title./*from w w w.j ava 2s. c om*/ */ public CyclicXYPlotDemo(final String title) { super(title); this.series = new XYSeries("Random Data"); this.series.setMaximumItemCount(50); // Only 50 items are visible at the same time. // Keep more as a mean to test this. final XYSeriesCollection data = new XYSeriesCollection(this.series); final JFreeChart chart = ChartFactory.createXYLineChart("Cyclic XY Plot Demo", "X", "Y", data, PlotOrientation.VERTICAL, true, true, false); final XYPlot plot = chart.getXYPlot(); plot.setDomainAxis(new CyclicNumberAxis(10, 0)); plot.setRenderer(new CyclicXYItemRenderer()); final NumberAxis axis = (NumberAxis) plot.getRangeAxis(); axis.setAutoRangeIncludesZero(false); axis.setAutoRangeMinimumSize(1.0); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(400, 300)); final JPanel content = new JPanel(new BorderLayout()); content.add(chartPanel, BorderLayout.CENTER); final JButton button1 = new JButton("Start"); button1.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { timer.start(); } }); final JButton button2 = new JButton("Stop"); button2.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { timer.stop(); } }); final JButton button3 = new JButton("Step by step"); button3.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { CyclicXYPlotDemo.this.actionPerformed(null); } }); final JPanel buttonPanel = new JPanel(new FlowLayout()); buttonPanel.add(button1); buttonPanel.add(button2); buttonPanel.add(button3); content.add(buttonPanel, BorderLayout.SOUTH); setContentPane(content); this.timer = new Timer(200, this); }
From source file:org.jfree.chart.demo.DynamicDataDemo3.java
/** * Constructs a new demonstration application. * * @param title the frame title.//from w w w.j a va 2 s. co m */ public DynamicDataDemo3(final String title) { super(title); final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new DateAxis("Time")); this.datasets = new TimeSeriesCollection[SUBPLOT_COUNT]; for (int i = 0; i < SUBPLOT_COUNT; i++) { this.lastValue[i] = 100.0; final TimeSeries series = new TimeSeries("Random " + i, Millisecond.class); this.datasets[i] = new TimeSeriesCollection(series); final NumberAxis rangeAxis = new NumberAxis("Y" + i); rangeAxis.setAutoRangeIncludesZero(false); final XYPlot subplot = new XYPlot(this.datasets[i], null, rangeAxis, new StandardXYItemRenderer()); subplot.setBackgroundPaint(Color.lightGray); subplot.setDomainGridlinePaint(Color.white); subplot.setRangeGridlinePaint(Color.white); plot.add(subplot); } final JFreeChart chart = new JFreeChart("Dynamic Data Demo 3", plot); // chart.getLegend().setAnchor(Legend.EAST); chart.setBorderPaint(Color.black); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 4, 4, 4, 4)); final ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(60000.0); // 60 seconds final JPanel content = new JPanel(new BorderLayout()); final ChartPanel chartPanel = new ChartPanel(chart); content.add(chartPanel); final JPanel buttonPanel = new JPanel(new FlowLayout()); for (int i = 0; i < SUBPLOT_COUNT; i++) { final JButton button = new JButton("Series " + i); button.setActionCommand("ADD_DATA_" + i); button.addActionListener(this); buttonPanel.add(button); } final JButton buttonAll = new JButton("ALL"); buttonAll.setActionCommand("ADD_ALL"); buttonAll.addActionListener(this); buttonPanel.add(buttonAll); content.add(buttonPanel, BorderLayout.SOUTH); chartPanel.setPreferredSize(new java.awt.Dimension(500, 470)); chartPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setContentPane(content); }
From source file:com.genericworkflownodes.knime.nodes.io.OutputFileNodeDialog.java
private void setLayout() { dialogPanel.setLayout(new FlowLayout()); }
From source file:net.lmxm.ute.gui.validation.AbstractInputValidator.java
/** * Gets the messages dialog./*www . j a va2 s . c o m*/ * * @return the messages dialog */ private JDialog getMessagesDialog() { if (messagesDialog == null) { messagesDialog = new JDialog(); messagesDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); messagesDialog.setFocusableWindowState(false); messagesDialog.setUndecorated(true); final Container contentPane = messagesDialog.getContentPane(); contentPane.setLayout(new FlowLayout()); contentPane.setBackground(new Color(255, 250, 1)); contentPane.add(getMessagesIcon()); contentPane.add(getMessagesLabel()); } return messagesDialog; }
From source file:org.jfree.chart.demo.DynamicDataDemo2.java
/** * Constructs a new demonstration application. * * @param title the frame title./*from w ww . ja v a 2 s . c o m*/ */ public DynamicDataDemo2(final String title) { super(title); this.series1 = new TimeSeries("Random 1", Millisecond.class); this.series2 = new TimeSeries("Random 2", Millisecond.class); final TimeSeriesCollection dataset1 = new TimeSeriesCollection(this.series1); final TimeSeriesCollection dataset2 = new TimeSeriesCollection(this.series2); final JFreeChart chart = ChartFactory.createTimeSeriesChart("Dynamic Data Demo 2", "Time", "Value", dataset1, true, true, false); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 4, 4, 4, 4)); final ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); axis.setFixedAutoRange(60000.0); // 60 seconds plot.setDataset(1, dataset2); final NumberAxis rangeAxis2 = new NumberAxis("Range Axis 2"); rangeAxis2.setAutoRangeIncludesZero(false); plot.setRenderer(1, new DefaultXYItemRenderer()); plot.setRangeAxis(1, rangeAxis2); plot.mapDatasetToRangeAxis(1, 1); final JPanel content = new JPanel(new BorderLayout()); final ChartPanel chartPanel = new ChartPanel(chart); content.add(chartPanel); final JButton button1 = new JButton("Add To Series 1"); button1.setActionCommand("ADD_DATA_1"); button1.addActionListener(this); final JButton button2 = new JButton("Add To Series 2"); button2.setActionCommand("ADD_DATA_2"); button2.addActionListener(this); final JButton button3 = new JButton("Add To Both"); button3.setActionCommand("ADD_BOTH"); button3.addActionListener(this); final JPanel buttonPanel = new JPanel(new FlowLayout()); buttonPanel.add(button1); buttonPanel.add(button2); buttonPanel.add(button3); content.add(buttonPanel, BorderLayout.SOUTH); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(content); }
From source file:net.nosleep.superanalyzer.panels.HomePanel.java
public JPanel createWarningPanel(boolean showText) { JPanel panel = new JPanel(new FlowLayout()); panel.setOpaque(false);//from w w w .ja va 2 s. c o m String label = null; if (showText == true) label = Misc.getString("SOME_TAGS_MISSING") + "..."; URL url = this.getClass().getResource("/media/warning.png"); JButton button = new JButton(label, new ImageIcon(Toolkit.getDefaultToolkit().getImage(url))); button.setBorder(new EmptyBorder(0, 0, 0, 0)); button.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { showView(TagView.Id); } }); panel.add(button); return panel; }
From source file:com.streamhub.StreamHubLicenseGenerator.java
private static JPanel createMacAddressRow() { JPanel macAddressPanel = new JPanel(new FlowLayout()); Calendar yesterday = Calendar.getInstance(); yesterday.setTime(new Date()); yesterday.add(Calendar.DAY_OF_MONTH, -1); Calendar expiry = Calendar.getInstance(); expiry.setTime(yesterday.getTime()); expiry.add(Calendar.DAY_OF_MONTH, 60); JLabel macAddressLabel = new JLabel("MAC Address:"); JTextField macAddress = new JTextField(17); JLabel startDateLabel = new JLabel("Start Date"); final JFormattedTextField startDate = new JFormattedTextField(new SimpleDateFormat(DATE_FORMAT)); startDate.setValue(yesterday.getTime()); JLabel expiryDateLabel = new JLabel("Expiry Date"); final JFormattedTextField expiryDate = new JFormattedTextField(new SimpleDateFormat(DATE_FORMAT)); expiryDate.setValue(expiry.getTime()); startDate.addKeyListener(new KeyListener() { @Override/* w w w .j a va 2s . com*/ public void keyTyped(KeyEvent arg0) { // Get the new date and change expiry to suit Date date = (Date) startDate.getValue(); Calendar tempCal = Calendar.getInstance(); tempCal.setTime(date); tempCal.add(Calendar.DAY_OF_MONTH, 60); expiryDate.setValue(tempCal.getTime()); } @Override public void keyPressed(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } }); JComboBox edition = new JComboBox(new String[] { "web", "enterprise" }); JLabel nameLabel = new JLabel("Name:"); JTextField name = new JTextField(15); JLabel numUsersLabel = new JLabel("Num. Users:"); JTextField numUsers = new JTextField(DEFAULT_NUM_USERS); macAddressPanel.add(macAddressLabel); macAddressPanel.add(macAddress); macAddressPanel.add(startDateLabel); macAddressPanel.add(startDate); macAddressPanel.add(expiryDateLabel); macAddressPanel.add(expiryDate); macAddressPanel.add(edition); macAddressPanel.add(nameLabel); macAddressPanel.add(name); macAddressPanel.add(numUsersLabel); macAddressPanel.add(numUsers); return macAddressPanel; }
From source file:com.orange.atk.graphAnalyser.RealtimeGraph.java
private void initComponents() { jListGraph = new JList(listModelGraph); jPanelroot = new JPanel(); jScrollPaneListGraph = new JScrollPane(); jListPerfGraph = new JList(listModelGraph); jComboBoxLeft = new JComboBox(comboModelLeft); jComboBoxRight = new JComboBox(comboModelRight); setDefaultCloseOperation(DISPOSE_ON_CLOSE); jScrollPaneListGraph.setViewportView(jListPerfGraph); jComboBoxLeft.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxLeftActionPerformed(evt); }/*from w ww.j a v a2 s . co m*/ }); jComboBoxRight.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxRightActionPerformed(evt); } }); jPanelroot.setLayout(new BorderLayout()); jPanelroot.add(chartPanel, BorderLayout.CENTER); toolPane = new JPanel(); toolPane.setLayout(new FlowLayout()); toolPane.add(jComboBoxLeft); Box graphlistbox = Box.createVerticalBox(); graphlistbox.add(new JLabel("List of Graph")); graphlistbox.add(jScrollPaneListGraph); toolPane.add(graphlistbox); toolPane.add(jComboBoxRight); jPanelroot.add(toolPane, BorderLayout.NORTH); setContentPane(jPanelroot); //a small size for small screen // setMaximumSize(new Dimension(600,500)); pack(); }
From source file:es.emergya.ui.gis.popups.ListaCapas.java
private ListaCapas(CustomMapView mapView, final IMapViewer historyMapViewer) { super();/*from w ww .j a v a 2s . c om*/ setTitle(i18n.getString("window.gpx.titleBar")); setLocationRelativeTo(getBasicWindow().getFrame()); setResizable(false); setAlwaysOnTop(true); this.mapView = mapView; this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setIconImage(getBasicWindow().getFrame().getIconImage()); JPanel dialogo = new JPanel(new BorderLayout()); dialogo.setBackground(Color.WHITE); dialogo.setBorder(new EmptyBorder(10, 10, 10, 10)); capasGpx = new JPanel(); capasGpx.setBackground(Color.WHITE); capasGpx.setLayout(new BoxLayout(capasGpx, BoxLayout.Y_AXIS)); JScrollPane lista = new JScrollPane(capasGpx); lista.setOpaque(false); lista.setBorder(new TitledBorder(i18n.getString("window.gpx.title"))); dialogo.add(lista, BorderLayout.CENTER); JPanel boton = new JPanel(new FlowLayout()); boton.setOpaque(false); JButton cargar = getCargarGPXButton(); boton.add(cargar, FlowLayout.LEFT); dialogo.add(boton, BorderLayout.SOUTH); add(dialogo); setPreferredSize(new Dimension(400, 250)); pack(); setLocationRelativeTo((Component) mapView); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { super.windowClosed(e); // historyMapViewer.getGPXButton().setSelected(false); } }); }
From source file:SoundManagerTest.java
/** * Creates the UI, which is a row of buttons. *//*from ww w. j av a 2 s . c om*/ public void initUI() { // make sure Swing components don't paint themselves NullRepaintManager.install(); JFrame frame = super.screen.getFullScreenWindow(); Container contentPane = frame.getContentPane(); contentPane.setLayout(new FlowLayout()); contentPane.add(createButton(PAUSE, true)); contentPane.add(createButton(PLAY_MUSIC, true)); contentPane.add(createButton(MUSIC_DRUMS, false)); contentPane.add(createButton(PLAY_SOUND, false)); contentPane.add(createButton(PLAY_ECHO_SOUND, false)); contentPane.add(createButton(PLAY_LOOPING_SOUND, true)); contentPane.add(createButton(PLAY_MANY_SOUNDS, false)); contentPane.add(createButton(EXIT, false)); // explicitly layout components (needed on some systems) frame.validate(); }