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.apache.jmeter.protocol.system.gui.SystemSamplerGui.java
/** * @return JPanel timeout config/*from w w w . j a va2 s .c o m*/ */ private JPanel makeTimeoutPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString("timeout_config_box_title"))); // $NON-NLS-1$ timeout = new JLabeledTextField(JMeterUtils.getResString("timeout_title")); // $NON-NLS-1$ timeout.setSize(timeout.getSize().height, 30); panel.add(timeout); return panel; }
From source file:org.apache.jmeter.protocol.system.gui.SystemSamplerGui.java
/** * @return JPanel Command + directory//from ww w .jav a2 s . c o m */ private JPanel makeCommandPanel() { JPanel cmdPanel = new JPanel(); cmdPanel.setLayout(new BoxLayout(cmdPanel, BoxLayout.X_AXIS)); JPanel cmdWkDirPane = new JPanel(new BorderLayout()); command = new JLabeledTextField(JMeterUtils.getResString("command_field_title")); // $NON-NLS-1$ cmdWkDirPane.add(command, BorderLayout.CENTER); directory = new JLabeledTextField(JMeterUtils.getResString("directory_field_title")); // $NON-NLS-1$ cmdWkDirPane.add(directory, BorderLayout.EAST); cmdPanel.add(cmdWkDirPane); JPanel panel = new VerticalPanel(); panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString("command_config_box_title"))); // $NON-NLS-1$ panel.add(cmdPanel, BorderLayout.NORTH); panel.add(makeArgumentsPanel(), BorderLayout.CENTER); panel.add(makeEnvironmentPanel(), BorderLayout.SOUTH); return panel; }
From source file:org.apache.jmeter.visualizers.RespTimeGraphVisualizer.java
private JPanel createGraphSelectionSubPane() { // Search field JPanel searchPanel = new JPanel(); searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS)); searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0)); searchPanel.add(samplerSelection);// ww w . ja v a 2s. c o m samplerMatchLabel.setEnabled(false); applyFilterBtn.setEnabled(false); caseChkBox.setEnabled(false); regexpChkBox.setEnabled(false); samplerSelection.addActionListener(this); searchPanel.add(samplerMatchLabel); searchPanel.add(Box.createRigidArea(new Dimension(5, 0))); // Button applyFilterBtn.setFont(FONT_SMALL); applyFilterBtn.addActionListener(this); searchPanel.add(applyFilterBtn); // checkboxes caseChkBox.setFont(FONT_SMALL); searchPanel.add(caseChkBox); regexpChkBox.setFont(FONT_SMALL); searchPanel.add(regexpChkBox); return searchPanel; }
From source file:org.apache.jmeter.visualizers.StatGraphVisualizer.java
private JPanel createGraphSelectionSubPane() { // Search field JPanel searchPanel = new JPanel(); searchPanel.setLayout(new BoxLayout(searchPanel, BoxLayout.X_AXIS)); searchPanel.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0)); searchPanel.add(columnSelection);/*from ww w . j a v a2 s. c o m*/ columnMatchLabel.setEnabled(false); applyFilterBtn.setEnabled(false); caseChkBox.setEnabled(false); regexpChkBox.setEnabled(false); columnSelection.addActionListener(this); searchPanel.add(columnMatchLabel); searchPanel.add(Box.createRigidArea(new Dimension(5, 0))); // Button applyFilterBtn.setFont(FONT_SMALL); applyFilterBtn.addActionListener(this); searchPanel.add(applyFilterBtn); // checkboxes caseChkBox.setFont(FONT_SMALL); searchPanel.add(caseChkBox); regexpChkBox.setFont(FONT_SMALL); searchPanel.add(regexpChkBox); return searchPanel; }
From source file:org.apache.oodt.cas.workflow.gui.perspective.view.impl.DefaultPropView.java
@Override public void refreshView(final ViewState state) { this.removeAll(); tableMenu = new JPopupMenu("TableMenu"); this.add(tableMenu); override = new JMenuItem(OVERRIDE); override.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int row = DefaultPropView.this.table.getSelectedRow();// rowAtPoint(DefaultPropView.this.table.getMousePosition()); String key = getKey((String) DefaultPropView.this.table.getValueAt(row, 1), state); Metadata staticMet = state.getSelected().getModel().getStaticMetadata(); if (staticMet == null) { staticMet = new Metadata(); }//from ww w . ja va 2s .co m if (e.getActionCommand().equals(OVERRIDE)) { if (!staticMet.containsKey(key)) { staticMet.addMetadata(key, (String) DefaultPropView.this.table.getValueAt(row, 2)); String envReplace = (String) DefaultPropView.this.table.getValueAt(row, 3); if (Boolean.valueOf(envReplace)) { staticMet.addMetadata(key + "/envReplace", envReplace); } state.getSelected().getModel().setStaticMetadata(staticMet); DefaultPropView.this.notifyListeners(); } } } }); delete = new JMenuItem(DELETE); delete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int row = DefaultPropView.this.table.getSelectedRow();// rowAtPoint(DefaultPropView.this.table.getMousePosition()); String key = getKey((String) DefaultPropView.this.table.getValueAt(row, 1), state); Metadata staticMet = state.getSelected().getModel().getStaticMetadata(); if (staticMet == null) { staticMet = new Metadata(); } staticMet.removeMetadata(key); staticMet.removeMetadata(key + "/envReplace"); state.getSelected().getModel().setStaticMetadata(staticMet); DefaultPropView.this.notifyListeners(); } }); tableMenu.add(override); tableMenu.add(delete); if (state.getSelected() != null) { JPanel masterPanel = new JPanel(); masterPanel.setLayout(new BoxLayout(masterPanel, BoxLayout.Y_AXIS)); masterPanel.add(this.getModelIdPanel(state.getSelected(), state)); masterPanel.add(this.getModelNamePanel(state.getSelected(), state)); if (!state.getSelected().getModel().isParentType()) { masterPanel.add(this.getInstanceClassPanel(state.getSelected(), state)); } masterPanel.add(this.getExecutionTypePanel(state.getSelected(), state)); masterPanel.add(this.getPriorityPanel(state)); masterPanel.add(this.getExecusedIds(state.getSelected())); if (state.getSelected().getModel().getExecutionType().equals("condition")) { masterPanel.add(this.getTimeout(state.getSelected(), state)); masterPanel.add(this.getOptional(state.getSelected(), state)); } JScrollPane scrollPane = new JScrollPane(table = this.createTable(state), JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.getHorizontalScrollBar().setUnitIncrement(10); scrollPane.getVerticalScrollBar().setUnitIncrement(10); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.setBorder(new EtchedBorder()); final JLabel metLabel = new JLabel("Static Metadata"); metLabel.setAlignmentX(Component.CENTER_ALIGNMENT); final JLabel extendsLabel = new JLabel("<extends>"); extendsLabel.setFont(new Font("Serif", Font.PLAIN, 10)); extendsLabel.setAlignmentX(Component.CENTER_ALIGNMENT); extendsLabel.addMouseListener(new MouseListener() { private JScrollPane availableScroller; private JScrollPane mineScroller; private JList mineList; private JList availableList; private DefaultListModel mineModel; private DefaultListModel availableModel; public void mouseClicked(MouseEvent e) { final JPopupMenu popup = new JPopupMenu(); popup.setLayout(new BorderLayout()); JPanel main = new JPanel(); main.setLayout(new BoxLayout(main, BoxLayout.X_AXIS)); JPanel mine = new JPanel(); mine.setBorder(new EtchedBorder()); mine.setLayout(new BorderLayout()); JLabel mineLabel = new JLabel("Mine"); mineScroller = new JScrollPane(mineList = createJList(mineModel = new DefaultListModel(), state.getSelected().getModel().getExtendsConfig())); mineScroller.setPreferredSize(new Dimension(250, 80)); mine.add(mineLabel, BorderLayout.NORTH); mine.add(mineScroller, BorderLayout.CENTER); JPanel available = new JPanel(); available.setBorder(new EtchedBorder()); available.setLayout(new BorderLayout()); JLabel availableLabel = new JLabel("Available"); Vector<String> availableGroups = new Vector<String>(state.getGlobalConfigGroups().keySet()); availableGroups.removeAll(state.getSelected().getModel().getExtendsConfig()); availableScroller = new JScrollPane(availableList = this .createJList(availableModel = new DefaultListModel(), availableGroups)); availableScroller.setPreferredSize(new Dimension(250, 80)); available.add(availableLabel, BorderLayout.NORTH); available.add(availableScroller, BorderLayout.CENTER); JPanel buttons = new JPanel(); buttons.setLayout(new BoxLayout(buttons, BoxLayout.Y_AXIS)); JButton addButton = new JButton("<---"); addButton.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { String selected = availableList.getSelectedValue().toString(); Vector<String> extendsConfig = new Vector<String>( state.getSelected().getModel().getExtendsConfig()); extendsConfig.add(selected); state.getSelected().getModel().setExtendsConfig(extendsConfig); availableModel.remove(availableList.getSelectedIndex()); mineModel.addElement(selected); popup.revalidate(); DefaultPropView.this.notifyListeners(); } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }); JButton removeButton = new JButton("--->"); removeButton.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { String selected = mineList.getSelectedValue().toString(); Vector<String> extendsConfig = new Vector<String>( state.getSelected().getModel().getExtendsConfig()); extendsConfig.remove(selected); state.getSelected().getModel().setExtendsConfig(extendsConfig); mineModel.remove(mineList.getSelectedIndex()); availableModel.addElement(selected); popup.revalidate(); DefaultPropView.this.notifyListeners(); } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }); buttons.add(addButton); buttons.add(removeButton); main.add(mine); main.add(buttons); main.add(available); popup.add(main, BorderLayout.CENTER); popup.show(extendsLabel, e.getX(), e.getY()); } public void mouseEntered(MouseEvent e) { extendsLabel.setForeground(Color.blue); } public void mouseExited(MouseEvent e) { extendsLabel.setForeground(Color.black); } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } private JList createJList(DefaultListModel model, final List<String> list) { for (String value : list) { model.addElement(value); } JList jList = new JList(model); jList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); jList.setLayoutOrientation(JList.VERTICAL); return jList; } }); JLabel metGroupLabel = new JLabel("(Sub-Group: " + (state.getCurrentMetGroup() != null ? state.getCurrentMetGroup() : "<base>") + ")"); metGroupLabel.setAlignmentX(Component.CENTER_ALIGNMENT); JPanel labelPanel = new JPanel(); labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.Y_AXIS)); JPanel top = new JPanel(); top.setLayout(new BoxLayout(top, BoxLayout.Y_AXIS)); top.add(extendsLabel); top.add(metLabel); labelPanel.add(top); labelPanel.add(metGroupLabel); panel.add(labelPanel, BorderLayout.NORTH); panel.add(scrollPane, BorderLayout.CENTER); masterPanel.add(panel); this.add(masterPanel); } else { this.add(new JPanel()); } this.revalidate(); }
From source file:org.broad.igv.cli_plugin.ui.ArgumentPanel.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license argName = new JLabel(); //======== this ======== setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); //---- argName ---- argName.setText("Argument: "); argName.setRequestFocusEnabled(false); argName.setMinimumSize(new Dimension(80, 16)); add(argName);/*from w ww. ja v a 2s.c o m*/ // JFormDesigner - End of component initialization //GEN-END:initComponents }
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);/* ww w . java 2s. c o m*/ 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:org.codinjutsu.tools.mongo.view.MongoConfigurable.java
@Nullable @Override/* w ww . j a va 2 s.c o m*/ public JComponent createComponent() { JPanel mongoShellOptionsPanel = new JPanel(); mongoShellOptionsPanel.setLayout(new BoxLayout(mongoShellOptionsPanel, BoxLayout.X_AXIS)); shellPathField = createShellPathField(); mongoShellOptionsPanel.add(new JLabel("Path to Mongo executable:")); mongoShellOptionsPanel.add(shellPathField); mongoShellOptionsPanel.add(createTestButton()); mongoShellOptionsPanel.add(createFeedbackLabel()); mainPanel.add(mongoShellOptionsPanel, BorderLayout.NORTH); PanelWithButtons panelWithButtons = new PanelWithButtons() { { initPanel(); } @Nullable @Override protected String getLabelText() { return "Servers"; } @Override protected JButton[] createButtons() { return new JButton[] {}; } @Override protected JComponent createMainComponent() { table = new JBTable(tableModel); table.getEmptyText().setText("No server configuration set"); table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); TableColumn autoConnectColumn = table.getColumnModel().getColumn(2); int width = table.getFontMetrics(table.getFont()).stringWidth(table.getColumnName(2)) + 10; autoConnectColumn.setPreferredWidth(width); autoConnectColumn.setMaxWidth(width); autoConnectColumn.setMinWidth(width); return ToolbarDecorator.createDecorator(table).setAddAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { stopEditing(); ServerConfiguration serverConfiguration = ServerConfiguration.byDefault(); ConfigurationDialog dialog = new ConfigurationDialog(mainPanel, mongoManager, serverConfiguration); dialog.setTitle("Add a Mongo Server"); dialog.show(); if (!dialog.isOK()) { return; } configurations.add(serverConfiguration); int index = configurations.size() - 1; tableModel.fireTableRowsInserted(index, index); table.getSelectionModel().setSelectionInterval(index, index); table.scrollRectToVisible(table.getCellRect(index, 0, true)); } }).setAddActionName("addServer").setEditAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { stopEditing(); int selectedIndex = table.getSelectedRow(); if (selectedIndex < 0 || selectedIndex >= tableModel.getRowCount()) { return; } ServerConfiguration sourceConfiguration = configurations.get(selectedIndex); ServerConfiguration copiedCconfiguration = sourceConfiguration.clone(); ConfigurationDialog dialog = new ConfigurationDialog(mainPanel, mongoManager, copiedCconfiguration); dialog.setTitle("Edit a Mongo Server"); dialog.show(); if (!dialog.isOK()) { return; } configurations.set(selectedIndex, copiedCconfiguration); tableModel.fireTableRowsUpdated(selectedIndex, selectedIndex); table.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex); } }).setEditActionName("editServer").setRemoveAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) { stopEditing(); int selectedIndex = table.getSelectedRow(); if (selectedIndex < 0 || selectedIndex >= tableModel.getRowCount()) { return; } TableUtil.removeSelectedItems(table); } }).setRemoveActionName("removeServer").disableUpDownActions().createPanel(); } }; mainPanel.add(panelWithButtons, BorderLayout.CENTER); return mainPanel; }
From source file:org.colombbus.tangara.AboutWindow.java
private JPanel bodyPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.setOpaque(false);//from w w w . j av a2 s . c o m panel.add(Box.createHorizontalStrut(marginLeft)); panel.add(getTextZone()); panel.add(Box.createHorizontalStrut(marginButton)); panel.add(getCloseButton()); panel.add(Box.createHorizontalStrut(marginButton)); return panel; }
From source file:org.colombbus.tangara.CommandSelection.java
/** * This method initializes panelButtons/*from w ww . j av a 2 s .com*/ * * @return javax.swing.JPanel */ private JPanel getPanelButtons() { if (panelButtons == null) { panelButtons = new JPanel(); panelButtons.setBorder(new EmptyBorder(MARGIN_Y, MARGIN_X, MARGIN_Y, MARGIN_X)); panelButtons.setLayout(new BoxLayout(panelButtons, BoxLayout.X_AXIS)); panelButtons.add(Box.createHorizontalStrut(MARGIN_BUTTON)); panelButtons.add(getLeftButton(), null); panelButtons.add(Box.createHorizontalGlue()); panelButtons.add(getRightButton(), null); panelButtons.add(Box.createHorizontalStrut(MARGIN_BUTTON)); } return panelButtons; }