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:org.kineticsystem.commons.data.view.JDataNavigator.java
/** GUI initialization. */ private void initComponents() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); moveBackButton = new JActionButton(); moveForwardButton = new JActionButton(); moveFirstButton = new JActionButton(); moveLastButton = new JActionButton(); createButton = new JActionButton(); modifyConfirmButton = new JActionButton(); deleteCancelButton = new JActionButton(); syncronizeButton = new JActionButton(); reloadButton = new JActionButton(); Insets insets = new Insets(2, 2, 2, 2); // Hide button labels. moveBackButton.putClientProperty("hideActionText", Boolean.TRUE); moveForwardButton.putClientProperty("hideActionText", Boolean.TRUE); moveFirstButton.putClientProperty("hideActionText", Boolean.TRUE); moveLastButton.putClientProperty("hideActionText", Boolean.TRUE); createButton.putClientProperty("hideActionText", Boolean.TRUE); modifyConfirmButton.putClientProperty("hideActionText", Boolean.TRUE); deleteCancelButton.putClientProperty("hideActionText", Boolean.TRUE); syncronizeButton.putClientProperty("hideActionText", Boolean.TRUE); reloadButton.putClientProperty("hideActionText", Boolean.TRUE); moveBackButton.setAction(moveBackAction); moveForwardButton.setAction(moveForwardAction); moveFirstButton.setAction(moveFirstAction); moveLastButton.setAction(moveLastAction); createButton.setAction(createAction); modifyConfirmButton.setActions(new Action[] { modifyAction, confirmAction }); deleteCancelButton.setActions(new Action[] { deleteAction, cancelAction }); syncronizeButton.setAction(synchronizeAction); reloadButton.setAction(reloadAction); moveBackButton.setMargin(insets);//from ww w. j a va 2s . c o m moveForwardButton.setMargin(insets); moveFirstButton.setMargin(insets); moveLastButton.setMargin(insets); createButton.setMargin(insets); modifyConfirmButton.setMargin(insets); deleteCancelButton.setMargin(insets); syncronizeButton.setMargin(insets); reloadButton.setMargin(insets); renderPane = new JDataNavigatorDefaultRenderer(); dataNavigator.addEditorListener(renderPane); dataNavigator.getNavigator().addNavigatorListener(renderPane); infoPane = new JPanel(new BorderLayout()); infoPane.add(renderPane, BorderLayout.CENTER); add(moveFirstButton); add(moveBackButton); add(infoPane); add(moveForwardButton); add(moveLastButton); add(createButton); add(modifyConfirmButton); add(deleteCancelButton); //add(syncronizeButton); //add(reloadButton); }
From source file:org.kuali.student.repository.viewer.GitGraphDetailsPanel.java
private JPanel addSubPanel(JLabel label, JComponent component) { JPanel subPanel = new JPanel(); subPanel.setLayout(new BoxLayout(subPanel, BoxLayout.X_AXIS)); subPanel.add(label);/* ww w .ja v a 2 s. c o m*/ subPanel.add(component); add(subPanel); return subPanel; }
From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java
private JPanel createLocationsPanel() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 0.5;/*from w w w. j av a 2s .c o m*/ JPanel folderPanel = new JPanel(); folderPanel.setLayout(new BoxLayout(folderPanel, BoxLayout.X_AXIS)); folderPanel.setBorder(BorderFactory.createTitledBorder("Working folder")); folderField = new JTextField(); folderField.setText((new File("").getAbsolutePath())); folderField.setToolTipText("The folder where all output will be written"); folderPanel.add(folderField); JButton pickButton = new JButton("Pick folder"); pickButton.setToolTipText("Pick a different working folder"); folderPanel.add(pickButton); pickButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickFolder(); } }); componentsToDisableWhenRunning.add(pickButton); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; panel.add(folderPanel, c); JPanel sourcePanel = new JPanel(); sourcePanel.setLayout(new GridLayout(0, 2)); sourcePanel.setBorder(BorderFactory.createTitledBorder("Source data location")); sourcePanel.add(new JLabel("Data type")); sourceType = new JComboBox<String>(new String[] { "Delimited text files", "MySQL", "Oracle", "SQL Server", "PostgreSQL", "MS Access", "PDW", "Redshift", "Teradata" }); sourceType.setToolTipText("Select the type of source data available"); sourceType.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent arg0) { sourceIsFiles = arg0.getItem().toString().equals("Delimited text files"); sourceServerField.setEnabled(!sourceIsFiles); sourceUserField.setEnabled(!sourceIsFiles); sourcePasswordField.setEnabled(!sourceIsFiles); sourceDatabaseField.setEnabled(!sourceIsFiles); sourceDelimiterField.setEnabled(sourceIsFiles); addAllButton.setEnabled(!sourceIsFiles); if (!sourceIsFiles && arg0.getItem().toString().equals("Oracle")) { sourceServerField.setToolTipText( "For Oracle servers this field contains the SID, servicename, and optionally the port: '<host>/<sid>', '<host>:<port>/<sid>', '<host>/<service name>', or '<host>:<port>/<service name>'"); sourceUserField.setToolTipText( "For Oracle servers this field contains the name of the user used to log in"); sourcePasswordField.setToolTipText( "For Oracle servers this field contains the password corresponding to the user"); sourceDatabaseField.setToolTipText( "For Oracle servers this field contains the schema (i.e. 'user' in Oracle terms) containing the source tables"); } else if (!sourceIsFiles && arg0.getItem().toString().equals("PostgreSQL")) { sourceServerField.setToolTipText( "For PostgreSQL servers this field contains the host name and database name (<host>/<database>)"); sourceUserField.setToolTipText("The user used to log in to the server"); sourcePasswordField.setToolTipText("The password used to log in to the server"); sourceDatabaseField.setToolTipText( "For PostgreSQL servers this field contains the schema containing the source tables"); } else if (!sourceIsFiles) { sourceServerField .setToolTipText("This field contains the name or IP address of the database server"); if (arg0.getItem().toString().equals("SQL Server")) sourceUserField.setToolTipText( "The user used to log in to the server. Optionally, the domain can be specified as <domain>/<user> (e.g. 'MyDomain/Joe')"); else sourceUserField.setToolTipText("The user used to log in to the server"); sourcePasswordField.setToolTipText("The password used to log in to the server"); sourceDatabaseField.setToolTipText("The name of the database containing the source tables"); } } }); sourcePanel.add(sourceType); sourcePanel.add(new JLabel("Server location")); sourceServerField = new JTextField("127.0.0.1"); sourceServerField.setEnabled(false); sourcePanel.add(sourceServerField); sourcePanel.add(new JLabel("User name")); sourceUserField = new JTextField(""); sourceUserField.setEnabled(false); sourcePanel.add(sourceUserField); sourcePanel.add(new JLabel("Password")); sourcePasswordField = new JPasswordField(""); sourcePasswordField.setEnabled(false); sourcePanel.add(sourcePasswordField); sourcePanel.add(new JLabel("Database name")); sourceDatabaseField = new JTextField(""); sourceDatabaseField.setEnabled(false); sourcePanel.add(sourceDatabaseField); sourcePanel.add(new JLabel("Delimiter")); sourceDelimiterField = new JTextField(","); sourceDelimiterField.setToolTipText("The delimiter that separates values. Enter 'tab' for tab."); sourcePanel.add(sourceDelimiterField); c.gridx = 0; c.gridy = 1; c.gridwidth = 1; panel.add(sourcePanel, c); JPanel testConnectionButtonPanel = new JPanel(); testConnectionButtonPanel.setLayout(new BoxLayout(testConnectionButtonPanel, BoxLayout.X_AXIS)); testConnectionButtonPanel.add(Box.createHorizontalGlue()); JButton testConnectionButton = new JButton("Test connection"); testConnectionButton.setBackground(new Color(151, 220, 141)); testConnectionButton.setToolTipText("Test the connection"); testConnectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { testConnection(getSourceDbSettings()); } }); componentsToDisableWhenRunning.add(testConnectionButton); testConnectionButtonPanel.add(testConnectionButton); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; panel.add(testConnectionButtonPanel, c); return panel; }
From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java
private JPanel createScanPanel() { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JPanel tablePanel = new JPanel(); tablePanel.setLayout(new BorderLayout()); tablePanel.setBorder(new TitledBorder("Tables to scan")); tableList = new JList<String>(); tableList.setToolTipText("Specify the tables (or CSV files) to be scanned here"); tablePanel.add(new JScrollPane(tableList), BorderLayout.CENTER); JPanel tableButtonPanel = new JPanel(); tableButtonPanel.setLayout(new GridLayout(3, 1)); addAllButton = new JButton("Add all in DB"); addAllButton.setToolTipText("Add all tables in the database"); addAllButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addAllTables();//from ww w. j a v a 2 s. co m } }); addAllButton.setEnabled(false); tableButtonPanel.add(addAllButton); JButton addButton = new JButton("Add"); addButton.setToolTipText("Add tables to list"); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickTables(); } }); tableButtonPanel.add(addButton); JButton removeButton = new JButton("Remove"); removeButton.setToolTipText("Remove tables from list"); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removeTables(); } }); tableButtonPanel.add(removeButton); tablePanel.add(tableButtonPanel, BorderLayout.EAST); panel.add(tablePanel, BorderLayout.CENTER); JPanel southPanel = new JPanel(); southPanel.setLayout(new BoxLayout(southPanel, BoxLayout.Y_AXIS)); JPanel scanOptionsPanel = new JPanel(); scanOptionsPanel.setLayout(new BoxLayout(scanOptionsPanel, BoxLayout.X_AXIS)); scanValueScan = new JCheckBox("Scan field values", true); scanValueScan.setToolTipText("Include a frequency count of field values in the scan report"); scanValueScan.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { scanMinCellCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); scanRowCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); scanValuesCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); } }); scanOptionsPanel.add(scanValueScan); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Min cell count ")); scanMinCellCount = new JSpinner(); scanMinCellCount.setValue(5); scanMinCellCount.setToolTipText("Minimum frequency for a field value to be included in the report"); scanOptionsPanel.add(scanMinCellCount); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Max distinct values ")); scanValuesCount = new JComboBox<String>(new String[] { "100", "1,000", "10,000" }); scanValuesCount.setSelectedIndex(1); scanValuesCount.setToolTipText("Maximum number of distinct values per field to be reported"); scanOptionsPanel.add(scanValuesCount); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Rows per table ")); scanRowCount = new JComboBox<String>(new String[] { "100,000", "500,000", "1 million", "all" }); scanRowCount.setSelectedIndex(0); scanRowCount.setToolTipText("Maximum number of rows per table to be scanned for field values"); scanOptionsPanel.add(scanRowCount); southPanel.add(scanOptionsPanel); southPanel.add(Box.createVerticalStrut(3)); JPanel scanButtonPanel = new JPanel(); scanButtonPanel.setLayout(new BoxLayout(scanButtonPanel, BoxLayout.X_AXIS)); scanButtonPanel.add(Box.createHorizontalGlue()); JButton scanButton = new JButton("Scan tables"); scanButton.setBackground(new Color(151, 220, 141)); scanButton.setToolTipText("Scan the selected tables"); scanButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scanRun(); } }); componentsToDisableWhenRunning.add(scanButton); scanButtonPanel.add(scanButton); southPanel.add(scanButtonPanel); panel.add(southPanel, BorderLayout.SOUTH); return panel; }
From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java
private JPanel createFakeDataPanel() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 0.5;//w w w. ja v a2s.c o m JPanel folderPanel = new JPanel(); folderPanel.setLayout(new BoxLayout(folderPanel, BoxLayout.X_AXIS)); folderPanel.setBorder(BorderFactory.createTitledBorder("Scan report file")); scanReportFileField = new JTextField(); scanReportFileField.setText((new File("ScanReport.xlsx").getAbsolutePath())); scanReportFileField.setToolTipText( "The path to the scan report that will be used as a template to generate the fake data"); folderPanel.add(scanReportFileField); JButton pickButton = new JButton("Pick file"); pickButton.setToolTipText("Pick a scan report file"); folderPanel.add(pickButton); pickButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickScanReportFile(); } }); componentsToDisableWhenRunning.add(pickButton); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; panel.add(folderPanel, c); JPanel targetPanel = new JPanel(); targetPanel.setLayout(new GridLayout(0, 2)); targetPanel.setBorder(BorderFactory.createTitledBorder("Target data location")); targetPanel.add(new JLabel("Data type")); targetType = new JComboBox<String>( new String[] { "Delimited text files", "MySQL", "Oracle", "SQL Server", "PostgreSQL" }); // targetType = new JComboBox(new String[] { "Delimited text files", "MySQL" }); targetType.setToolTipText("Select the type of source data available"); targetType.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent arg0) { targetIsFiles = arg0.getItem().toString().equals("Delimited text files"); targetServerField.setEnabled(!targetIsFiles); targetUserField.setEnabled(!targetIsFiles); targetPasswordField.setEnabled(!targetIsFiles); targetDatabaseField.setEnabled(!targetIsFiles); targetCSVFormat.setEnabled(targetIsFiles); if (!targetIsFiles && arg0.getItem().toString().equals("Oracle")) { targetServerField.setToolTipText( "For Oracle servers this field contains the SID, servicename, and optionally the port: '<host>/<sid>', '<host>:<port>/<sid>', '<host>/<service name>', or '<host>:<port>/<service name>'"); targetUserField.setToolTipText( "For Oracle servers this field contains the name of the user used to log in"); targetPasswordField.setToolTipText( "For Oracle servers this field contains the password corresponding to the user"); targetDatabaseField.setToolTipText( "For Oracle servers this field contains the schema (i.e. 'user' in Oracle terms) containing the source tables"); } else if (!targetIsFiles && arg0.getItem().toString().equals("PostgreSQL")) { targetServerField.setToolTipText( "For PostgreSQL servers this field contains the host name and database name (<host>/<database>)"); targetUserField.setToolTipText("The user used to log in to the server"); targetPasswordField.setToolTipText("The password used to log in to the server"); targetDatabaseField.setToolTipText( "For PostgreSQL servers this field contains the schema containing the source tables"); } else if (!targetIsFiles) { targetServerField .setToolTipText("This field contains the name or IP address of the database server"); if (arg0.getItem().toString().equals("SQL Server")) targetUserField.setToolTipText( "The user used to log in to the server. Optionally, the domain can be specified as <domain>/<user> (e.g. 'MyDomain/Joe')"); else targetUserField.setToolTipText("The user used to log in to the server"); targetPasswordField.setToolTipText("The password used to log in to the server"); targetDatabaseField.setToolTipText("The name of the database containing the source tables"); } } }); targetPanel.add(targetType); targetPanel.add(new JLabel("Server location")); targetServerField = new JTextField("127.0.0.1"); targetServerField.setEnabled(false); targetPanel.add(targetServerField); targetPanel.add(new JLabel("User name")); targetUserField = new JTextField(""); targetUserField.setEnabled(false); targetPanel.add(targetUserField); targetPanel.add(new JLabel("Password")); targetPasswordField = new JPasswordField(""); targetPasswordField.setEnabled(false); targetPanel.add(targetPasswordField); targetPanel.add(new JLabel("Database name")); targetDatabaseField = new JTextField(""); targetDatabaseField.setEnabled(false); targetPanel.add(targetDatabaseField); targetPanel.add(new JLabel("CSV Format")); targetCSVFormat = new JComboBox<>(new String[] { "Default (comma, CRLF)", "TDF (tab, CRLF)", "MySQL (tab, LF)", "RFC4180", "Excel CSV" }); targetCSVFormat.setToolTipText("The format of the output"); targetCSVFormat.setEnabled(true); targetPanel.add(targetCSVFormat); c.gridx = 0; c.gridy = 1; c.gridwidth = 1; panel.add(targetPanel, c); JPanel fakeDataButtonPanel = new JPanel(); fakeDataButtonPanel.setLayout(new BoxLayout(fakeDataButtonPanel, BoxLayout.X_AXIS)); fakeDataButtonPanel.add(new JLabel("Max rows per table")); generateRowCount = new JSpinner(); generateRowCount.setValue(10000); fakeDataButtonPanel.add(generateRowCount); fakeDataButtonPanel.add(Box.createHorizontalGlue()); JButton testConnectionButton = new JButton("Test connection"); testConnectionButton.setBackground(new Color(151, 220, 141)); testConnectionButton.setToolTipText("Test the connection"); testConnectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { testConnection(getTargetDbSettings()); } }); componentsToDisableWhenRunning.add(testConnectionButton); fakeDataButtonPanel.add(testConnectionButton); JButton fakeDataButton = new JButton("Generate fake data"); fakeDataButton.setBackground(new Color(151, 220, 141)); fakeDataButton.setToolTipText("Generate fake data based on the scan report"); fakeDataButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { fakeDataRun(); } }); componentsToDisableWhenRunning.add(fakeDataButton); fakeDataButtonPanel.add(fakeDataButton); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; panel.add(fakeDataButtonPanel, c); return panel; }
From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.SearchPanel.java
/** * Builds and lays out the Basic search component. * //from w w w . j a v a2 s . com * @return See above. */ private JPanel buildBasicSearchComp() { basicSearchComp = new JPanel(); basicSearchComp.setBackground(UIUtilities.BACKGROUND_COLOR); UIUtilities.setBoldTitledBorder("Search", basicSearchComp); basicSearchComp.setLayout(new BoxLayout(basicSearchComp, BoxLayout.X_AXIS)); basicSearchComp.add(fullTextArea); basicSearchComp.add(helpBasicButton); return basicSearchComp; }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** * Creates a row./*w w w. j a va 2 s.c om*/ * * @return See above. */ private JPanel initRow() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); return p; }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** Builds and lays out the UI. */ private void buildGUI() { setLayout(new BorderLayout(0, 0)); JPanel p = new JPanel(); p.setBorder(null);/*from w w w .jav a2 s .co m*/ p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(buildQuotaPane()); p.add(table); tabbedPane.add("Files to import", p); tabbedPane.add("Options", buildOptionsPane()); double[][] tablePanelDesign = { { TableLayout.PREFERRED, 10, 5, TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.FILL } }; JPanel tablePanel = new JPanel(new TableLayout(tablePanelDesign)); tablePanel.add(table.buildControls(), "0, 1, LEFT, CENTER"); tablePanel.add(tabbedPane, "2, 1, 3, 1"); int plugin = ImporterAgent.runAsPlugin(); JSplitPane pane; if (plugin == LookupNames.IMAGE_J_IMPORT || plugin == LookupNames.IMAGE_J) { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); JLabel label = UIUtilities.setTextFont("Select where to import the image(s)."); panel.add(UIUtilities.buildComponentPanel(label)); panel.add(locationDialog.getContentPane()); pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel, tablePanel); } else { pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, chooser, tablePanel); } JPanel mainPanel = new JPanel(); double[][] mainPanelDesign = { { TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.FILL } }; mainPanel.setLayout(new TableLayout(mainPanelDesign)); mainPanel.setBackground(UIUtilities.BACKGROUND); mainPanel.add(pane, "0, 1"); this.add(mainPanel, BorderLayout.CENTER); JPanel controls = new JPanel(); controls.setLayout(new BoxLayout(controls, BoxLayout.Y_AXIS)); // Lays out the buttons. JPanel bar = new JPanel(); bar.setLayout(new BoxLayout(bar, BoxLayout.X_AXIS)); bar.add(buildToolBarLeft()); bar.add(buildToolBarRight()); controls.add(new JSeparator()); controls.add(bar); add(controls, BorderLayout.SOUTH); if (JDialog.isDefaultLookAndFeelDecorated()) { boolean supportsWindowDecorations = UIManager.getLookAndFeel().getSupportsWindowDecorations(); if (supportsWindowDecorations) getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG); } }
From source file:org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjSavingDialog.java
/** * Builds and lays out the passed component. * /*from ww w . j a v a2 s . co m*/ * @param comp The component to lay out. * @param text The text displayed in front of the component. * @return See above. */ private JPanel buildRangePanel(JComponent comp, String text) { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(new JLabel(text)); p.add(UIUtilities.buildComponentPanel(comp)); return p; }
From source file:org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjSavingDialog.java
/** * Builds and lays out the pixels type options. * //from w ww . j a va2s .com * @return See above. */ private JPanel buildPixelsTypePanel() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(new JLabel("Data Type: ")); p.add(UIUtilities.buildComponentPanel(pixelsType)); return p; }