List of usage examples for java.awt BorderLayout EAST
String EAST
To view the source code for java.awt BorderLayout EAST.
Click Source Link
From source file:tvbrowser.ui.mainframe.MainFrame.java
public void updateToolbar() { JPanel contentPane = (JPanel) getContentPane(); if (mToolBarPanel != null) { contentPane.remove(mToolBarPanel); }//from ww w. j ava 2 s.com mToolBarModel = DefaultToolBarModel.getInstance(); mToolBar = new ToolBar(mToolBarModel); mToolBar.setOpaque(false); String location = mToolBar.getToolbarLocation(); if (Settings.propIsToolbarVisible.getBoolean()) { if (mToolBarPanel == null) { mToolBarPanel = new JPanel(new BorderLayout()) { public void updateUI() { super.updateUI(); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, getBackground().darker())); } }; addContextMenuMouseListener(mToolBarPanel); mSearchField = new SearchField(); } else { mToolBarPanel.removeAll(); } if (location.compareTo(BorderLayout.NORTH) == 0) { mToolBarPanel.add(MoreButton.wrapToolBar(mToolBar, this), BorderLayout.CENTER); if (Settings.propIsSearchFieldVisible.getBoolean()) { mToolBarPanel.add(mSearchField, BorderLayout.EAST); } } else { mToolBarPanel.add(MoreButton.wrapToolBar(mToolBar, this), BorderLayout.WEST); if (Settings.propIsSearchFieldVisible.getBoolean()) { mToolBarPanel.add(mSearchField, BorderLayout.SOUTH); } } contentPane.add(mToolBarPanel, location); } contentPane.invalidate(); contentPane.updateUI(); }
From source file:SuitaDetails.java
public ParamPanel() { setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153)), "Parameters", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, new Color(0, 0, 0))); setBackground(Color.WHITE);/*from w w w . ja v a 2 s . c om*/ jPanel2 = new JPanel(); jPanel2.setBackground(Color.WHITE); JScrollPane jScrollPane3 = new JScrollPane(jPanel2); jScrollPane3.setBackground(Color.WHITE); jScrollPane3.setBorder(null); jPanel2.setLayout(new BoxLayout(jPanel2, BoxLayout.Y_AXIS)); addpanel = new JPanel(); addpanel.setMaximumSize(new Dimension(32767, 25)); addpanel.setMinimumSize(new Dimension(0, 25)); addpanel.setPreferredSize(new Dimension(50, 25)); addpanel.setLayout(new BorderLayout()); JButton add = new JButton("Add"); add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { ArrayList<Integer> indexpos3 = (ArrayList<Integer>) parent.getPos().clone(); indexpos3.add(new Integer(parent.getSubItemsNr())); Item property = new Item("param", 0, -1, -1, 10, 20, indexpos3); property.setSubItemVisible(false); property.setValue(""); parent.addSubItem(property); Param prop = new Param(parent, property); jPanel2.remove(addpanel); jPanel2.add(prop); jPanel2.add(addpanel); jPanel2.revalidate(); jPanel2.repaint(); } }); addpanel.add(add, BorderLayout.EAST); addpanel.setBackground(Color.WHITE); GroupLayout paramLayout = new GroupLayout(this); this.setLayout(paramLayout); paramLayout.setHorizontalGroup( paramLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane3)); paramLayout.setVerticalGroup( paramLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane3)); }
From source file:org.pentaho.reporting.ui.datasources.jdbc.ui.JdbcDataSourceDialog.java
private JPanel createQueryDetailsPanel() { final JPanel queryNamePanel = new JPanel(new BorderLayout()); queryNamePanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); queryNamePanel.add(new JLabel(Messages.getString("JdbcDataSourceDialog.QueryStringLabel")), BorderLayout.NORTH);/* www . j a v a 2 s. co m*/ queryNamePanel.add(queryNameTextField, BorderLayout.SOUTH); final InvokeQueryDesignerAction queryDesignerAction = new InvokeQueryDesignerAction(); dialogModel.addPropertyChangeListener(queryDesignerAction); final JPanel queryButtonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5)); queryButtonsPanel.add(new BorderlessButton(queryDesignerAction)); final JPanel queryControlsPanel = new JPanel(new BorderLayout()); queryControlsPanel.add(new JLabel(Messages.getString("JdbcDataSourceDialog.QueryDetailsLabel")), BorderLayout.WEST); queryControlsPanel.add(queryButtonsPanel, BorderLayout.EAST); final JPanel queryPanel = new JPanel(new BorderLayout()); queryPanel.add(queryControlsPanel, BorderLayout.NORTH); queryPanel.add(new RTextScrollPane(500, 300, queryTextArea, true), BorderLayout.CENTER); queryPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 0, 8)); final JTabbedPane queryScriptTabPane = new JTabbedPane(); queryScriptTabPane.addTab(Messages.getString("JdbcDataSourceDialog.StaticQuery"), queryPanel); queryScriptTabPane.addTab(Messages.getString("JdbcDataSourceDialog.QueryScripting"), createQueryScriptTab()); // Create the query details panel final JPanel queryDetailsPanel = new JPanel(new BorderLayout()); queryDetailsPanel.add(BorderLayout.NORTH, queryNamePanel); queryDetailsPanel.add(BorderLayout.CENTER, queryScriptTabPane); return queryDetailsPanel; }
From source file:org.broad.igv.hic.MainWindow.java
private void initComponents() { JPanel mainPanel = new JPanel(); JPanel toolbarPanel = new JPanel(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); mainPanel.setLayout(new BorderLayout()); toolbarPanel.setBorder(null);/*from w w w. ja v a 2 s. c om*/ toolbarPanel.setLayout(new GridLayout()); JPanel chrSelectionPanel = new JPanel(); chrSelectionPanel.setBorder(LineBorder.createGrayLineBorder()); chrSelectionPanel.setMinimumSize(new Dimension(130, 57)); chrSelectionPanel.setPreferredSize(new Dimension(130, 57)); chrSelectionPanel.setLayout(new BorderLayout()); JPanel panel10 = new JPanel(); panel10.setBackground(new Color(204, 204, 204)); panel10.setLayout(new BorderLayout()); JLabel label3 = new JLabel(); label3.setText("Chromosomes"); label3.setHorizontalAlignment(SwingConstants.CENTER); panel10.add(label3, BorderLayout.CENTER); chrSelectionPanel.add(panel10, BorderLayout.PAGE_START); JPanel panel9 = new JPanel(); panel9.setBackground(new Color(238, 238, 238)); panel9.setLayout(new BoxLayout(panel9, BoxLayout.X_AXIS)); //---- chrBox1 ---- chrBox1 = new JComboBox(); chrBox1.setModel(new DefaultComboBoxModel(new String[] { "All" })); chrBox1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox1ActionPerformed(e); } }); panel9.add(chrBox1); //---- chrBox2 ---- chrBox2 = new JComboBox(); chrBox2.setModel(new DefaultComboBoxModel(new String[] { "All" })); chrBox2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox2ActionPerformed(e); } }); panel9.add(chrBox2); //---- refreshButton ---- JideButton refreshButton = new JideButton(); refreshButton .setIcon(new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Refresh24.gif"))); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { refreshButtonActionPerformed(e); } }); panel9.add(refreshButton); chrSelectionPanel.add(panel9, BorderLayout.CENTER); toolbarPanel.add(chrSelectionPanel); //======== displayOptionPanel ======== JPanel displayOptionPanel = new JPanel(); JPanel panel1 = new JPanel(); displayOptionComboBox = new JComboBox(); displayOptionPanel.setBackground(new Color(238, 238, 238)); displayOptionPanel.setBorder(LineBorder.createGrayLineBorder()); displayOptionPanel.setLayout(new BorderLayout()); //======== panel14 ======== JPanel panel14 = new JPanel(); panel14.setBackground(new Color(204, 204, 204)); panel14.setLayout(new BorderLayout()); //---- label4 ---- JLabel label4 = new JLabel(); label4.setText("Show"); label4.setHorizontalAlignment(SwingConstants.CENTER); panel14.add(label4, BorderLayout.CENTER); displayOptionPanel.add(panel14, BorderLayout.PAGE_START); //======== panel1 ======== panel1.setBorder(new EmptyBorder(0, 10, 0, 10)); panel1.setLayout(new GridLayout(1, 0, 20, 0)); //---- comboBox1 ---- displayOptionComboBox .setModel(new DefaultComboBoxModel(new String[] { DisplayOption.OBSERVED.toString() })); displayOptionComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { displayOptionComboBoxActionPerformed(e); } }); panel1.add(displayOptionComboBox); displayOptionPanel.add(panel1, BorderLayout.CENTER); toolbarPanel.add(displayOptionPanel); //======== colorRangePanel ======== JPanel colorRangePanel = new JPanel(); JLabel colorRangeLabel = new JLabel(); colorRangeSlider = new RangeSlider(); colorRangePanel.setBorder(LineBorder.createGrayLineBorder()); colorRangePanel.setMinimumSize(new Dimension(96, 70)); colorRangePanel.setPreferredSize(new Dimension(202, 70)); colorRangePanel.setMaximumSize(new Dimension(32769, 70)); colorRangePanel.setLayout(new BorderLayout()); //======== panel11 ======== JPanel colorLabelPanel = new JPanel(); colorLabelPanel.setBackground(new Color(204, 204, 204)); colorLabelPanel.setLayout(new BorderLayout()); //---- colorRangeLabel ---- colorRangeLabel.setText("Color Range"); colorRangeLabel.setHorizontalAlignment(SwingConstants.CENTER); colorRangeLabel.setToolTipText("Range of color scale in counts per mega-base squared."); colorRangeLabel.setHorizontalTextPosition(SwingConstants.CENTER); colorRangeLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider); rangeDialog.setVisible(true); } } @Override public void mouseClicked(MouseEvent e) { ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider); rangeDialog.setVisible(true); } }); colorLabelPanel.add(colorRangeLabel, BorderLayout.CENTER); colorRangePanel.add(colorLabelPanel, BorderLayout.PAGE_START); //---- colorRangeSlider ---- colorRangeSlider.setPaintTicks(true); colorRangeSlider.setPaintLabels(true); colorRangeSlider.setLowerValue(0); colorRangeSlider.setMajorTickSpacing(500); colorRangeSlider.setMaximumSize(new Dimension(32767, 52)); colorRangeSlider.setPreferredSize(new Dimension(200, 52)); colorRangeSlider.setMinimumSize(new Dimension(36, 52)); colorRangeSlider.setMaximum(2000); colorRangeSlider.setUpperValue(500); colorRangeSlider.setMinorTickSpacing(100); colorRangeSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { colorRangeSliderStateChanged(e); } }); colorRangePanel.add(colorRangeSlider, BorderLayout.PAGE_END); // JPanel colorRangeTextPanel = new JPanel(); // colorRangeTextPanel.setLayout(new FlowLayout()); // JTextField minField = new JTextField(); // minField.setPreferredSize(new Dimension(50, 15)); // colorRangeTextPanel.add(minField); // colorRangeTextPanel.add(new JLabel(" - ")); // JTextField maxField = new JTextField(); // maxField.setPreferredSize(new Dimension(50, 15)); // colorRangeTextPanel.add(maxField); // colorRangeTextPanel.setPreferredSize(new Dimension(200, 52)); // colorRangePanel.add(colorRangeTextPanel, BorderLayout.PAGE_END); toolbarPanel.add(colorRangePanel); //======== resolutionPanel ======== JLabel resolutionLabel = new JLabel(); JPanel resolutionPanel = new JPanel(); resolutionPanel.setBorder(LineBorder.createGrayLineBorder()); resolutionPanel.setLayout(new BorderLayout()); //======== panel12 ======== JPanel panel12 = new JPanel(); panel12.setBackground(new Color(204, 204, 204)); panel12.setLayout(new BorderLayout()); //---- resolutionLabel ---- resolutionLabel.setText("Resolution"); resolutionLabel.setHorizontalAlignment(SwingConstants.CENTER); resolutionLabel.setBackground(new Color(204, 204, 204)); panel12.add(resolutionLabel, BorderLayout.CENTER); resolutionPanel.add(panel12, BorderLayout.PAGE_START); //======== panel2 ======== JPanel panel2 = new JPanel(); panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS)); //---- resolutionSlider ---- resolutionSlider = new JSlider(); resolutionSlider.setMaximum(8); resolutionSlider.setMajorTickSpacing(1); resolutionSlider.setPaintTicks(true); resolutionSlider.setSnapToTicks(true); resolutionSlider.setPaintLabels(true); resolutionSlider.setMinorTickSpacing(1); Dictionary<Integer, JLabel> resolutionLabels = new Hashtable<Integer, JLabel>(); Font f = FontManager.getFont(8); for (int i = 0; i < HiCGlobals.zoomLabels.length; i++) { if ((i + 1) % 2 == 0) { final JLabel tickLabel = new JLabel(HiCGlobals.zoomLabels[i]); tickLabel.setFont(f); resolutionLabels.put(i, tickLabel); } } resolutionSlider.setLabelTable(resolutionLabels); // Setting the zoom should always be done by calling resolutionSlider.setValue() so work isn't done twice. resolutionSlider.addChangeListener(new ChangeListener() { // Change zoom level while staying centered on current location. // Centering is relative to the bounds of the data, which might not be the bounds of the window public void stateChanged(ChangeEvent e) { if (!resolutionSlider.getValueIsAdjusting()) { int idx = resolutionSlider.getValue(); idx = Math.max(0, Math.min(idx, MAX_ZOOM)); if (hic.zd != null && idx == hic.zd.getZoom()) { // Nothing to do return; } if (hic.xContext != null) { int centerLocationX = (int) hic.xContext .getChromosomePosition(getHeatmapPanel().getWidth() / 2); int centerLocationY = (int) hic.yContext .getChromosomePosition(getHeatmapPanel().getHeight() / 2); hic.setZoom(idx, centerLocationX, centerLocationY, false); } //zoomInButton.setEnabled(newZoom < MAX_ZOOM); //zoomOutButton.setEnabled(newZoom > 0); } } }); panel2.add(resolutionSlider); resolutionPanel.add(panel2, BorderLayout.CENTER); toolbarPanel.add(resolutionPanel); mainPanel.add(toolbarPanel, BorderLayout.NORTH); //======== hiCPanel ======== final JPanel hiCPanel = new JPanel(); hiCPanel.setLayout(new HiCLayout()); //---- rulerPanel2 ---- rulerPanel2 = new HiCRulerPanel(hic); rulerPanel2.setMaximumSize(new Dimension(4000, 50)); rulerPanel2.setMinimumSize(new Dimension(1, 50)); rulerPanel2.setPreferredSize(new Dimension(1, 50)); rulerPanel2.setBorder(null); JPanel panel2_5 = new JPanel(); panel2_5.setLayout(new BorderLayout()); panel2_5.add(rulerPanel2, BorderLayout.SOUTH); trackPanel = new TrackPanel(hic); trackPanel.setMaximumSize(new Dimension(4000, 50)); trackPanel.setPreferredSize(new Dimension(1, 50)); trackPanel.setMinimumSize(new Dimension(1, 50)); trackPanel.setBorder(null); // trackPanelScrollpane = new JScrollPane(); // trackPanelScrollpane.getViewport().add(trackPanel); // trackPanelScrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); // trackPanelScrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); // trackPanelScrollpane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102))); // trackPanelScrollpane.setBackground(new java.awt.Color(237, 237, 237)); // trackPanelScrollpane.setVisible(false); // panel2_5.add(trackPanelScrollpane, BorderLayout.NORTH); // trackPanel.setVisible(false); panel2_5.add(trackPanel, BorderLayout.NORTH); hiCPanel.add(panel2_5, BorderLayout.NORTH); //---- rulerPanel1 ---- rulerPanel1 = new HiCRulerPanel(hic); rulerPanel1.setMaximumSize(new Dimension(50, 4000)); rulerPanel1.setPreferredSize(new Dimension(50, 500)); rulerPanel1.setBorder(null); rulerPanel1.setMinimumSize(new Dimension(50, 1)); hiCPanel.add(rulerPanel1, BorderLayout.WEST); //---- heatmapPanel ---- heatmapPanel = new HeatmapPanel(this, hic); heatmapPanel.setBorder(LineBorder.createBlackLineBorder()); heatmapPanel.setMaximumSize(new Dimension(500, 500)); heatmapPanel.setMinimumSize(new Dimension(500, 500)); heatmapPanel.setPreferredSize(new Dimension(500, 500)); heatmapPanel.setBackground(new Color(238, 238, 238)); hiCPanel.add(heatmapPanel, BorderLayout.CENTER); //======== panel8 ======== JPanel rightSidePanel = new JPanel(); rightSidePanel.setMaximumSize(new Dimension(120, 100)); rightSidePanel.setBorder(new EmptyBorder(0, 10, 0, 0)); rightSidePanel.setLayout(null); //---- thumbnailPanel ---- thumbnailPanel = new ThumbnailPanel(this, hic); thumbnailPanel.setMaximumSize(new Dimension(100, 100)); thumbnailPanel.setMinimumSize(new Dimension(100, 100)); thumbnailPanel.setPreferredSize(new Dimension(100, 100)); thumbnailPanel.setBorder(LineBorder.createBlackLineBorder()); thumbnailPanel.setPreferredSize(new Dimension(100, 100)); thumbnailPanel.setBounds(new Rectangle(new Point(20, 0), thumbnailPanel.getPreferredSize())); rightSidePanel.add(thumbnailPanel); //======== xPlotPanel ======== xPlotPanel = new JPanel(); xPlotPanel.setPreferredSize(new Dimension(250, 100)); xPlotPanel.setLayout(null); rightSidePanel.add(xPlotPanel); xPlotPanel.setBounds(10, 100, xPlotPanel.getPreferredSize().width, 228); //======== yPlotPanel ======== yPlotPanel = new JPanel(); yPlotPanel.setPreferredSize(new Dimension(250, 100)); yPlotPanel.setLayout(null); rightSidePanel.add(yPlotPanel); yPlotPanel.setBounds(10, 328, yPlotPanel.getPreferredSize().width, 228); // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < rightSidePanel.getComponentCount(); i++) { Rectangle bounds = rightSidePanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = rightSidePanel.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; rightSidePanel.setMinimumSize(preferredSize); rightSidePanel.setPreferredSize(preferredSize); hiCPanel.add(rightSidePanel, BorderLayout.EAST); mainPanel.add(hiCPanel, BorderLayout.CENTER); contentPane.add(mainPanel, BorderLayout.CENTER); JMenuBar menuBar = createMenuBar(hiCPanel); contentPane.add(menuBar, BorderLayout.NORTH); // setup the glass pane to display a wait cursor when visible, and to grab all mouse events rootPane.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); rootPane.getGlassPane().addMouseListener(new MouseAdapter() { }); }
From source file:com.net2plan.gui.utils.viewEditTopolTables.specificTables.AdvancedJTable_demand.java
private List<JComponent> getExtraOptions(final int row, final Object itemId) { List<JComponent> options = new LinkedList<JComponent>(); final int numRows = model.getRowCount(); final NetPlan netPlan = callback.getDesign(); final List<Demand> tableVisibleDemands = getVisibleElementsInTable(); JMenuItem offeredTrafficToAll = new JMenuItem("Set offered traffic to all"); offeredTrafficToAll.addActionListener(new ActionListener() { @Override/*from www .j av a 2 s .c om*/ public void actionPerformed(ActionEvent e) { double h_d; while (true) { String str = JOptionPane.showInputDialog(null, "Offered traffic volume", "Set traffic value to all demands in the table", JOptionPane.QUESTION_MESSAGE); if (str == null) return; try { h_d = Double.parseDouble(str); if (h_d < 0) throw new RuntimeException(); break; } catch (Throwable ex) { ErrorHandling.showErrorDialog("Please, introduce a non-negative number", "Error setting offered traffic"); } } NetPlan netPlan = callback.getDesign(); try { for (Demand d : tableVisibleDemands) d.setOfferedTraffic(h_d); callback.getVisualizationState().resetPickedState(); callback.updateVisualizationAfterChanges(Collections.singleton(NetworkElementType.DEMAND)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } catch (Throwable ex) { ErrorHandling.showErrorDialog(ex.getMessage(), "Unable to set offered traffic to all demands in the table"); } } }); options.add(offeredTrafficToAll); JMenuItem scaleOfferedTrafficToAll = new JMenuItem("Scale offered traffic all demands in the table"); scaleOfferedTrafficToAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { double scalingFactor; while (true) { String str = JOptionPane.showInputDialog(null, "Scaling factor to multiply to all offered traffics", "Scale offered traffic", JOptionPane.QUESTION_MESSAGE); if (str == null) return; try { scalingFactor = Double.parseDouble(str); if (scalingFactor < 0) throw new RuntimeException(); break; } catch (Throwable ex) { ErrorHandling.showErrorDialog("Please, introduce a non-negative number", "Error setting offered traffic"); } } try { for (Demand d : tableVisibleDemands) d.setOfferedTraffic(d.getOfferedTraffic() * scalingFactor); callback.getVisualizationState().resetPickedState(); callback.updateVisualizationAfterChanges(Collections.singleton(NetworkElementType.DEMAND)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } catch (Throwable ex) { ErrorHandling.showErrorDialog(ex.getMessage(), "Unable to scale demand offered traffics"); } } }); options.add(scaleOfferedTrafficToAll); JMenuItem setServiceTypes = new JMenuItem( "Set traversed resource types (to one or all demands in the table)"); setServiceTypes.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { NetPlan netPlan = callback.getDesign(); try { Demand d = netPlan.getDemandFromId((Long) itemId); String[] headers = StringUtils.arrayOf("Order", "Type"); Object[][] data = { null, null }; DefaultTableModel model = new ClassAwareTableModelImpl(data, headers); AdvancedJTable table = new AdvancedJTable(model); JButton addRow = new JButton("Add new traversed resource type"); addRow.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Object[] newRow = { table.getRowCount(), "" }; ((DefaultTableModel) table.getModel()).addRow(newRow); } }); JButton removeRow = new JButton("Remove selected"); removeRow.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ((DefaultTableModel) table.getModel()).removeRow(table.getSelectedRow()); for (int t = 0; t < table.getRowCount(); t++) table.getModel().setValueAt(t, t, 0); } }); JButton removeAllRows = new JButton("Remove all"); removeAllRows.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { while (table.getRowCount() > 0) ((DefaultTableModel) table.getModel()).removeRow(0); } }); List<String> oldTraversedResourceTypes = d.getServiceChainSequenceOfTraversedResourceTypes(); Object[][] newData = new Object[oldTraversedResourceTypes.size()][headers.length]; for (int i = 0; i < oldTraversedResourceTypes.size(); i++) { newData[i][0] = i; newData[i][1] = oldTraversedResourceTypes.get(i); } ((DefaultTableModel) table.getModel()).setDataVector(newData, headers); JPanel pane = new JPanel(); JPanel pane2 = new JPanel(); pane.setLayout(new BorderLayout()); pane2.setLayout(new BorderLayout()); pane.add(new JScrollPane(table), BorderLayout.CENTER); pane2.add(addRow, BorderLayout.WEST); pane2.add(removeRow, BorderLayout.EAST); pane2.add(removeAllRows, BorderLayout.SOUTH); pane.add(pane2, BorderLayout.SOUTH); final String[] optionsArray = new String[] { "Set to selected demand", "Set to all demands", "Cancel" }; int result = JOptionPane.showOptionDialog(null, pane, "Set traversed resource types", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, optionsArray, optionsArray[0]); if ((result != 0) && (result != 1)) return; final boolean setToAllDemands = (result == 1); List<String> newTraversedResourcesTypes = new LinkedList<>(); for (int j = 0; j < table.getRowCount(); j++) { String travResourceType = table.getModel().getValueAt(j, 1).toString(); newTraversedResourcesTypes.add(travResourceType); } if (setToAllDemands) { for (Demand dd : tableVisibleDemands) if (!dd.getRoutes().isEmpty()) throw new Net2PlanException( "It is not possible to set the resource types traversed to demands with routes"); for (Demand dd : tableVisibleDemands) dd.setServiceChainSequenceOfTraversedResourceTypes(newTraversedResourcesTypes); } else { if (!d.getRoutes().isEmpty()) throw new Net2PlanException( "It is not possible to set the resource types traversed to demands with routes"); d.setServiceChainSequenceOfTraversedResourceTypes(newTraversedResourcesTypes); } callback.getVisualizationState().resetPickedState(); callback.updateVisualizationAfterChanges(Collections.singleton(NetworkElementType.DEMAND)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } catch (Throwable ex) { ErrorHandling.showErrorDialog(ex.getMessage(), "Unable to set traversed resource types"); } } }); options.add(setServiceTypes); if (itemId != null && netPlan.isMultilayer()) { final long demandId = (long) itemId; if (netPlan.getDemandFromId(demandId).isCoupled()) { JMenuItem decoupleDemandItem = new JMenuItem("Decouple demand"); decoupleDemandItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { netPlan.getDemandFromId(demandId).decouple(); model.setValueAt("", row, 3); callback.getVisualizationState().resetPickedState(); callback.updateVisualizationAfterChanges(Collections.singleton(NetworkElementType.DEMAND)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } }); options.add(decoupleDemandItem); } else { JMenuItem createUpperLayerLinkFromDemandItem = new JMenuItem("Create upper layer link from demand"); createUpperLayerLinkFromDemandItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Collection<Long> layerIds = netPlan.getNetworkLayerIds(); final JComboBox layerSelector = new WiderJComboBox(); for (long layerId : layerIds) { if (layerId == netPlan.getNetworkLayerDefault().getId()) continue; final String layerName = netPlan.getNetworkLayerFromId(layerId).getName(); String layerLabel = "Layer " + layerId; if (!layerName.isEmpty()) layerLabel += " (" + layerName + ")"; layerSelector.addItem(StringLabeller.of(layerId, layerLabel)); } layerSelector.setSelectedIndex(0); JPanel pane = new JPanel(); pane.add(new JLabel("Select layer: ")); pane.add(layerSelector); while (true) { int result = JOptionPane.showConfirmDialog(null, pane, "Please select the upper layer to create the link", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result != JOptionPane.OK_OPTION) return; try { long layerId = (long) ((StringLabeller) layerSelector.getSelectedItem()) .getObject(); netPlan.getDemandFromId(demandId) .coupleToNewLinkCreated(netPlan.getNetworkLayerFromId(layerId)); callback.getVisualizationState() .recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals(); callback.updateVisualizationAfterChanges( Sets.newHashSet(NetworkElementType.DEMAND, NetworkElementType.LINK)); callback.getUndoRedoNavigationManager().addNetPlanChange(); break; } catch (Throwable ex) { ErrorHandling.showErrorDialog(ex.getMessage(), "Error creating upper layer link from demand"); } } } }); options.add(createUpperLayerLinkFromDemandItem); JMenuItem coupleDemandToLink = new JMenuItem("Couple demand to upper layer link"); coupleDemandToLink.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Collection<Long> layerIds = netPlan.getNetworkLayerIds(); final JComboBox layerSelector = new WiderJComboBox(); final JComboBox linkSelector = new WiderJComboBox(); for (long layerId : layerIds) { if (layerId == netPlan.getNetworkLayerDefault().getId()) continue; final String layerName = netPlan.getNetworkLayerFromId(layerId).getName(); String layerLabel = "Layer " + layerId; if (!layerName.isEmpty()) layerLabel += " (" + layerName + ")"; layerSelector.addItem(StringLabeller.of(layerId, layerLabel)); } layerSelector.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (layerSelector.getSelectedIndex() >= 0) { long selectedLayerId = (Long) ((StringLabeller) layerSelector.getSelectedItem()) .getObject(); NetworkLayer selectedLayer = netPlan.getNetworkLayerFromId(selectedLayerId); linkSelector.removeAllItems(); Collection<Link> links_thisLayer = netPlan.getLinks(selectedLayer); for (Link link : links_thisLayer) { if (link.isCoupled()) continue; String originNodeName = link.getOriginNode().getName(); String destinationNodeName = link.getDestinationNode().getName(); linkSelector.addItem(StringLabeller.unmodifiableOf(link.getId(), "e" + link.getIndex() + " [n" + link.getOriginNode().getIndex() + " (" + originNodeName + ") -> n" + link.getDestinationNode().getIndex() + " (" + destinationNodeName + ")]")); } } if (linkSelector.getItemCount() == 0) { linkSelector.setEnabled(false); } else { linkSelector.setSelectedIndex(0); linkSelector.setEnabled(true); } } }); layerSelector.setSelectedIndex(-1); layerSelector.setSelectedIndex(0); JPanel pane = new JPanel(new MigLayout("", "[][grow]", "[][]")); pane.add(new JLabel("Select layer: ")); pane.add(layerSelector, "growx, wrap"); pane.add(new JLabel("Select link: ")); pane.add(linkSelector, "growx, wrap"); while (true) { int result = JOptionPane.showConfirmDialog(null, pane, "Please select the upper layer link", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result != JOptionPane.OK_OPTION) return; try { long layerId = (long) ((StringLabeller) layerSelector.getSelectedItem()) .getObject(); long linkId; try { linkId = (long) ((StringLabeller) linkSelector.getSelectedItem()).getObject(); } catch (Throwable ex) { throw new RuntimeException("No link was selected"); } netPlan.getDemandFromId(demandId) .coupleToUpperLayerLink(netPlan.getLinkFromId(linkId)); callback.getVisualizationState().resetPickedState(); callback.updateVisualizationAfterChanges( Sets.newHashSet(NetworkElementType.DEMAND, NetworkElementType.LINK)); callback.getUndoRedoNavigationManager().addNetPlanChange(); break; } catch (Throwable ex) { ErrorHandling.showErrorDialog(ex.getMessage(), "Error coupling upper layer link to demand"); } } } }); options.add(coupleDemandToLink); } if (numRows > 1) { JMenuItem decoupleAllDemandsItem = null; JMenuItem createUpperLayerLinksFromDemandsItem = null; final Set<Demand> coupledDemands = tableVisibleDemands.stream().filter(d -> d.isCoupled()) .collect(Collectors.toSet()); if (!coupledDemands.isEmpty()) { decoupleAllDemandsItem = new JMenuItem("Decouple all demands"); decoupleAllDemandsItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (Demand d : new LinkedHashSet<Demand>(coupledDemands)) d.decouple(); int numRows = model.getRowCount(); for (int i = 0; i < numRows; i++) model.setValueAt("", i, 3); callback.getVisualizationState().resetPickedState(); callback.updateVisualizationAfterChanges(Sets.newHashSet(NetworkElementType.DEMAND)); callback.getUndoRedoNavigationManager().addNetPlanChange(); } }); } if (coupledDemands.size() < tableVisibleDemands.size()) { createUpperLayerLinksFromDemandsItem = new JMenuItem( "Create upper layer links from uncoupled demands"); createUpperLayerLinksFromDemandsItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Collection<Long> layerIds = netPlan.getNetworkLayerIds(); final JComboBox layerSelector = new WiderJComboBox(); for (long layerId : layerIds) { if (layerId == netPlan.getNetworkLayerDefault().getId()) continue; final String layerName = netPlan.getNetworkLayerFromId(layerId).getName(); String layerLabel = "Layer " + layerId; if (!layerName.isEmpty()) layerLabel += " (" + layerName + ")"; layerSelector.addItem(StringLabeller.of(layerId, layerLabel)); } layerSelector.setSelectedIndex(0); JPanel pane = new JPanel(); pane.add(new JLabel("Select layer: ")); pane.add(layerSelector); while (true) { int result = JOptionPane.showConfirmDialog(null, pane, "Please select the upper layer to create links", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (result != JOptionPane.OK_OPTION) return; try { long layerId = (long) ((StringLabeller) layerSelector.getSelectedItem()) .getObject(); NetworkLayer layer = netPlan.getNetworkLayerFromId(layerId); for (Demand demand : tableVisibleDemands) if (!demand.isCoupled()) demand.coupleToNewLinkCreated(layer); callback.getVisualizationState() .recomputeCanvasTopologyBecauseOfLinkOrNodeAdditionsOrRemovals(); callback.updateVisualizationAfterChanges( Sets.newHashSet(NetworkElementType.DEMAND, NetworkElementType.LINK)); callback.getUndoRedoNavigationManager().addNetPlanChange(); break; } catch (Throwable ex) { ErrorHandling.showErrorDialog(ex.getMessage(), "Error creating upper layer links"); } } } }); } if (!options.isEmpty() && (decoupleAllDemandsItem != null || createUpperLayerLinksFromDemandsItem != null)) { options.add(new JPopupMenu.Separator()); if (decoupleAllDemandsItem != null) options.add(decoupleAllDemandsItem); if (createUpperLayerLinksFromDemandsItem != null) options.add(createUpperLayerLinksFromDemandsItem); } } } return options; }
From source file:op.controlling.PnlControlling.java
private JPanel createContentPanel4Nursing() { JPanel pnlContent = new JPanel(new VerticalLayout()); /***/*from ww w. java2s .c om*/ * __ __ _ * \ \ / /__ _ _ _ __ __| |___ * \ \ /\ / / _ \| | | | '_ \ / _` / __| * \ V V / (_) | |_| | | | | (_| \__ \ * \_/\_/ \___/ \__,_|_| |_|\__,_|___/ * */ JPanel pnlWounds = new JPanel(new BorderLayout()); final JButton btnWounds = GUITools.createHyperlinkButton("opde.controlling.nursing.wounds", null, null); int woundsMonthsBack; try { woundsMonthsBack = Integer.parseInt(OPDE.getProps().getProperty("opde.controlling::woundsMonthsBack")); } catch (NumberFormatException nfe) { woundsMonthsBack = 7; } final JTextField txtWoundsMonthsBack = GUITools.createIntegerTextField(1, 12, woundsMonthsBack); txtWoundsMonthsBack.setToolTipText(SYSTools.xx("misc.msg.monthsback")); btnWounds.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { OPDE.getMainframe().setBlocked(true); SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { SYSPropsTools.storeProp("opde.controlling::woundsMonthsBack", txtWoundsMonthsBack.getText(), OPDE.getLogin().getUser()); SYSFilesTools.print( getWounds(Integer.parseInt(txtWoundsMonthsBack.getText()), progressClosure), false); return null; } @Override protected void done() { OPDE.getDisplayManager().setProgressBarMessage(null); OPDE.getMainframe().setBlocked(false); } }; worker.execute(); } }); pnlWounds.add(btnWounds, BorderLayout.WEST); pnlWounds.add(txtWoundsMonthsBack, BorderLayout.EAST); pnlContent.add(pnlWounds); /*** * ____ _ _ _____ _ * / ___| ___ ___(_) __ _| | |_ _(_)_ __ ___ ___ ___ * \___ \ / _ \ / __| |/ _` | | | | | | '_ ` _ \ / _ \/ __| * ___) | (_) | (__| | (_| | | | | | | | | | | | __/\__ \ * |____/ \___/ \___|_|\__,_|_| |_| |_|_| |_| |_|\___||___/ * */ JPanel pblSocialTimes = new JPanel(new BorderLayout()); final JButton btnSocialTimes = GUITools.createHyperlinkButton("opde.controlling.nursing.social", null, null); final JComboBox cmbSocialTimes = new JComboBox( SYSCalendar.createMonthList(new LocalDate().minusYears(1), new LocalDate())); btnSocialTimes.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { OPDE.getMainframe().setBlocked(true); SwingWorker worker = new SwingWorker() { @Override protected Object doInBackground() throws Exception { LocalDate month = (LocalDate) cmbSocialTimes.getSelectedItem(); SYSFilesTools.print(NReportTools.getTimes4SocialReports(month, progressClosure), false); return null; } @Override protected void done() { OPDE.getDisplayManager().setProgressBarMessage(null); OPDE.getMainframe().setBlocked(false); } }; worker.execute(); } }); cmbSocialTimes.setRenderer(new ListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { return new DefaultListCellRenderer().getListCellRendererComponent(list, monthFormatter.format(((LocalDate) value).toDate()), index, isSelected, cellHasFocus); } }); cmbSocialTimes.setSelectedIndex(cmbSocialTimes.getItemCount() - 2); pblSocialTimes.add(btnSocialTimes, BorderLayout.WEST); pblSocialTimes.add(cmbSocialTimes, BorderLayout.EAST); pnlContent.add(pblSocialTimes); return pnlContent; }
From source file:org.pentaho.reporting.ui.datasources.jdbc.ui.JdbcDataSourceDialog.java
private JPanel createQueryListPanel() { // Create the query list panel final QueryRemoveAction queryRemoveAction = new QueryRemoveAction(); dialogModel.addPropertyChangeListener(queryRemoveAction); final JPanel theQueryButtonsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5)); theQueryButtonsPanel.add(new BorderlessButton(new QueryAddAction())); theQueryButtonsPanel.add(new BorderlessButton(queryRemoveAction)); final JPanel theQueryControlsPanel = new JPanel(new BorderLayout()); theQueryControlsPanel.add(new JLabel(Messages.getString("JdbcDataSourceDialog.AvailableQueries")), BorderLayout.WEST);//from w w w.j av a 2s. c o m theQueryControlsPanel.add(theQueryButtonsPanel, BorderLayout.EAST); final JPanel queryListPanel = new JPanel(new BorderLayout()); queryListPanel.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 8)); queryListPanel.add(BorderLayout.NORTH, theQueryControlsPanel); queryListPanel.add(BorderLayout.CENTER, new JScrollPane(queryNameList)); return queryListPanel; }
From source file:org.colombbus.tangara.EditorFrame.java
/** * This method initializes msgButtonsPanel * * @return javax.swing.JPanel/*from w w w . j a v a 2s .c om*/ */ private JPanel getMsgButtonsPanel() { if (msgButtonsPanel == null) { msgButtonsPanel = new JPanel(); msgButtonsPanel.setLayout(new BorderLayout()); msgButtonsPanel.setBackground(Color.white); msgButtonsPanel.add(getMsgButtons(), BorderLayout.WEST); JLabel endIcon = new JLabel(); endIcon.setText(""); //$NON-NLS-1$ endIcon.setBackground(Color.white); endIcon.setIcon(new ImageIcon(getClass().getResource("/org/colombbus/tangara/main_end.png"))); //$NON-NLS-1$ msgButtonsPanel.add(endIcon, BorderLayout.EAST); } return msgButtonsPanel; }
From source file:SuitaDetails.java
public PropPanel() { jPanel1 = new JPanel(); addpanel = new JPanel(); addpanel.setMaximumSize(new Dimension(32767, 25)); addpanel.setMinimumSize(new Dimension(0, 25)); addpanel.setPreferredSize(new Dimension(50, 25)); addpanel.setLayout(new BorderLayout()); JButton add = new JButton("Add"); add.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { ArrayList<Integer> indexpos3 = (ArrayList<Integer>) parent.getPos().clone(); indexpos3.add(new Integer(parent.getSubItemsNr())); Item property = new Item("", 0, -1, -1, 10, 20, indexpos3); property.setSubItemVisible(false); property.setValue(""); parent.addSubItem(property); Prop prop = new Prop(parent, property); jPanel1.remove(addpanel);//from w w w. j a v a2s.c om jPanel1.add(prop); jPanel1.add(addpanel); jPanel1.revalidate(); jPanel1.repaint(); } }); addpanel.add(add, BorderLayout.EAST); addpanel.setBackground(Color.WHITE); JScrollPane jScrollPane1 = new JScrollPane(jPanel1); jPanel1.setBackground(Color.WHITE); jScrollPane1.setBackground(Color.WHITE); jScrollPane1.setBorder(null); jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(153, 153, 153)), "Properties", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, new Color(0, 0, 0))); setBackground(Color.WHITE); GroupLayout propLayout = new GroupLayout(this); setLayout(propLayout); propLayout.setHorizontalGroup( propLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1)); propLayout.setVerticalGroup( propLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1)); }
From source file:us.daveread.basicquery.BasicQuery.java
/** * Builds the GUI for the application//from w w w. ja va 2 s . c o m */ private void setup() { JPanel panel; JPanel gridPanel; JPanel outerPanel; JPanel flowPanel; JPanel boxedPanel; ButtonGroup bGroup; MaxHeightJScrollPane maxHeightJScrollPane; setupComponents(); getContentPane().setLayout(new BorderLayout()); // table.getTableHeader().setFont(new Font(table.getTableHeader().getFont(). // getName(), table.getTableHeader().getFont().getStyle(), // MessageStyleFactory.instance().getFontSize())); getContentPane().add(new JScrollPane(table), BorderLayout.CENTER); panel = new JPanel(); panel.setLayout(new BorderLayout()); outerPanel = new JPanel(); outerPanel.setLayout(new BorderLayout()); gridPanel = new JPanel(); gridPanel.setLayout(new GridLayout(0, 1)); gridPanel.add(connectString = new JComboBox()); connectString.setEditable(true); gridPanel.add(querySelection = new JComboBox()); querySelection.setEditable(false); querySelection.addActionListener(this); outerPanel.add(gridPanel, BorderLayout.NORTH); outerPanel.add(new JScrollPane(queryText = new JTextArea(QUERY_AREA_ROWS, QUERY_AREA_COLUMNS)), BorderLayout.SOUTH); queryText.setLineWrap(true); queryText.setWrapStyleWord(true); queryText.addKeyListener(this); panel.add(outerPanel, BorderLayout.CENTER); outerPanel = new JPanel(); outerPanel.setLayout(new BorderLayout()); boxedPanel = new JPanel(); boxedPanel.setLayout(new GridLayout(0, 2)); boxedPanel.add(new JLabel(Resources.getString("proUserId"))); boxedPanel.add(userId = new JTextField(10)); boxedPanel.add(new JLabel(Resources.getString("proPassword"))); boxedPanel.add(password = new JPasswordField(10)); outerPanel.add(boxedPanel, BorderLayout.WEST); // Prev/Next and the checkboxes are all on the flowPanel - Center of // outerPanel flowPanel = new JPanel(); flowPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); // Previous/Next buttons boxedPanel = new JPanel(); boxedPanel.setLayout(new FlowLayout()); boxedPanel.add(previousQuery = new JButton(Resources.getString("ctlPrev"), new ImageIcon(ImageUtility.getImageAsByteArray("ArrowLeftGreen.gif")))); previousQuery.setToolTipText(Resources.getString("tipPrev")); previousQuery.addActionListener(this); boxedPanel.add(nextQuery = new JButton(Resources.getString("ctlNext"), new ImageIcon(ImageUtility.getImageAsByteArray("ArrowRightGreen.gif")))); nextQuery.setToolTipText(Resources.getString("tipNext")); nextQuery.addActionListener(this); flowPanel.add(boxedPanel); // Checkboxes: Autocommit, Read Only and Pooling boxedPanel = new JPanel(); boxedPanel.setLayout(new FlowLayout()); boxedPanel.setBorder(getStandardBorder()); boxedPanel.add(autoCommit = new JCheckBox(Resources.getString("ctlAutoCommit"), true)); boxedPanel.add(readOnly = new JCheckBox(Resources.getString("ctlReadOnly"), false)); boxedPanel.add(poolConnect = new JCheckBox(Resources.getString("ctlConnPool"), false)); poolConnect.setEnabled(false); flowPanel.add(boxedPanel); outerPanel.add(flowPanel, BorderLayout.CENTER); boxedPanel = new JPanel(); boxedPanel.setLayout(new GridLayout(0, 1)); boxedPanel.setBorder(getStandardBorder()); boxedPanel.add(runIndicator = new JLabel(Resources.getString("ctlRunning"), JLabel.CENTER)); runIndicator.setForeground(Color.lightGray); boxedPanel.add(timeIndicator = new JLabel("", JLabel.RIGHT)); outerPanel.add(boxedPanel, BorderLayout.EAST); panel.add(outerPanel, BorderLayout.NORTH); flowPanel = new JPanel(); flowPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); boxedPanel = new JPanel(); boxedPanel.setLayout(new FlowLayout()); boxedPanel.setBorder(getStandardBorder()); boxedPanel.add(new JLabel(Resources.getString("proQueryType"))); boxedPanel.add(asQuery = new JRadioButton(Resources.getString("ctlSelect"), true)); boxedPanel.add(asUpdate = new JRadioButton(Resources.getString("ctlUpdate"))); boxedPanel.add(asDescribe = new JRadioButton(Resources.getString("ctlDescribe"))); bGroup = new ButtonGroup(); bGroup.add(asQuery); bGroup.add(asUpdate); bGroup.add(asDescribe); asQuery.addActionListener(this); asUpdate.addActionListener(this); asDescribe.addActionListener(this); flowPanel.add(boxedPanel); flowPanel.add(new JLabel(" ")); boxedPanel = new JPanel(); boxedPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); boxedPanel.setBorder(getStandardBorder()); boxedPanel.add(new JLabel(Resources.getString("proMaxRows"))); boxedPanel.add(maxRows); flowPanel.add(boxedPanel); flowPanel.add(new JLabel(" ")); flowPanel.add(execute = new JButton(Resources.getString("ctlExecute"))); execute.addActionListener(this); flowPanel.add(remove = new JButton(Resources.getString("ctlRemove"))); remove.addActionListener(this); flowPanel.add(commentToggle = new JButton(Resources.getString("ctlComment"))); commentToggle.addActionListener(this); flowPanel.add(nextInList = new JButton(Resources.getString("ctlDown"))); nextInList.addActionListener(this); panel.add(flowPanel, BorderLayout.SOUTH); getContentPane().add(panel, BorderLayout.NORTH); getRootPane().setDefaultButton(execute); messageDocument = new DefaultStyledDocument(); getContentPane().add( maxHeightJScrollPane = new MaxHeightJScrollPane(message = new JTextPane(messageDocument)), BorderLayout.SOUTH); message.setEditable(false); loadedDBDriver = false; loadMenu(); setupTextStyles(); loadProperties(); setupUserDefinedColoring(); setupResultsTableColoring(); loadConfig(); loadConnectStrings(); loadQueries(); loadDrivers(); // Check for avail of pool - enable/disable pooling option as appropriate // Not really useful until we get the pooling classes out of this code try { new GenericObjectPool(null); poolConnect.setEnabled(true); poolConnect.setSelected(true); } catch (Throwable any) { // No Apache Commons DB Pooling Library Found (DBCP) LOGGER.error(Resources.getString("errNoPoolLib"), any); } setDefaults(); maxHeightJScrollPane.lockHeight(getHeight() / MAX_SCROLL_PANE_DIVISOR_FOR_MAX_HEIGHT); // Font setFontFromConfig(Configuration.instance()); setVisible(true); }