List of usage examples for javax.swing BoxLayout X_AXIS
int X_AXIS
To view the source code for javax.swing BoxLayout X_AXIS.
Click Source Link
From source file:lu.lippmann.cdb.ext.hydviga.ui.GapsOverviewPanel.java
/** * Constructor.//ww w. j av a 2 s.c o m */ public GapsOverviewPanel(final AbstractTabView atv, final StationsDataProvider gcp) { this.atv = atv; this.gcp = gcp; this.jxp = new JXPanel(); this.jxp.setLayout(new GridLayout(2, 1)); final JXPanel highPanel = new JXPanel(); highPanel.setLayout(new BoxLayout(highPanel, BoxLayout.X_AXIS)); this.jxp.add(highPanel); this.tablePanel = new JXPanel(); this.tablePanel.setLayout(new BorderLayout()); highPanel.add(this.tablePanel); this.geomapPanel = new JXPanel(); this.geomapPanel.add(gcp.getMapPanel(new ArrayList<String>(), new ArrayList<String>(), false)); highPanel.add(this.geomapPanel); this.visualOverviewPanel = new JXPanel(); this.visualOverviewPanel.setLayout(new BorderLayout()); this.jxp.add(this.visualOverviewPanel); }
From source file:ec.display.chart.StatisticsChartPaneTab.java
/** * This method initializes jPanel /*from w w w .j a va 2 s . c o m*/ * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { jPanel = new JPanel(); jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.X_AXIS)); jPanel.add(Box.createHorizontalGlue()); jPanel.add(getPrintButton(), null); jPanel.add(getCloseButton(), null); } return jPanel; }
From source file:netcap.JcaptureConfiguration.java
private void initGUI() { Container container = getContentPane(); container.setLayout(ViewModules.createBoxLayout(container, BoxLayout.X_AXIS)); try {//from w w w . j a v a 2s.c o m JPanel jPanel_west = ViewModules.createSimplePanel(null, -1f, -1f, BoxLayout.Y_AXIS); JPanel netPanel = getNetDevicesPanel(); checkBox = getPromiscCheckBox(); JPanel filterPanel = getProtocolFilterPanel(); ViewModules.addComponent(jPanel_west, netPanel, checkBox, filterPanel); JPanel jPanel_east = ViewModules.createSimplePanel(null, -1f, -1f, BoxLayout.Y_AXIS); JPanel caplenPanel = getCaplenPanel(); JPanel buttonPanel = getOkCanelPanel(); ViewModules.addComponent(jPanel_east, caplenPanel, buttonPanel); container.add(jPanel_west); container.add(jPanel_east); pack(); } catch (Exception e) { e.printStackTrace(); } }
From source file:RGBAColourChooser.java
/** * Constructs a new RGBAColourChooser/* ww w . j av a2 s . c o m*/ */ public RGBAColourChooser() { super(BoxLayout.X_AXIS); Box rb = new Box(BoxLayout.X_AXIS); rb.add(redLabel); rb.add(redSlider); Box gb = new Box(BoxLayout.X_AXIS); gb.add(greenLabel); gb.add(greenSlider); Box bb = new Box(BoxLayout.X_AXIS); bb.add(blueLabel); bb.add(blueSlider); Box ab = new Box(BoxLayout.X_AXIS); ab.add(alphaLabel); ab.add(alphaSlider); redSlider.setValue(oldValue.getRed()); greenSlider.setValue(oldValue.getGreen()); blueSlider.setValue(oldValue.getBlue()); alphaSlider.setValue(oldValue.getAlpha()); redSlider.addChangeListener(this); greenSlider.addChangeListener(this); blueSlider.addChangeListener(this); alphaSlider.addChangeListener(this); redSlider.setToolTipText(String.valueOf(redSlider.getValue())); greenSlider.setToolTipText(String.valueOf(greenSlider.getValue())); blueSlider.setToolTipText(String.valueOf(blueSlider.getValue())); alphaSlider.setToolTipText(String.valueOf(alphaSlider.getValue())); sliderBox = new Box(BoxLayout.Y_AXIS); sliderBox.add(rb); sliderBox.add(gb); sliderBox.add(bb); sliderBox.add(ab); add(previewer); add(Box.createHorizontalStrut(5)); add(sliderBox); }
From source file:MainClass.java
public MainClass() { JToggleButton tog = new JToggleButton("ToggleButton"); JCheckBox cb = new JCheckBox("CheckBox"); JRadioButton radio = new JRadioButton("RadioButton"); SimpleListener sl = new SimpleListener(); tog.addActionListener(sl);//from w ww. j av a 2s. c o m cb.addActionListener(sl); radio.addActionListener(sl); Box buttonBox = new Box(BoxLayout.Y_AXIS); buttonBox.add(tog); buttonBox.add(cb); buttonBox.add(radio); undoButton.setEnabled(false); redoButton.setEnabled(false); undoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { edit.undo(); } catch (CannotUndoException ex) { ex.printStackTrace(); } finally { undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } } }); redoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { edit.redo(); } catch (CannotRedoException ex) { ex.printStackTrace(); } finally { undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } } }); Box undoRedoBox = new Box(BoxLayout.X_AXIS); undoRedoBox.add(Box.createGlue()); undoRedoBox.add(undoButton); undoRedoBox.add(Box.createHorizontalStrut(2)); undoRedoBox.add(redoButton); undoRedoBox.add(Box.createGlue()); Container content = getContentPane(); content.setLayout(new BorderLayout()); content.add(buttonBox, BorderLayout.CENTER); content.add(undoRedoBox, BorderLayout.SOUTH); setSize(400, 150); }
From source file:gate.termraider.gui.HyponymyDebugger.java
private void makeControlPanel() { goButton = new JButton("generate debugging table"); goButton.setToolTipText("This may take some time!"); goButton.addActionListener(new HDGoButtonActionListener(this)); controlPanel = new JPanel(); controlPanel.setLayout(new BoxLayout(controlPanel, BoxLayout.X_AXIS)); controlPanel.add(Box.createHorizontalGlue()); controlPanel.add(goButton);// www.jav a 2s . co m controlPanel.add(Box.createHorizontalGlue()); }
From source file:com.limegroup.gnutella.gui.init.LanguagePanel.java
/** * Constructs a LanguagePanel that will notify the given listener when the * language changes.//from w ww. ja va 2s .c o m */ public LanguagePanel(ActionListener actionListener) { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); this.actionListener = actionListener; this.languageLabel = new JLabel(); languageOptions = new JComboBox<Object>(); Font font = new Font("Dialog", Font.PLAIN, 11); languageOptions.setFont(font); Locale[] locales = LanguageUtils.getLocales(font); languageOptions.setModel(new DefaultComboBoxModel<Object>(locales)); languageOptions.setRenderer(LanguageFlagFactory.getListRenderer()); Locale locale = guessLocale(locales); languageOptions.setSelectedItem(locale); applySettings(false); // It is important that the listener is added after the selected item // is set. Otherwise the listener will call methods that are not ready // to be called at this point. languageOptions.addItemListener(new StateListener()); add(languageLabel); add(Box.createHorizontalStrut(5)); add(languageOptions); }
From source file:net.sf.firemox.ui.wizard.About.java
/** * Creates a new instance of About <br> * /* w w w . ja v a2 s . c o m*/ * @param parent */ public About(JFrame parent) { super(LanguageManager.getString("wiz_about.title"), LanguageManager.getString("wiz_about.description"), "mp64.gif", LanguageManager.getString("close"), 420, 620); JPanel thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setMaximumSize(new Dimension(32767, 26)); thanksPanel.setOpaque(false); JLabel jLabel5 = new JLabel(LanguageManager.getString("version") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLabel(IdConst.VERSION); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); JPanel thanksPanelLeft = new JPanel(new FlowLayout(FlowLayout.LEADING)); thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS)); thanksPanelLeft.setMaximumSize(new Dimension(100, 2000)); thanksPanelLeft.setMinimumSize(new Dimension(100, 16)); jLabel5 = new JLabel(LanguageManager.getString("thanks") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanelLeft.add(jLabel5); thanksPanel.add(thanksPanelLeft); thanksPanelLeft = new JPanel(); thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS)); StringBuilder contributors = new StringBuilder(); addContributor(contributors, "Fabrice Daugan", "developper", "france"); addContributor(contributors, "Hoani Cross", "developper", "frenchpolynesia"); addContributor(contributors, "nico100", "graphist", "france"); addContributor(contributors, "seingalt_tm", "graphist", "france"); addContributor(contributors, "surtur2", "tester", null); addContributor(contributors, "Jan Blaha", "developper", "cz"); addContributor(contributors, "Tureba", "developper", "brazil"); addContributor(contributors, "hakvf", "tester", "france"); addContributor(contributors, "Stefano \"Kismet\" Lenzi", "developper", "italian"); jLabel5 = new JLabel(contributors.toString()); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.LEFT); thanksPanelLeft.add(jLabel5); jLabel5 = new JLink("http://obsidiurne.free.fr", "morgil has designed the splash screen"); jLabel5.setFont(MToolKit.defaultFont); thanksPanelLeft.add(jLabel5); thanksPanel.add(thanksPanelLeft); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setMaximumSize(new Dimension(32767, 26)); thanksPanel.setOpaque(false); JLabel blanklbl = new JLabel(); blanklbl.setHorizontalAlignment(SwingConstants.RIGHT); blanklbl.setMaximumSize(new Dimension(100, 16)); blanklbl.setMinimumSize(new Dimension(100, 16)); blanklbl.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(blanklbl); jLabel5 = new JLink( "http://sourceforge.net/tracker/?func=add&group_id=" + IdConst.PROJECT_ID + "&atid=601043", LanguageManager.getString("joindev")); jLabel5.setFont(MToolKit.defaultFont); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); jLabel5 = new JLabel(LanguageManager.getString("projecthome") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLink(IdConst.MAIN_PAGE, IdConst.MAIN_PAGE); jLabel5.setFont(MToolKit.defaultFont); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); // forum francais thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); jLabel5 = new JLabel(LanguageManager.getString("othersites") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLink("http://www.Firemox.fr.st", UIHelper.getIcon("mpfrsml.gif"), SwingConstants.LEFT); jLabel5.setToolTipText(LanguageManager.getString("frenchforum.tooltip")); thanksPanel.add(jLabel5); jLabel5 = new JLabel(); jLabel5.setMaximumSize(new Dimension(1000, 16)); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); JTextArea disclaimer = new JTextArea(); disclaimer.setEditable(false); disclaimer.setLineWrap(true); disclaimer.setWrapStyleWord(true); disclaimer.setAutoscrolls(true); disclaimer.setTabSize(2); disclaimer.setFont(new Font("Arial", 0, 10)); // Then try and read it locally BufferedReader inGPL = null; try { inGPL = new BufferedReader(new InputStreamReader(MToolKit.getResourceAsStream(IdConst.FILE_LICENSE))); disclaimer.read(inGPL, ""); } catch (IOException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(inGPL); } JScrollPane disclaimerSPanel = new JScrollPane(); disclaimerSPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); MToolKit.addOverlay(disclaimerSPanel); disclaimerSPanel.setViewportView(disclaimer); gameParamPanel.add(disclaimerSPanel); }
From source file:com.opendoorlogistics.speedregions.excelshp.app.FileBrowserPanel.java
public FileBrowserPanel(int indentWidth, String label, String initialFilename, final Consumer<String> filenameChangeListener, final boolean directoriesOnly, final String browserApproveButtonText, final FileFilter... fileFilters) { textField = createTextField(initialFilename, filenameChangeListener); // add browser button browseButton = createBrowseButton(directoriesOnly, browserApproveButtonText, textField, fileFilters); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); if (indentWidth > 0) { add(Box.createRigidArea(new Dimension(indentWidth, 1))); }//from ww w . java 2 s.co m if (label != null) { this.label = new JLabel(label); add(this.label); } else { this.label = null; } add(textField); add(browseButton); }
From source file:ExpenseReport.java
public ExpenseReport() { super("Expense Report"); setSize(570, 200);//from w ww . j a v a 2s. c om m_data = new ExpenseReportData(this); m_table = new JTable(); m_table.setAutoCreateColumnsFromModel(false); m_table.setModel(m_data); m_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); for (int k = 0; k < ExpenseReportData.m_columns.length; k++) { TableCellRenderer renderer; if (k == ExpenseReportData.COL_APPROVED) renderer = new CheckCellRenderer(); else { DefaultTableCellRenderer textRenderer = new DefaultTableCellRenderer(); textRenderer.setHorizontalAlignment(ExpenseReportData.m_columns[k].m_alignment); renderer = textRenderer; } TableCellEditor editor; if (k == ExpenseReportData.COL_CATEGORY) editor = new DefaultCellEditor(new JComboBox(ExpenseReportData.CATEGORIES)); else if (k == ExpenseReportData.COL_APPROVED) editor = new DefaultCellEditor(new JCheckBox()); else editor = new DefaultCellEditor(new JTextField()); TableColumn column = new TableColumn(k, ExpenseReportData.m_columns[k].m_width, renderer, editor); m_table.addColumn(column); } JTableHeader header = m_table.getTableHeader(); header.setUpdateTableInRealTime(false); JScrollPane ps = new JScrollPane(); ps.setSize(550, 150); ps.getViewport().add(m_table); getContentPane().add(ps, BorderLayout.CENTER); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); ImageIcon penny = new ImageIcon("penny.gif"); m_title = new JLabel("Total: $", penny, JButton.LEFT); m_title.setForeground(Color.black); m_title.setAlignmentY(0.5f); p.add(m_title); p.add(Box.createHorizontalGlue()); JButton bt = new JButton("Insert before"); bt.setMnemonic('b'); bt.setAlignmentY(0.5f); ActionListener lst = new ActionListener() { public void actionPerformed(ActionEvent e) { int row = m_table.getSelectedRow(); m_data.insert(row); m_table.tableChanged( new TableModelEvent(m_data, row, row, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT)); m_table.repaint(); } }; bt.addActionListener(lst); p.add(bt); bt = new JButton("Insert after"); bt.setMnemonic('a'); bt.setAlignmentY(0.5f); lst = new ActionListener() { public void actionPerformed(ActionEvent e) { int row = m_table.getSelectedRow(); m_data.insert(row + 1); m_table.tableChanged(new TableModelEvent(m_data, row + 1, row + 1, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT)); m_table.repaint(); } }; bt.addActionListener(lst); p.add(bt); bt = new JButton("Delete row"); bt.setMnemonic('d'); bt.setAlignmentY(0.5f); lst = new ActionListener() { public void actionPerformed(ActionEvent e) { int row = m_table.getSelectedRow(); if (m_data.delete(row)) { m_table.tableChanged(new TableModelEvent(m_data, row, row, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT)); m_table.repaint(); calcTotal(); } } }; bt.addActionListener(lst); p.add(bt); getContentPane().add(p, BorderLayout.SOUTH); calcTotal(); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); setVisible(true); }