List of usage examples for javax.swing BoxLayout PAGE_AXIS
int PAGE_AXIS
To view the source code for javax.swing BoxLayout PAGE_AXIS.
Click Source Link
From source file:op.care.med.inventory.DlgCloseStock.java
/** * This method is called from within the constructor to * initialize the form.//from w w w . j a v a2 s .c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new JPanel(); jScrollPane1 = new JScrollPane(); txtInfo = new JTextPane(); rbLeer = new JRadioButton(); rbStellen = new JRadioButton(); txtLetzte = new JTextField(); lblEinheiten = new JLabel(); rbAbgelaufen = new JRadioButton(); jSeparator1 = new JSeparator(); jLabel2 = new JLabel(); jLabel3 = new JLabel(); rbGefallen = new JRadioButton(); cmbBestID = new JComboBox(); panel1 = new JPanel(); btnClose = new JButton(); btnOk = new JButton(); //======== this ======== setResizable(false); setModalityType(Dialog.ModalityType.APPLICATION_MODAL); Container contentPane = getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); //======== jPanel1 ======== { jPanel1.setBorder(null); jPanel1.setLayout(new FormLayout("14dlu, $lcgap, 145dlu, $lcgap, 41dlu, $lcgap, 93dlu, $lcgap, 14dlu", "14dlu, $lgap, fill:70dlu:grow, 4*($lgap, fill:default), $lgap, $rgap, $lgap, fill:default, $lgap, $rgap, $lgap, default, $lgap, 14dlu")); //======== jScrollPane1 ======== { //---- txtInfo ---- txtInfo.setEditable(false); txtInfo.setFont(new Font("Arial", Font.PLAIN, 14)); jScrollPane1.setViewportView(txtInfo); } jPanel1.add(jScrollPane1, CC.xywh(3, 3, 5, 1)); //---- rbLeer ---- rbLeer.setSelected(true); rbLeer.setText("Die Packung ist nun leer"); rbLeer.setFont(new Font("Arial", Font.PLAIN, 14)); rbLeer.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rbLeerActionPerformed(e); } }); jPanel1.add(rbLeer, CC.xy(3, 5)); //---- rbStellen ---- rbStellen.setText("Beim Vorab Stellen haben Sie die letzten "); rbStellen.setFont(new Font("Arial", Font.PLAIN, 14)); rbStellen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rbStellenActionPerformed(e); } }); jPanel1.add(rbStellen, CC.xywh(3, 7, 2, 1)); //---- txtLetzte ---- txtLetzte.setText("jTextField1"); txtLetzte.setFont(new Font("Arial", Font.PLAIN, 14)); txtLetzte.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { txtLetzteFocusLost(e); } }); jPanel1.add(txtLetzte, CC.xy(5, 7)); //---- lblEinheiten ---- lblEinheiten.setText("Einheiten verbraucht."); lblEinheiten.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(lblEinheiten, CC.xy(7, 7)); //---- rbAbgelaufen ---- rbAbgelaufen.setText( "Die Packung ist abgelaufen oder wird nicht mehr ben\u00f6tigt. Bereit zur Entsorgung."); rbAbgelaufen.setFont(new Font("Arial", Font.PLAIN, 14)); rbAbgelaufen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rbAbgelaufenActionPerformed(e); } }); jPanel1.add(rbAbgelaufen, CC.xywh(3, 9, 5, 1)); jPanel1.add(jSeparator1, CC.xywh(3, 13, 5, 1)); //---- jLabel2 ---- jLabel2.setText("Als n\u00e4chstes Packung soll die Nummer"); jLabel2.setFont(new Font("Arial", Font.PLAIN, 14)); jLabel2.setHorizontalAlignment(SwingConstants.TRAILING); jPanel1.add(jLabel2, CC.xy(3, 15)); //---- jLabel3 ---- jLabel3.setText("angebrochen werden."); jLabel3.setFont(new Font("Arial", Font.PLAIN, 14)); jPanel1.add(jLabel3, CC.xy(7, 15)); //---- rbGefallen ---- rbGefallen.setText( "<html>Die Packung ist <font color=\"red\">runter gefallen</font> oder <font color=\"red\">verschwunden</font> und muss ausgebucht werden.</html>"); rbGefallen.setFont(new Font("Arial", Font.PLAIN, 14)); rbGefallen.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { rbGefallenActionPerformed(e); } }); jPanel1.add(rbGefallen, CC.xywh(3, 11, 5, 1)); //---- cmbBestID ---- cmbBestID.setModel(new DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); cmbBestID.setFont(new Font("Arial", Font.PLAIN, 14)); cmbBestID.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { cmbBestIDItemStateChanged(e); } }); jPanel1.add(cmbBestID, CC.xy(5, 15)); //======== panel1 ======== { panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS)); //---- btnClose ---- btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png"))); btnClose.setText(null); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnCloseActionPerformed(e); } }); panel1.add(btnClose); //---- btnOk ---- btnOk.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png"))); btnOk.setText(null); btnOk.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnOkActionPerformed(e); } }); panel1.add(btnOk); } jPanel1.add(panel1, CC.xy(7, 19, CC.RIGHT, CC.DEFAULT)); } contentPane.add(jPanel1); pack(); setLocationRelativeTo(getOwner()); //---- buttonGroup1 ---- ButtonGroup buttonGroup1 = new ButtonGroup(); buttonGroup1.add(rbLeer); buttonGroup1.add(rbStellen); buttonGroup1.add(rbAbgelaufen); buttonGroup1.add(rbGefallen); }
From source file:org.ut.biolab.medsavant.client.view.genetics.variantinfo.GeneManiaSubInspector.java
private void buildPanel() { kvp = new KeyValuePairPanel(2); kvp.setKeysVisible(false);/*from w w w . j ava 2 s . c o m*/ kvpPanel = new JPanel(); kvpPanel.setLayout(new BorderLayout()); kvpPanel.add(kvp, BorderLayout.CENTER); JPanel currGenePanel = ViewUtil.getClearPanel(); JPanel pMessagePanel = ViewUtil.getClearPanel(); settingsPanel = ViewUtil.getClearPanel(); progressBar = new ProgressWheel(); progressBar.setVisible(false); progressMessage = new JLabel(); progressMessage.setVisible(false); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); settingsButton = new JButton("Settings"); settingsButton.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { genemaniaSettings.showSettings(); if (genemaniaSettings.getUpdateQueryNeeded()) { rankByVarFreq = genemaniaSettings.getRankByVarFreq(); updateRelatedGenesPanel(genes); } } }); pMessagePanel.add(progressMessage); settingsPanel.setLayout(new BorderLayout()); settingsPanel.add(settingsButton, BorderLayout.EAST); graph = ViewUtil.getClearPanel(); panel.add(kvpPanel); panel.add(currGenePanel); panel.add(pMessagePanel); panel.add(progressBar); panel.add(settingsPanel); panel.add(graph); }
From source file:fungus.UtilizationChartFrame.java
public UtilizationChartFrame(String prefix) { simulationCycles = Configuration.getDouble(PAR_SIMULATION_CYCLES); this.setTitle("MycoNet Statistics Chart"); graph = JungGraphObserver.getGraph(); //data.add(-1,0); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.setAutoWidth(false);// w w w .ja v a 2 s .com dataset.setIntervalWidth(simulationCycles); averageUtilizationData = new XYSeries("Average Utilization"); dataset.addSeries(averageUtilizationData); averageStableUtilizationData = new XYSeries("Avg Stable Util"); dataset.addSeries(averageStableUtilizationData); hyphaRatioData = new XYSeries("Hypha Ratio"); dataset.addSeries(hyphaRatioData); stableHyphaRatioData = new XYSeries("Stable Hypha Ratio"); dataset.addSeries(stableHyphaRatioData); //XYSeriesCollection dataset; JFreeChart utilizationChart = ChartFactory.createXYLineChart("Utilization Metrics", "Cycle", "Average Utilization", dataset, PlotOrientation.VERTICAL, true, false, false); ChartPanel utilizationChartPanel = new ChartPanel(utilizationChart); //chart.setBackgroundPaint(Color.white); //XYPlot plot = chart.getXYPlot(); // BufferedImage chartImage = chart.createBufferedImage(500,300); // chartLabel = new JLabel(); //chartLabel.setIcon(new ImageIcon(chartImage)); Container contentPane = getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); JPanel labelPane = new JPanel(); labelPane.setLayout(new GridLayout(1, 1)); //chartPane.setPreferredSize(new java.awt.Dimension(500, 300)); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); ////contentPane.add(labelPane,BorderLayout.PAGE_START); //contentPane.add(Box.createRigidArea(new Dimension(0,5))); contentPane.add(utilizationChartPanel, BorderLayout.CENTER); //contentPane.add(Box.createRigidArea(new Dimension(0,5))); ////contentPane.add(buttonPane, BorderLayout.PAGE_END); //data = node.getHyphaData(); //link = node.getHyphaLink(); //mycocast = node.getMycoCast(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //chartPanel.add(chartLabel); /*JButton updateButton = new JButton("Refresh"); ActionListener updater = new ActionListener() { public void actionPerformed(ActionEvent e) { refreshData(); } }; updateButton.addActionListener(updater); JButton closeButton = new JButton("Close"); ActionListener closer = new ActionListener() { public void actionPerformed(ActionEvent e) { closeFrame(); } }; closeButton.addActionListener(closer); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(updateButton); buttonPane.add(Box.createRigidArea(new Dimension(5,0))); buttonPane.add(closeButton); refreshData(); */ //JungGraphObserver.addChangeListener(this); this.pack(); this.setVisible(true); }
From source file:org.peerfact.impl.service.aggregation.skyeye.visualization.SkyNetVisualization.java
private SkyNetVisualization() { super("Metric-Visualization"); createLookAndFeel();/*from w w w . j a v a 2 s .co m*/ displayedMetrics = new LinkedHashMap<String, MetricsPlot>(); setLayout(new GridLayout(1, 1)); addWindowListener(this); graphix = new JPanel(new GridBagLayout()); graphix.setLayout(new BoxLayout(graphix, BoxLayout.PAGE_AXIS)); mb = new JMenuBar(); JScrollPane scroller = new JScrollPane(graphix, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); // calculating the size of the application-window as well as of all // components, that depend on the size of the window Toolkit kit = Toolkit.getDefaultToolkit(); int appWidth = kit.getScreenSize().width * 3 / 4; int appHeight = kit.getScreenSize().height * 3 / 4; scroller.setPreferredSize(new Dimension(appWidth, appHeight)); getContentPane().add(scroller); maxPlotsPerRow = 1; while ((maxPlotsPerRow + 1) * PLOT_WIDTH < appWidth) { maxPlotsPerRow++; } log.warn("Creating the visualization..."); mb.add(new JMenu("File")); JMenu met = new JMenu("Available Metrics"); met.setEnabled(false); mb.add(met); setJMenuBar(mb); }
From source file:InternalFrameEventDemo.java
protected void createDisplayWindow() { JButton b1 = new JButton("Show internal frame"); b1.setActionCommand(SHOW);/*ww w . j a v a 2s .c o m*/ b1.addActionListener(this); JButton b2 = new JButton("Clear event info"); b2.setActionCommand(CLEAR); b2.addActionListener(this); display = new JTextArea(3, 30); display.setEditable(false); JScrollPane textScroller = new JScrollPane(display); //Have to supply a preferred size, or else the scroll //area will try to stay as large as the text area. textScroller.setPreferredSize(new Dimension(200, 75)); textScroller.setMinimumSize(new Dimension(10, 10)); displayWindow = new JInternalFrame("Event Watcher", true, //resizable false, //not closable false, //not maximizable true); //iconifiable JPanel contentPane = new JPanel(); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); b1.setAlignmentX(CENTER_ALIGNMENT); contentPane.add(b1); contentPane.add(Box.createRigidArea(new Dimension(0, 5))); contentPane.add(textScroller); contentPane.add(Box.createRigidArea(new Dimension(0, 5))); b2.setAlignmentX(CENTER_ALIGNMENT); contentPane.add(b2); displayWindow.setContentPane(contentPane); displayWindow.pack(); displayWindow.setVisible(true); }
From source file:components.ConversionPanel.java
ConversionPanel(Converter myController, String myTitle, Unit[] myUnits, ConverterRangeModel myModel) { if (MULTICOLORED) { setOpaque(true);/*w w w . ja v a2 s. c o m*/ setBackground(new Color(0, 255, 255)); } setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(myTitle), BorderFactory.createEmptyBorder(5, 5, 5, 5))); //Save arguments in instance variables. controller = myController; units = myUnits; title = myTitle; sliderModel = myModel; //Create the text field format, and then the text field. numberFormat = NumberFormat.getNumberInstance(); numberFormat.setMaximumFractionDigits(2); NumberFormatter formatter = new NumberFormatter(numberFormat); formatter.setAllowsInvalid(false); formatter.setCommitsOnValidEdit(true);//seems to be a no-op -- //aha -- it changes the value property but doesn't cause the result to //be parsed (that happens on focus loss/return, I think). // textField = new JFormattedTextField(formatter); textField.setColumns(10); textField.setValue(new Double(sliderModel.getDoubleValue())); textField.addPropertyChangeListener(this); //Add the combo box. unitChooser = new JComboBox(); for (int i = 0; i < units.length; i++) { //Populate it. unitChooser.addItem(units[i].description); } unitChooser.setSelectedIndex(0); sliderModel.setMultiplier(units[0].multiplier); unitChooser.addActionListener(this); //Add the slider. slider = new JSlider(sliderModel); sliderModel.addChangeListener(this); //Make the text field/slider group a fixed size //to make stacked ConversionPanels nicely aligned. JPanel unitGroup = new JPanel() { public Dimension getMinimumSize() { return getPreferredSize(); } public Dimension getPreferredSize() { return new Dimension(150, super.getPreferredSize().height); } public Dimension getMaximumSize() { return getPreferredSize(); } }; unitGroup.setLayout(new BoxLayout(unitGroup, BoxLayout.PAGE_AXIS)); if (MULTICOLORED) { unitGroup.setOpaque(true); unitGroup.setBackground(new Color(0, 0, 255)); } unitGroup.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); unitGroup.add(textField); unitGroup.add(slider); //Create a subpanel so the combo box isn't too tall //and is sufficiently wide. JPanel chooserPanel = new JPanel(); chooserPanel.setLayout(new BoxLayout(chooserPanel, BoxLayout.PAGE_AXIS)); if (MULTICOLORED) { chooserPanel.setOpaque(true); chooserPanel.setBackground(new Color(255, 0, 255)); } chooserPanel.add(unitChooser); chooserPanel.add(Box.createHorizontalStrut(100)); //Put everything together. setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); add(unitGroup); add(chooserPanel); unitGroup.setAlignmentY(TOP_ALIGNMENT); chooserPanel.setAlignmentY(TOP_ALIGNMENT); }
From source file:net.chaosserver.timelord.swingui.CommonTaskPanel.java
/** * The main constructor to setup the display. * * @param timelordData the data object being displayed. * @param dateDisplayed the date to be displayed. * @param tasknameFilter a filter string for the tasks displayed * @see #setDateDisplayed// w ww . j a v a 2s .c om */ public CommonTaskPanel(TimelordData timelordData, Date dateDisplayed, String tasknameFilter) { setTimelordData(timelordData); setTimelordDayView(new TimelordDayView(timelordData, dateDisplayed)); setDateDisplayed(dateDisplayed); this.tasknameFilter = tasknameFilter; setLayout(new BorderLayout()); add(buildSearchPanel(), BorderLayout.NORTH); summaryPanel = new SummaryPanel(getTimelordDayView(), getDateDisplayed()); add(summaryPanel, BorderLayout.SOUTH); commonTaskPanel = new JPanel(); commonTaskPanel.setLayout(new BoxLayout(commonTaskPanel, BoxLayout.PAGE_AXIS)); JPanel packingPanel = new JPanel(); packingPanel.setLayout(new BorderLayout()); packingPanel.add(commonTaskPanel, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(packingPanel); buildTaskList(); add(scrollPane, BorderLayout.CENTER); popupMenu = new CommonTaskPopupMenu(); popupMenu.addActionListener(this); commonTaskPanel.addMouseListener(new PopupListener()); }
From source file:Converter.java
/** * Create the ConversionPanels (one for metric, another for U.S.). I used * "U.S." because although Imperial and U.S. distance measurements are the * same, this program could be extended to include volume measurements, which * aren't the same./*w ww . ja va2 s . c o m*/ */ public Converter() { // Create Unit objects for metric distances, and then // instantiate a ConversionPanel with these Units. metricDistances[0] = new Unit("Centimeters", 0.01); metricDistances[1] = new Unit("Meters", 1.0); metricDistances[2] = new Unit("Kilometers", 1000.0); metricPanel = new ConversionPanel(this, "Metric System", metricDistances, dataModel); // Create Unit objects for U.S. distances, and then // instantiate a ConversionPanel with these Units. usaDistances[0] = new Unit("Inches", 0.0254); usaDistances[1] = new Unit("Feet", 0.305); usaDistances[2] = new Unit("Yards", 0.914); usaDistances[3] = new Unit("Miles", 1613.0); usaPanel = new ConversionPanel(this, "U.S. System", usaDistances, new FollowerRangeModel(dataModel)); // Create a JPanel, and add the ConversionPanels to it. mainPane = new JPanel(); mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.PAGE_AXIS)); if (MULTICOLORED) { mainPane.setOpaque(true); mainPane.setBackground(new Color(255, 0, 0)); } mainPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mainPane.add(Box.createRigidArea(new Dimension(0, 5))); mainPane.add(metricPanel); mainPane.add(Box.createRigidArea(new Dimension(0, 5))); mainPane.add(usaPanel); mainPane.add(Box.createGlue()); resetMaxValues(true); }
From source file:flexflux.analyses.result.TDRFBAResult.java
public void plot() { JPanel panel = new JPanel(); JScrollPane sp = new JScrollPane(panel); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); // one chart by entity Color[] colors = new Color[] { Color.RED, Color.GREEN, Color.BLUE }; int index = 0; for (String s : entities) { XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries series = new XYSeries(s); for (Double time : times) { series.add(time, resultMap.get(time).get(s)); }/* w w w . ja v a 2 s. c om*/ final JFreeChart chart = ChartFactory.createXYLineChart(s, // chart // title "Time (h)", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.GRAY); plot.setDomainGridlinePaint(Color.GRAY); plot.getRenderer().setSeriesPaint(0, colors[index % colors.length]); index++; ChartPanel chartPanel = new ChartPanel(chart); dataset.addSeries(series); panel.add(chartPanel); panel.add(new JSeparator()); } Dimension d = panel.getComponent(0).getPreferredSize(); d.height *= 2; sp.getViewport().setPreferredSize(d); JFrame frame = new JFrame("Time-dependant FBA results"); frame.add(sp); frame.pack(); RefineryUtilities.centerFrameOnScreen(frame); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); }
From source file:org.monome.pages.AbletonClipSkipperPage.java
public JPanel getPanel() { if (this.panel != null) { return this.panel; }//w w w . j a va 2 s . co m JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); panel.setPreferredSize(new java.awt.Dimension(464, 156)); pageNameLBL = new JLabel("Page " + (this.index + 1) + ": Ableton Clip Skipper"); panel.add(pageNameLBL); refreshButton.setText("Refresh from Ableton"); refreshButton.addActionListener(this); panel.add(refreshButton); this.panel = panel; return panel; }