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:com.joey.software.regionSelectionToolkit.controlers.ImageProfileTool.java
public JPanel getControls() { if (controls == null) { controls = new JPanel(new BorderLayout()); JPanel dirButton = new JPanel(new GridLayout(1, 2)); dirButton.add(moveUpData);/*from w w w . j a v a2 s. c o m*/ dirButton.add(moveDownData); JPanel buttonPanel = new JPanel(new GridLayout(1, 3)); buttonPanel.add(showFlattenedButton); buttonPanel.add(showAScanButton); buttonPanel.add(estimageSurface); JPanel pointsPanel = new JPanel(new BorderLayout()); pointsPanel.add(saveData, BorderLayout.SOUTH); pointsPanel.add(axisToggle, BorderLayout.WEST); pointsPanel.add(numPoints, BorderLayout.CENTER); pointsPanel.add(updatePoints, BorderLayout.EAST); pointsPanel.add(buttonPanel, BorderLayout.NORTH); JPanel offsetPane = new JPanel(new BorderLayout()); offsetPane.add(showOffset, BorderLayout.WEST); offsetPane.add(offset, BorderLayout.CENTER); JPanel temp = new JPanel(new BorderLayout()); temp.add(offsetPane, BorderLayout.SOUTH); temp.add(transparance, BorderLayout.NORTH); JPanel toolPanel = new JPanel(new BorderLayout()); toolPanel.add(temp, BorderLayout.NORTH); toolPanel.add(pointsPanel, BorderLayout.CENTER); toolPanel.add(dirButton, BorderLayout.SOUTH); controls.add(toolPanel, BorderLayout.NORTH); estimageSurface.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { estimateSurface(); } }); showAScanButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showAScanPanel(); } }); axisToggle.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (axis == AXIS_X) { setAxis(AXIS_Y); axisToggle.setText("Y Axis"); } else { setAxis(AXIS_X); axisToggle.setText("X Axis"); } panel.repaint(); } }); transparance.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { panel.repaint(); } }); showOffset.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { panel.repaint(); } }); offset.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { panel.shapeChanged(); panel.repaint(); updatePlotPanel(); } }); showFlattenedButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showFlattenedImage(); } }); updatePoints.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setDataPoints((Integer) numPoints.getValue()); } }); moveUPTimer = new Timer(delay, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(1.0f / view.getImage().getHeight()); } }); moveDownTimer = new Timer(delay, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(-1.0f / view.getImage().getHeight()); } }); moveUpData.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JButton btn2 = (JButton) e.getSource(); ButtonModel model = btn2.getModel(); if (model.isPressed() && !moveUPTimer.isRunning()) { moveUPTimer.start(); } else if (!model.isPressed() && moveUPTimer.isRunning()) { moveUPTimer.stop(); } } }); moveDownData.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JButton btn2 = (JButton) e.getSource(); ButtonModel model = btn2.getModel(); if (model.isPressed() && !moveDownTimer.isRunning()) { moveDownTimer.start(); } else if (!model.isPressed() && moveDownTimer.isRunning()) { moveDownTimer.stop(); } } }); moveUpData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(1.0f / view.getImage().getHeight()); } }); moveDownData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { addValue(-1.0f / view.getImage().getHeight()); } }); saveData.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { saveData(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); } return controls; }
From source file:jchrest.gui.VisualSearchPane.java
private JPanel recallResultsPanel() { _recallSceneLabel = new JLabel("RECALLED SCENE"); //TODO: fix this when perceiver functionality working correctly. // _recalledSceneDisplay = new SceneDisplay (new Scene ( // "empty", // _scenes.get(0).getWidth(), // _scenes.get(0).getHeight(), // null/*from w w w. j av a2 s .c o m*/ // )); _precision = new JLabel(""); _recall = new JLabel(""); _omission = new JLabel(""); _commission = new JLabel(""); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JPanel statistics = new JPanel(); // Note: GridLayout used because it keeps a fixed size for the // right-hand side, whereas SpringLayout dynamically changes. statistics.setLayout(new GridLayout(4, 2)); statistics.add(new JLabel("Precision: ", SwingConstants.RIGHT)); statistics.add(_precision); statistics.add(new JLabel("Recall: ", SwingConstants.RIGHT)); statistics.add(_recall); statistics.add(new JLabel("Errors of omission: ", SwingConstants.RIGHT)); statistics.add(_omission); statistics.add(new JLabel("Errors of commission: ", SwingConstants.RIGHT)); statistics.add(_commission); // TODO: there must be a better solution to stop the statistics panel spreading out JPanel statisticsPanel = new JPanel(); statisticsPanel.setLayout(new BorderLayout()); statisticsPanel.add(statistics, BorderLayout.NORTH); panel.add(_recallSceneLabel, BorderLayout.NORTH); panel.add(_recalledSceneDisplay); panel.add(statisticsPanel, BorderLayout.EAST); return panel; }
From source file:edu.ku.brc.specify.tasks.subpane.images.ImagesPane.java
/** * Creates the UI./*from ww w . ja va 2 s. c o m*/ */ private void createUI() { infoPanel = new ImageInfoPanel(dataFetcher, this); infoPanel.createUI(); metaDataPanel = new MetaDataPanel(); metaDataPanel.createUI(); infoBtn = UIHelper.createIconBtn("InfoIcon", IconManager.STD_ICON_SIZE, null, null); infoBtn.setEnabled(true); metaDataBtn = UIHelper.createIconBtn("MetaData", IconManager.STD_ICON_SIZE, null, null); metaDataBtn.setEnabled(true); reloadBtn = UIHelper.createIconBtn("Reload", IconManager.STD_ICON_SIZE, null, null); reloadBtn.setEnabled(true); helpBtn = UIHelper .createHelpIconButton(searchType == SearchType.AllAttachments ? "Attach_Browser" : "show_images"); //filterBtn = UIHelper.createIconBtn("Filter20", IconManager.STD_ICON_SIZE, null, null); //filterBtn.setEnabled(true); rsController.getPanel().setOpaque(true); CommandBarPanel cbp = new CommandBarPanel(rsController); //cbp.setLeftComps(createSearchPanel()); // temporarily disabled (work in progress) cbp.setRightComps(metaDataBtn, infoBtn, helpBtn); cbp.createUI(); JPanel botPanel = new JPanel(new BorderLayout()); botPanel.add(cbp, BorderLayout.NORTH); botPanel.add(metaDataPanel, BorderLayout.CENTER); setLayout(new BorderLayout()); if (searchType != SearchType.FromRecordSet) { createColObjSearch(); } else if (recordSet != null) { searchForRecordSetAttachments(); } add(infoPanel, BorderLayout.EAST); add(botPanel, BorderLayout.SOUTH); infoBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showInfoPanel(gridPanel.getSelectedCellIndex()); } }); infoPanel.setVisible(false); metaDataBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showMetaDataPanel(gridPanel.getSelectedCellIndex()); } }); metaDataPanel.setVisible(false); reloadBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reloadAttachments(); } }); }
From source file:org.richie.codeGen.ui.GenAndPreviewUI.java
/** * ??/* w ww . j a v a 2 s . co m*/ * * @param fileName * @param fileContent */ private void addPreviewTablePanel(String fileName, String fileContent) { final JScrollPane content = new JScrollPane(); JTextArea viewTextArea = new JTextArea(); viewTextArea.setText(fileContent); content.setViewportView(viewTextArea); JPanel tab = new JPanel(); tab.setOpaque(false); JLabel tabLabel = new JLabel(fileName); ImageIcon closeXIcon = new ImageIcon(ClassLoader.getSystemResource("resources/images/close.gif")); JButton tabCloseButton = new JButton(closeXIcon); tabCloseButton.setToolTipText("close"); tabCloseButton.setBorder(null); tabCloseButton.setContentAreaFilled(false); tabCloseButton.setPreferredSize(new Dimension(closeXIcon.getIconWidth(), closeXIcon.getIconHeight())); tabCloseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int closeTabNumber = mainPanel.indexOfComponent(content); mainPanel.removeTabAt(closeTabNumber); } }); tab.add(tabLabel, BorderLayout.WEST); tab.add(tabCloseButton, BorderLayout.EAST); mainPanel.addTab(null, content); mainPanel.setTabComponentAt(mainPanel.getTabCount() - 1, tab); mainPanel.setSelectedComponent(content); }
From source file:src.gui.LifelinePanel.java
public void buildBottonToolBar() { buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBackground(Color.WHITE); //JLabel test = new JLabel("<html><a href=\"http://www.google.com\">delete</a></html>"); JPanel leftpanel = new JPanel(new BorderLayout()); leftpanel.setBackground(Color.WHITE); JButton button = new JButton(editLifeLine); button.setToolTipText("Edit lifeline"); button.setBackground(Color.WHITE); button.setBorderPainted(false);//from ww w.j a va 2 s .com leftpanel.add(button, BorderLayout.WEST); button.setRolloverEnabled(true); button = new JButton(deleteLifeLine); button.setToolTipText("Delete lifeline"); button.setBackground(Color.WHITE); button.setBorderPainted(false); leftpanel.add(button, BorderLayout.EAST); button.setRolloverEnabled(true); //JLabel editlabel = new JLabel("<html><b><u>edit</u></b> </html>"); //leftpanel.add(editlabel, BorderLayout.WEST); //JLabel deletelabel = new JLabel("<html><b><u>delete</u></b></html>"); //leftpanel.add(deletelabel, BorderLayout.EAST); buttonPanel.add(leftpanel, BorderLayout.EAST); this.add(buttonPanel, BorderLayout.SOUTH); }
From source file:com.att.aro.ui.view.videotab.VideoTab.java
private JPanel getTitledWrapper(String title, JComponent component) { JPanel pane = new JPanel(new GridBagLayout()); pane.setOpaque(false);// w w w . ja v a 2 s.co m pane.setBorder(new RoundedBorder(new Insets(0, 10, 10, 10), Color.WHITE)); JPanel fullPanel = new JPanel(new BorderLayout()); fullPanel.setOpaque(false); // Create the header bar BpHeaderPanel header = new BpHeaderPanel(ResourceBundleHelper.getMessageString(title)); header.setImageTitle(Images.BLUE_HEADER.getImage(), null); if (component != null) { header.add(component, BorderLayout.EAST); } fullPanel.add(header, BorderLayout.NORTH); pane.add(fullPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, headInsets, 0, 0)); return pane; }
From source file:com.tiempometa.muestradatos.JProgramTags.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos"); dialogPane = new JPanel(); contentPanel = new JPanel(); label1 = new JLabel(); statusLabel = new JLabel(); nextChipnumberTextField = new JTextField(); programButton = new JButton(); bibLabel = new JLabel(); label3 = new JLabel(); tidTextField = new JTextField(); label4 = new JLabel(); epcTextField = new JTextField(); label5 = new JLabel(); programmedEpcTextField = new JTextField(); scrollPane1 = new JScrollPane(); tagReadTable = new JTable(); lockCheckbox = new JCheckBox(); label2 = new JLabel(); accessPasswordTextField = new JTextField(); label6 = new JLabel(); killPasswordTextField = new JTextField(); checkBox1 = new JCheckBox(); buttonBar = new JPanel(); closeButton = new JButton(); CellConstraints cc = new CellConstraints(); // ======== this ======== setTitle(bundle.getString("JProgramTags.this.title")); setIconImage(/* w w w .java 2 s .c o m*/ new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png")) .getImage()); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== { dialogPane.setBorder(Borders.DIALOG_BORDER); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== { contentPanel.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.setLayout(new FormLayout( new ColumnSpec[] { new ColumnSpec(Sizes.dluX(12)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(86)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(73)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(68)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(Sizes.dluX(97)) }, new RowSpec[] { new RowSpec(Sizes.dluY(10)), FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(15)), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC })); // ---- label1 ---- label1.setText(bundle.getString("JProgramTags.label1.text")); label1.setFont(new Font("Tahoma", Font.PLAIN, 36)); contentPanel.add(label1, cc.xywh(3, 5, 3, 1)); // ---- statusLabel ---- statusLabel.setText(bundle.getString("JProgramTags.statusLabel.text")); statusLabel.setHorizontalAlignment(SwingConstants.CENTER); statusLabel.setBackground(Color.yellow); statusLabel.setOpaque(true); statusLabel.setFont(new Font("Tahoma", Font.BOLD, 20)); contentPanel.add(statusLabel, cc.xywh(9, 3, 3, 5)); // ---- nextChipnumberTextField ---- nextChipnumberTextField.setFont(new Font("Tahoma", Font.PLAIN, 36)); contentPanel.add(nextChipnumberTextField, cc.xy(7, 5)); // ---- programButton ---- programButton.setText(bundle.getString("JProgramTags.programButton.text")); programButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); programButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { programButtonActionPerformed(e); } }); contentPanel.add(programButton, cc.xywh(3, 7, 3, 1)); // ---- bibLabel ---- bibLabel.setForeground(Color.red); bibLabel.setFont(new Font("Tahoma", Font.BOLD, 36)); bibLabel.setHorizontalAlignment(SwingConstants.CENTER); contentPanel.add(bibLabel, cc.xy(11, 9)); // ---- label3 ---- label3.setText(bundle.getString("JProgramTags.label3.text")); label3.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label3, cc.xy(7, 11)); // ---- tidTextField ---- tidTextField.setEditable(false); tidTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(tidTextField, cc.xywh(9, 11, 3, 1)); // ---- label4 ---- label4.setText(bundle.getString("JProgramTags.label4.text")); label4.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label4, cc.xy(7, 13)); // ---- epcTextField ---- epcTextField.setEditable(false); epcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(epcTextField, cc.xywh(9, 13, 3, 1)); // ---- label5 ---- label5.setText(bundle.getString("JProgramTags.label5.text")); label5.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label5, cc.xy(7, 15)); // ---- programmedEpcTextField ---- programmedEpcTextField.setEditable(false); programmedEpcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(programmedEpcTextField, cc.xywh(9, 15, 3, 1)); // ======== scrollPane1 ======== { scrollPane1.setViewportView(tagReadTable); } contentPanel.add(scrollPane1, cc.xywh(3, 17, 9, 1)); // ---- lockCheckbox ---- lockCheckbox.setText(bundle.getString("JProgramTags.lockCheckbox.text")); lockCheckbox.setSelected(true); lockCheckbox.setFont(new Font("Tahoma", Font.PLAIN, 14)); lockCheckbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { checkBox2ItemStateChanged(e); } }); contentPanel.add(lockCheckbox, cc.xy(3, 19)); // ---- label2 ---- label2.setText(bundle.getString("JProgramTags.label2.text")); label2.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label2, cc.xy(5, 19)); // ---- accessPasswordTextField ---- accessPasswordTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(accessPasswordTextField, cc.xy(7, 19)); // ---- label6 ---- label6.setText(bundle.getString("JProgramTags.label6.text")); label6.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(label6, cc.xy(5, 21)); // ---- killPasswordTextField ---- killPasswordTextField.setFont(new Font("Tahoma", Font.PLAIN, 14)); contentPanel.add(killPasswordTextField, cc.xy(7, 21)); // ---- checkBox1 ---- checkBox1.setText(bundle.getString("JProgramTags.checkBox1.text")); checkBox1.setEnabled(false); contentPanel.add(checkBox1, cc.xy(9, 21)); } dialogPane.add(contentPanel, BorderLayout.EAST); // ======== buttonBar ======== { buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER); buttonBar.setLayout( new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC }, RowSpec.decodeSpecs("pref"))); // ---- closeButton ---- closeButton.setText("Cerrar"); closeButton.setFont(new Font("Tahoma", Font.PLAIN, 14)); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { closeButtonActionPerformed(e); } }); buttonBar.add(closeButton, cc.xy(2, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(700, 625); setLocationRelativeTo(getOwner()); // //GEN-END:initComponents }
From source file:tkwatch.Utilities.java
/** * Returns a standard panel for the bottom (SOUTH) of all windows. *///from w ww. j a va2 s. c om public static final JPanel getStatusPanel() { ImageIcon poweredByT4j = new ImageIcon("poweredByT4j.gif"); // TODO Messageline currently used for Twitter4J banner. Could be used // for expected status messages, currently implemented as dialog boxes. final JLabel messageLine = new JLabel(); messageLine.setIcon(poweredByT4j); final JPanel buttonPanel = new JPanel(new GridLayout(Constants.ONE_ROW, Constants.THREE_COLUMNS)); buttonPanel.add(getQuitButton()); final JPanel statusPanel = new JPanel(new BorderLayout()); statusPanel.add(messageLine, BorderLayout.WEST); statusPanel.add(buttonPanel, BorderLayout.EAST); statusPanel.updateUI(); return statusPanel; }
From source file:metdemo.Finance.Pluggable.java
protected void addBottomControls(final JPanel jp) { final JPanel control_panel = new JPanel(); jp.add(control_panel, BorderLayout.SOUTH); control_panel.setLayout(new BorderLayout()); final Box vertex_panel = Box.createVerticalBox(); vertex_panel.setBorder(BorderFactory.createTitledBorder("Vertices")); final Box edge_panel = Box.createVerticalBox(); edge_panel.setBorder(BorderFactory.createTitledBorder("Edges")); final Box both_panel = Box.createVerticalBox(); control_panel.add(vertex_panel, BorderLayout.WEST); control_panel.add(edge_panel, BorderLayout.EAST); control_panel.add(both_panel, BorderLayout.CENTER); // set up vertex controls v_color = new JCheckBox("vertex seed coloring"); v_color.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vcf.setSeedColoring(v_color.isSelected()); }/*from w w w . ja v a2s . c o m*/ }); v_stroke = new JCheckBox("<html>vertex selection<p>stroke highlighting</html>"); v_stroke.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vsh.setHighlight(v_stroke.isSelected()); } }); v_labels = new JCheckBox("show vertex ranks (voltages)"); v_labels.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (v_labels.isSelected()) pr.setVertexStringer(vs); else pr.setVertexStringer(vs_none); } }); v_shape = new JCheckBox("vertex degree shapes"); v_shape.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vssa.useFunnyShapes(v_shape.isSelected()); } }); v_size = new JCheckBox("vertex voltage size"); v_size.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vssa.setScaling(v_size.isSelected()); } }); v_aspect = new JCheckBox("vertex degree ratio stretch"); v_aspect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { vssa.setStretching(v_aspect.isSelected()); } }); v_small = new JCheckBox("filter vertices of degree < " + VertexDisplayPredicate.MIN_DEGREE); v_small.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { show_vertex.filterSmall(v_small.isSelected()); } }); vertex_panel.add(v_color); vertex_panel.add(v_stroke); vertex_panel.add(v_labels); vertex_panel.add(v_shape); vertex_panel.add(v_size); vertex_panel.add(v_aspect); vertex_panel.add(v_small); // set up edge controls JPanel gradient_panel = new JPanel(new GridLayout(1, 0)); gradient_panel.setBorder(BorderFactory.createTitledBorder("Edge paint")); no_gradient = new JRadioButton("Solid color"); no_gradient.setSelected(true); no_gradient.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { gradient_level = GRADIENT_NONE; } }); // gradient_absolute = new JRadioButton("Absolute gradient"); // gradient_absolute.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) { gradient_level = GRADIENT_ABSOLUTE;}}); gradient_relative = new JRadioButton("Gradient"); gradient_relative.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { gradient_level = GRADIENT_RELATIVE; } }); ButtonGroup bg_grad = new ButtonGroup(); bg_grad.add(no_gradient); bg_grad.add(gradient_relative); //bg_grad.add(gradient_absolute); gradient_panel.add(no_gradient); //gradientGrid.add(gradient_absolute); gradient_panel.add(gradient_relative); JPanel shape_panel = new JPanel(new GridLayout(3, 2)); shape_panel.setBorder(BorderFactory.createTitledBorder("Edge shape")); e_line = new JRadioButton("line"); e_line.setSelected(true); e_line.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pr.setEdgeShapeFunction(new EdgeShape.Line()); } }); // e_bent = new JRadioButton("bent line"); // e_bent.setSelected(true); e_wedge = new JRadioButton("wedge"); e_wedge.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pr.setEdgeShapeFunction(new EdgeShape.Wedge(10)); } }); e_quad = new JRadioButton("quad curve"); e_quad.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pr.setEdgeShapeFunction(new EdgeShape.QuadCurve()); } }); e_cubic = new JRadioButton("cubic curve"); e_cubic.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pr.setEdgeShapeFunction(new EdgeShape.CubicCurve()); } }); ButtonGroup bg_shape = new ButtonGroup(); bg_shape.add(e_line); // bg.add(e_bent); bg_shape.add(e_wedge); bg_shape.add(e_quad); bg_shape.add(e_cubic); shape_panel.add(e_line); // shape_panel.add(e_bent); shape_panel.add(e_wedge); shape_panel.add(e_quad); shape_panel.add(e_cubic); fill_edges = new JCheckBox("fill edge shapes"); fill_edges.setSelected(false); fill_edges.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { edgePaint.useFill(fill_edges.isSelected()); } }); shape_panel.add(fill_edges); shape_panel.setOpaque(true); e_color = new JCheckBox("edge weight highlighting"); e_color.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ewcs.setWeighted(e_color.isSelected()); } }); e_labels = new JCheckBox("show edge weights"); e_labels.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (e_labels.isSelected()) pr.setEdgeStringer(es); else pr.setEdgeStringer(es_none); } }); e_uarrow_pred = new JCheckBox("undirected"); e_uarrow_pred.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { show_arrow.showUndirected(e_uarrow_pred.isSelected()); } }); e_darrow_pred = new JCheckBox("directed"); e_darrow_pred.setSelected(true); e_darrow_pred.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { show_arrow.showDirected(e_darrow_pred.isSelected()); } }); JPanel arrow_panel = new JPanel(new GridLayout(1, 0)); arrow_panel.setBorder(BorderFactory.createTitledBorder("Show arrows")); arrow_panel.add(e_uarrow_pred); arrow_panel.add(e_darrow_pred); e_show_d = new JCheckBox("directed"); e_show_d.setSelected(true); e_show_d.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { show_edge.showDirected(e_show_d.isSelected()); } }); e_show_u = new JCheckBox("undirected"); e_show_u.setSelected(true); e_show_u.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { show_edge.showUndirected(e_show_u.isSelected()); } }); JPanel show_edge_panel = new JPanel(new GridLayout(1, 0)); show_edge_panel.setBorder(BorderFactory.createTitledBorder("Show edges")); show_edge_panel.add(e_show_u); show_edge_panel.add(e_show_d); shape_panel.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(shape_panel); gradient_panel.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(gradient_panel); show_edge_panel.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(show_edge_panel); arrow_panel.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(arrow_panel); e_color.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(e_color); e_labels.setAlignmentX(Component.LEFT_ALIGNMENT); edge_panel.add(e_labels); // set up zoom controls zoom_at_mouse = new JCheckBox("<html><center>zoom at mouse<p>(wheel only)</center></html>"); zoom_at_mouse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { gm.setZoomAtMouse(zoom_at_mouse.isSelected()); } }); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // call listener in GraphMouse instead of manipulating vv scale directly // this is so the crossover from zoom to scale works with the buttons // as well as with the mouse wheel Dimension d = vv.getSize(); gm.mouseWheelMoved(new MouseWheelEvent(vv, MouseEvent.MOUSE_WHEEL, System.currentTimeMillis(), 0, d.width / 2, d.height / 2, 1, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, 1)); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // call listener in GraphMouse instead of manipulating vv scale directly // this is so the crossover from zoom to scale works with the buttons // as well as with the mouse wheel Dimension d = vv.getSize(); gm.mouseWheelMoved(new MouseWheelEvent(vv, MouseEvent.MOUSE_WHEEL, System.currentTimeMillis(), 0, d.width / 2, d.height / 2, 1, false, MouseWheelEvent.WHEEL_UNIT_SCROLL, 1, -1)); } }); Box zoomPanel = Box.createVerticalBox(); zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom")); plus.setAlignmentX(Component.CENTER_ALIGNMENT); zoomPanel.add(plus); minus.setAlignmentX(Component.CENTER_ALIGNMENT); zoomPanel.add(minus); zoom_at_mouse.setAlignmentX(Component.CENTER_ALIGNMENT); zoomPanel.add(zoom_at_mouse); // add font and zoom controls to center panel font = new JCheckBox("bold text"); font.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ff.setBold(font.isSelected()); } }); font.setAlignmentX(Component.CENTER_ALIGNMENT); both_panel.add(zoomPanel); both_panel.add(font); JComboBox modeBox = gm.getModeComboBox(); modeBox.setAlignmentX(Component.CENTER_ALIGNMENT); JPanel modePanel = new JPanel(new BorderLayout()) { public Dimension getMaximumSize() { return getPreferredSize(); } }; modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modePanel.add(modeBox); both_panel.add(modePanel); }
From source file:org.apache.oodt.cas.workflow.gui.perspective.view.impl.DefaultTreeView.java
@Override public void refreshView(final ViewState state) { Rectangle visibleRect = null; if (this.tree != null) { visibleRect = this.tree.getVisibleRect(); }/*from w ww. ja v a 2 s .co m*/ this.removeAll(); this.actionsMenu = this.createPopupMenu(state); DefaultMutableTreeNode root = new DefaultMutableTreeNode("WORKFLOWS"); for (ModelGraph graph : state.getGraphs()) { root.add(this.buildTree(graph, state)); } tree = new JTree(root); tree.setShowsRootHandles(true); tree.setRootVisible(false); tree.add(this.actionsMenu); if (state.getSelected() != null) { // System.out.println("SELECTED: " + state.getSelected()); TreePath treePath = this.getTreePath(root, state.getSelected()); if (state.getCurrentMetGroup() != null) { treePath = this.getTreePath(treePath, state); } else if (Boolean.parseBoolean(state.getFirstPropertyValue(EXPAND_STATIC_METADATA))) { DefaultMutableTreeNode baseNode = (DefaultMutableTreeNode) treePath.getLastPathComponent(); for (int i = 0; i < baseNode.getChildCount(); i++) { if (((DefaultMutableTreeNode) baseNode.getChildAt(i)).getUserObject() .equals("static-metadata")) { treePath = new TreePath(((DefaultMutableTreeNode) baseNode.getChildAt(i)).getPath()); break; } } } else if (Boolean.parseBoolean(state.getFirstPropertyValue(EXPAND_PRECONDITIONS))) { if (treePath == null) { treePath = this.getTreePath(root, state.getSelected().getPreConditions()); } DefaultMutableTreeNode baseNode = (DefaultMutableTreeNode) treePath.getLastPathComponent(); for (int i = 0; i < baseNode.getChildCount(); i++) { if (((DefaultMutableTreeNode) baseNode.getChildAt(i)).getUserObject() .equals("pre-conditions")) { treePath = new TreePath(((DefaultMutableTreeNode) baseNode.getChildAt(i)).getPath()); break; } } } else if (Boolean.parseBoolean(state.getFirstPropertyValue(EXPAND_POSTCONDITIONS))) { if (treePath == null) { treePath = this.getTreePath(root, state.getSelected().getPostConditions()); } DefaultMutableTreeNode baseNode = (DefaultMutableTreeNode) treePath.getLastPathComponent(); for (int i = 0; i < baseNode.getChildCount(); i++) { if (((DefaultMutableTreeNode) baseNode.getChildAt(i)).getUserObject() .equals("post-conditions")) { treePath = new TreePath(((DefaultMutableTreeNode) baseNode.getChildAt(i)).getPath()); break; } } } this.tree.expandPath(treePath); this.tree.setSelectionPath(treePath); } tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { if (e.getPath().getLastPathComponent() instanceof DefaultMutableTreeNode) { DefaultTreeView.this.resetProperties(state); DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.getPath().getLastPathComponent(); if (node.getUserObject() instanceof ModelGraph) { state.setSelected((ModelGraph) node.getUserObject()); state.setCurrentMetGroup(null); DefaultTreeView.this.notifyListeners(); } else if (node.getUserObject().equals("static-metadata") || node.getUserObject().equals("pre-conditions") || node.getUserObject().equals("post-conditions")) { state.setSelected((ModelGraph) ((DefaultMutableTreeNode) node.getParent()).getUserObject()); state.setCurrentMetGroup(null); state.setProperty(EXPAND_STATIC_METADATA, Boolean.toString(node.getUserObject().equals("static-metadata"))); state.setProperty(EXPAND_PRECONDITIONS, Boolean.toString(node.getUserObject().equals("pre-conditions"))); state.setProperty(EXPAND_POSTCONDITIONS, Boolean.toString(node.getUserObject().equals("post-conditions"))); DefaultTreeView.this.notifyListeners(); } else if (node.getUserObject() instanceof ConcurrentHashMap) { DefaultMutableTreeNode metNode = null; String group = null; Object[] path = e.getPath().getPath(); for (int i = path.length - 1; i >= 0; i--) { if (((DefaultMutableTreeNode) path[i]).getUserObject() instanceof ModelGraph) { metNode = (DefaultMutableTreeNode) path[i]; break; } else if (((DefaultMutableTreeNode) path[i]) .getUserObject() instanceof ConcurrentHashMap) { if (group == null) { group = (String) ((ConcurrentHashMap<String, String>) ((DefaultMutableTreeNode) path[i]) .getUserObject()).keySet().iterator().next(); } else { group = (String) ((ConcurrentHashMap<String, String>) ((DefaultMutableTreeNode) path[i]) .getUserObject()).keySet().iterator().next() + "/" + group; } } } ModelGraph graph = (ModelGraph) metNode.getUserObject(); state.setSelected(graph); state.setCurrentMetGroup(group); DefaultTreeView.this.notifyListeners(); } else { state.setSelected(null); DefaultTreeView.this.notifyListeners(); } } } }); tree.setCellRenderer(new TreeCellRenderer() { public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; if (node.getUserObject() instanceof String) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JLabel label = new JLabel((String) node.getUserObject()); label.setForeground(Color.blue); panel.add(label, BorderLayout.CENTER); panel.setBackground(selected ? Color.lightGray : Color.white); return panel; } else if (node.getUserObject() instanceof ModelGraph) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JLabel iconLabel = new JLabel( ((ModelGraph) node.getUserObject()).getModel().getExecutionType() + ": "); iconLabel.setForeground(((ModelGraph) node.getUserObject()).getModel().getColor()); iconLabel.setBackground(Color.white); JLabel idLabel = new JLabel(((ModelGraph) node.getUserObject()).getModel().getModelName()); idLabel.setBackground(Color.white); panel.add(iconLabel, BorderLayout.WEST); panel.add(idLabel, BorderLayout.CENTER); panel.setBackground(selected ? Color.lightGray : Color.white); return panel; } else if (node.getUserObject() instanceof ConcurrentHashMap) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); String group = (String) ((ConcurrentHashMap<String, String>) node.getUserObject()).keySet() .iterator().next(); JLabel nameLabel = new JLabel(group + " : "); nameLabel.setForeground(Color.blue); nameLabel.setBackground(Color.white); JLabel valueLabel = new JLabel( ((ConcurrentHashMap<String, String>) node.getUserObject()).get(group)); valueLabel.setForeground(Color.darkGray); valueLabel.setBackground(Color.white); panel.add(nameLabel, BorderLayout.WEST); panel.add(valueLabel, BorderLayout.EAST); panel.setBackground(selected ? Color.lightGray : Color.white); return panel; } else { return new JLabel(); } } }); tree.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON3 && DefaultTreeView.this.tree.getSelectionPath() != null) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) DefaultTreeView.this.tree .getSelectionPath().getLastPathComponent(); if (node.getUserObject() instanceof String && !(node.getUserObject().equals("pre-conditions") || node.getUserObject().equals("post-conditions"))) { return; } orderSubMenu.setEnabled(node.getUserObject() instanceof ModelGraph && !((ModelGraph) node.getUserObject()).isCondition() && ((ModelGraph) node.getUserObject()).getParent() != null); DefaultTreeView.this.actionsMenu.show(DefaultTreeView.this.tree, e.getX(), e.getY()); } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }); this.scrollPane = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); this.add(this.scrollPane, BorderLayout.CENTER); if (visibleRect != null) { this.tree.scrollRectToVisible(visibleRect); } this.revalidate(); }