List of usage examples for javax.swing ButtonGroup ButtonGroup
public ButtonGroup()
ButtonGroup
. From source file:edu.uci.ics.jung.samples.PluggableRendererDemo.java
/** * @param jp panel to which controls will be added *//*from w w w .j a va 2s. c om*/ @SuppressWarnings({ "rawtypes", "unchecked" }) protected void addBottomControls(final JPanel jp) { final JPanel control_panel = new JPanel(); jp.add(control_panel, BorderLayout.EAST); 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.NORTH); control_panel.add(edge_panel, BorderLayout.SOUTH); control_panel.add(both_panel, BorderLayout.CENTER); // set up vertex controls v_color = new JCheckBox("seed highlight"); v_color.addActionListener(this); v_stroke = new JCheckBox("stroke highlight on selection"); v_stroke.addActionListener(this); v_labels = new JCheckBox("show voltage values"); v_labels.addActionListener(this); v_shape = new JCheckBox("shape by degree"); v_shape.addActionListener(this); v_size = new JCheckBox("size by voltage"); v_size.addActionListener(this); v_size.setSelected(true); v_aspect = new JCheckBox("stretch by degree ratio"); v_aspect.addActionListener(this); v_small = new JCheckBox("filter when degree < " + VertexDisplayPredicate.MIN_DEGREE); v_small.addActionListener(this); 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.addActionListener(this); no_gradient.setSelected(true); // gradient_absolute = new JRadioButton("Absolute gradient"); // gradient_absolute.addActionListener(this); gradient_relative = new JRadioButton("Gradient"); gradient_relative.addActionListener(this); 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.addActionListener(this); e_line.setSelected(true); // e_bent = new JRadioButton("bent line"); // e_bent.addActionListener(this); e_wedge = new JRadioButton("wedge"); e_wedge.addActionListener(this); e_quad = new JRadioButton("quad curve"); e_quad.addActionListener(this); e_cubic = new JRadioButton("cubic curve"); e_cubic.addActionListener(this); e_ortho = new JRadioButton("orthogonal"); e_ortho.addActionListener(this); 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_ortho); 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); shape_panel.add(e_ortho); fill_edges = new JCheckBox("fill edge shapes"); fill_edges.setSelected(false); fill_edges.addActionListener(this); shape_panel.add(fill_edges); shape_panel.setOpaque(true); e_color = new JCheckBox("highlight edge weights"); e_color.addActionListener(this); e_labels = new JCheckBox("show edge weight values"); e_labels.addActionListener(this); e_uarrow_pred = new JCheckBox("undirected"); e_uarrow_pred.addActionListener(this); e_darrow_pred = new JCheckBox("directed"); e_darrow_pred.addActionListener(this); e_darrow_pred.setSelected(true); e_arrow_centered = new JCheckBox("centered"); e_arrow_centered.addActionListener(this); 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); arrow_panel.add(e_arrow_centered); e_show_d = new JCheckBox("directed"); e_show_d.addActionListener(this); e_show_d.setSelected(true); e_show_u = new JCheckBox("undirected"); e_show_u.addActionListener(this); e_show_u.setSelected(true); 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(this); zoom_at_mouse.setSelected(true); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JPanel zoomPanel = new JPanel(); 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); JPanel fontPanel = new JPanel(); // add font and zoom controls to center panel font = new JCheckBox("bold text"); font.addActionListener(this); font.setAlignmentX(Component.CENTER_ALIGNMENT); fontPanel.add(font); both_panel.add(zoomPanel); both_panel.add(fontPanel); 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); JPanel comboGrid = new JPanel(new GridLayout(0, 1)); comboGrid.add(modePanel); fontPanel.add(comboGrid); JComboBox cb = new JComboBox(); cb.addItem(Renderer.VertexLabel.Position.N); cb.addItem(Renderer.VertexLabel.Position.NE); cb.addItem(Renderer.VertexLabel.Position.E); cb.addItem(Renderer.VertexLabel.Position.SE); cb.addItem(Renderer.VertexLabel.Position.S); cb.addItem(Renderer.VertexLabel.Position.SW); cb.addItem(Renderer.VertexLabel.Position.W); cb.addItem(Renderer.VertexLabel.Position.NW); cb.addItem(Renderer.VertexLabel.Position.N); cb.addItem(Renderer.VertexLabel.Position.CNTR); cb.addItem(Renderer.VertexLabel.Position.AUTO); cb.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { Renderer.VertexLabel.Position position = (Renderer.VertexLabel.Position) e.getItem(); vv.getRenderer().getVertexLabelRenderer().setPosition(position); vv.repaint(); } }); cb.setSelectedItem(Renderer.VertexLabel.Position.SE); JPanel positionPanel = new JPanel(); positionPanel.setBorder(BorderFactory.createTitledBorder("Label Position")); positionPanel.add(cb); comboGrid.add(positionPanel); }
From source file:cl.almejo.vsim.gui.SimWindow.java
private JPanel getToolsPane() { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(0, 2)); ButtonGroup group = new ButtonGroup(); JToggleButton button = newGrouppedButton(CURSOR_TOOL_ACTION, group); button.setSelected(true);// w w w . j a v a 2s . c o m panel.add(button); panel.add(newGrouppedButton(MOVE_VIEWPORT_TOOL_ACTION, group)); panel.add(newGrouppedButton(WIRES_TOOL_ACTION, group)); panel.add(newGrouppedButton(AND2_TOOL_ACTION, group)); panel.add(newGrouppedButton(AND3_TOOL_ACTION, group)); panel.add(newGrouppedButton(AND4_TOOL_ACTION, group)); panel.add(newGrouppedButton(OR2_TOOL_ACTION, group)); panel.add(newGrouppedButton(OR3_TOOL_ACTION, group)); panel.add(newGrouppedButton(OR4_TOOL_ACTION, group)); panel.add(newGrouppedButton(XOR2_TOOL_ACTION, group)); panel.add(newGrouppedButton(XOR3_TOOL_ACTION, group)); panel.add(newGrouppedButton(XOR4_TOOL_ACTION, group)); panel.add(newGrouppedButton(NOT_TOOL_ACTION, group)); panel.add(newGrouppedButton(CLOCK_TOOL_ACTION, group)); panel.add(newGrouppedButton(FLIP_FLOP_DATA_TOOL_ACTION, group)); panel.add(newGrouppedButton(SEVEN_SEGMENTS_DISPLAY_TOOL_ACTION, group)); panel.add(newGrouppedButton(SEVEN_SEGMENTS_DISPLAY_DOUBLE_TOOL_ACTION, group)); panel.add(newGrouppedButton(TRISTATE_TOOL_ACTION, group)); panel.add(newGrouppedButton(LED_TOOL_ACTION, group)); panel.add(newGrouppedButton(TIME_DIAGRAM_TOOL_ACTION, group)); panel.add(newGrouppedButton(SWITCH_TOOL_ACTION, group)); return panel; }
From source file:com.google.code.facebook.graph.sna.applet.PluggableRendererDemo.java
/** * @param jp panel to which controls will be added *//* w w w . ja v a 2s . c om*/ @SuppressWarnings("serial") protected void addBottomControls(final JPanel jp) { final JPanel control_panel = new JPanel(); jp.add(control_panel, BorderLayout.EAST); 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.NORTH); control_panel.add(edge_panel, BorderLayout.SOUTH); control_panel.add(both_panel, BorderLayout.CENTER); // set up vertex controls v_color = new JCheckBox("seed highlight"); v_color.addActionListener(this); v_stroke = new JCheckBox("stroke highlight on selection"); v_stroke.addActionListener(this); v_labels = new JCheckBox("show voltage values"); v_labels.addActionListener(this); v_shape = new JCheckBox("shape by degree"); v_shape.addActionListener(this); v_size = new JCheckBox("size by voltage"); v_size.addActionListener(this); v_size.setSelected(true); v_aspect = new JCheckBox("stretch by degree ratio"); v_aspect.addActionListener(this); v_small = new JCheckBox("filter when degree < " + VertexDisplayPredicate.MIN_DEGREE); v_small.addActionListener(this); 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.addActionListener(this); no_gradient.setSelected(true); // gradient_absolute = new JRadioButton("Absolute gradient"); // gradient_absolute.addActionListener(this); gradient_relative = new JRadioButton("Gradient"); gradient_relative.addActionListener(this); 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.addActionListener(this); e_line.setSelected(true); // e_bent = new JRadioButton("bent line"); // e_bent.addActionListener(this); e_wedge = new JRadioButton("wedge"); e_wedge.addActionListener(this); e_quad = new JRadioButton("quad curve"); e_quad.addActionListener(this); e_cubic = new JRadioButton("cubic curve"); e_cubic.addActionListener(this); e_ortho = new JRadioButton("orthogonal"); e_ortho.addActionListener(this); 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_ortho); 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); shape_panel.add(e_ortho); fill_edges = new JCheckBox("fill edge shapes"); fill_edges.setSelected(false); fill_edges.addActionListener(this); shape_panel.add(fill_edges); shape_panel.setOpaque(true); e_color = new JCheckBox("highlight edge weights"); e_color.addActionListener(this); e_labels = new JCheckBox("show edge weight values"); e_labels.addActionListener(this); e_uarrow_pred = new JCheckBox("undirected"); e_uarrow_pred.addActionListener(this); e_darrow_pred = new JCheckBox("directed"); e_darrow_pred.addActionListener(this); e_darrow_pred.setSelected(true); e_arrow_centered = new JCheckBox("centered"); e_arrow_centered.addActionListener(this); 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); arrow_panel.add(e_arrow_centered); e_show_d = new JCheckBox("directed"); e_show_d.addActionListener(this); e_show_d.setSelected(true); e_show_u = new JCheckBox("undirected"); e_show_u.addActionListener(this); e_show_u.setSelected(true); 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(this); zoom_at_mouse.setSelected(true); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JPanel zoomPanel = new JPanel(); 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); JPanel fontPanel = new JPanel(); // add font and zoom controls to center panel font = new JCheckBox("bold text"); font.addActionListener(this); font.setAlignmentX(Component.CENTER_ALIGNMENT); fontPanel.add(font); both_panel.add(zoomPanel); both_panel.add(fontPanel); 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); JPanel comboGrid = new JPanel(new GridLayout(0, 1)); comboGrid.add(modePanel); fontPanel.add(comboGrid); JComboBox cb = new JComboBox(); cb.addItem(Renderer.VertexLabel.Position.N); cb.addItem(Renderer.VertexLabel.Position.NE); cb.addItem(Renderer.VertexLabel.Position.E); cb.addItem(Renderer.VertexLabel.Position.SE); cb.addItem(Renderer.VertexLabel.Position.S); cb.addItem(Renderer.VertexLabel.Position.SW); cb.addItem(Renderer.VertexLabel.Position.W); cb.addItem(Renderer.VertexLabel.Position.NW); cb.addItem(Renderer.VertexLabel.Position.N); cb.addItem(Renderer.VertexLabel.Position.CNTR); cb.addItem(Renderer.VertexLabel.Position.AUTO); cb.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { Renderer.VertexLabel.Position position = (Renderer.VertexLabel.Position) e.getItem(); vv.getRenderer().getVertexLabelRenderer().setPosition(position); vv.repaint(); } }); cb.setSelectedItem(Renderer.VertexLabel.Position.SE); JPanel positionPanel = new JPanel(); positionPanel.setBorder(BorderFactory.createTitledBorder("Label Position")); positionPanel.add(cb); comboGrid.add(positionPanel); }
From source file:edu.ucla.stat.SOCR.chart.SuperPieChart.java
public void initMapPanel() { listIndex = new int[dataTable.getColumnCount()]; for (int j = 0; j < listIndex.length; j++) listIndex[j] = 1;/*ww w. j a va2s . com*/ bPanel = new JPanel(new BorderLayout()); mapPanel = new JPanel(new GridLayout(2, 5, 50, 50)); bPanel.add(mapPanel, BorderLayout.CENTER); // bPanel.add(new JPanel(),BorderLayout.NORTH); addButton1.addActionListener(this); addButton2.addActionListener(this); addButton3.addActionListener(this); removeButton1.addActionListener(this); removeButton2.addActionListener(this); removeButton3.addActionListener(this); lModelAdded = new DefaultListModel(); lModelDep = new DefaultListModel(); lModelIndep = new DefaultListModel(); lModelPullout = new DefaultListModel(); int cellWidth = 10; listAdded = new JList(lModelAdded); listAdded.setSelectedIndex(0); listDepRemoved = new JList(lModelDep); listIndepRemoved = new JList(lModelIndep); listPulloutRemoved = new JList(lModelPullout); paintTable(listIndex); listAdded.setFixedCellWidth(cellWidth); listDepRemoved.setFixedCellWidth(cellWidth); listIndepRemoved.setFixedCellWidth(cellWidth); listPulloutRemoved.setFixedCellWidth(cellWidth); tools1 = new JToolBar(JToolBar.VERTICAL); tools2 = new JToolBar(JToolBar.VERTICAL); tools3 = new JToolBar(JToolBar.VERTICAL); if (mapDep) { tools1.add(depLabel); tools1.add(addButton1); tools1.add(removeButton1); } if (mapIndep) { tools2.add(indLabel); tools2.add(addButton2); tools2.add(removeButton2); } if (mapPullout) { tools3.add(pulloutLabel); tools3.add(addButton3); tools3.add(removeButton3); } tools1.setFloatable(false); tools2.setFloatable(false); tools3.setFloatable(false); /* topPanel.add(listAdded); topPanel.add(addButton); topPanel.add(listDepRemoved); bottomPanel.add(listIndepRemoved); bottomPanel.add(addButton2); bottomPanel.add(list4); */ JRadioButton legendPanelOnSwitch; JRadioButton legendPanelOffSwitch; // JPanel choicesPanel = new JPanel(); choicesPanel.setLayout(new BoxLayout(choicesPanel, BoxLayout.Y_AXIS)); legendPanelOnSwitch = new JRadioButton("On"); legendPanelOnSwitch.addActionListener(this); legendPanelOnSwitch.setActionCommand(LEGENDON); legendPanelOnSwitch.setSelected(false); legendPanelOn = false; legendPanelOffSwitch = new JRadioButton("Off"); legendPanelOffSwitch.addActionListener(this); legendPanelOffSwitch.setActionCommand(LEGENDOFF); legendPanelOffSwitch.setSelected(true); ButtonGroup group = new ButtonGroup(); group.add(legendPanelOnSwitch); group.add(legendPanelOffSwitch); choicesPanel.add(new JLabel("Turn the legend panel:")); choicesPanel.add(legendPanelOnSwitch); choicesPanel.add(legendPanelOffSwitch); choicesPanel.setPreferredSize(new Dimension(200, 100)); JRadioButton rotateOnSwitch; JRadioButton rotateOffSwitch; // JPanel rotateChoicesPanel = new JPanel(); rotateChoicesPanel.setLayout(new BoxLayout(rotateChoicesPanel, BoxLayout.Y_AXIS)); rotateOnSwitch = new JRadioButton("On"); rotateOnSwitch.addActionListener(this); rotateOnSwitch.setActionCommand(ROTATEON); rotateOnSwitch.setSelected(false); rotateOn = false; rotateOffSwitch = new JRadioButton("Off"); rotateOffSwitch.addActionListener(this); rotateOffSwitch.setActionCommand(ROTATEOFF); rotateOffSwitch.setSelected(true); ButtonGroup group2 = new ButtonGroup(); group2.add(rotateOnSwitch); group2.add(rotateOffSwitch); choicesPanel.add(new JLabel("Turn the rotator:")); choicesPanel.add(rotateOnSwitch); choicesPanel.add(rotateOffSwitch); choicesPanel.setPreferredSize(new Dimension(200, 100)); JPanel emptyPanel = new JPanel(); JPanel emptyPanel2 = new JPanel(); JPanel emptyPanel3 = new JPanel(); //2X5 //first line mapPanel.add(new JScrollPane(listAdded)); mapPanel.add(tools1); mapPanel.add(new JScrollPane(listDepRemoved)); mapPanel.add(tools3); if (mapPullout) mapPanel.add(new JScrollPane(listPulloutRemoved)); else mapPanel.add(emptyPanel); //second line-- mapPanel.add(choicesPanel); mapPanel.add(tools2); mapPanel.add(new JScrollPane(listIndepRemoved)); mapPanel.add(emptyPanel2); mapPanel.add(emptyPanel3); }
From source file:de.unikassel.jung.PluggableRendererDemo.java
/** * @param jp//w w w. ja va 2s. c o m * panel to which controls will be added */ @SuppressWarnings("serial") protected void addBottomControls(final JPanel jp) { final JPanel control_panel = new JPanel(); jp.add(control_panel, BorderLayout.EAST); 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.NORTH); control_panel.add(edge_panel, BorderLayout.SOUTH); control_panel.add(both_panel, BorderLayout.CENTER); // set up vertex controls v_color = new JCheckBox("seed highlight"); v_color.addActionListener(this); v_stroke = new JCheckBox("stroke highlight on selection"); v_stroke.addActionListener(this); v_labels = new JCheckBox("show voltage values"); v_labels.addActionListener(this); v_shape = new JCheckBox("shape by degree"); v_shape.addActionListener(this); v_size = new JCheckBox("size by voltage"); v_size.addActionListener(this); v_size.setSelected(true); v_aspect = new JCheckBox("stretch by degree ratio"); v_aspect.addActionListener(this); v_small = new JCheckBox("filter when degree < " + VertexDisplayPredicate.MIN_DEGREE); v_small.addActionListener(this); 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.addActionListener(this); no_gradient.setSelected(true); // gradient_absolute = new JRadioButton("Absolute gradient"); // gradient_absolute.addActionListener(this); gradient_relative = new JRadioButton("Gradient"); gradient_relative.addActionListener(this); 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.addActionListener(this); e_line.setSelected(true); // e_bent = new JRadioButton("bent line"); // e_bent.addActionListener(this); e_wedge = new JRadioButton("wedge"); e_wedge.addActionListener(this); e_quad = new JRadioButton("quad curve"); e_quad.addActionListener(this); e_cubic = new JRadioButton("cubic curve"); e_cubic.addActionListener(this); e_ortho = new JRadioButton("orthogonal"); e_ortho.addActionListener(this); 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_ortho); 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); shape_panel.add(e_ortho); fill_edges = new JCheckBox("fill edge shapes"); fill_edges.setSelected(false); fill_edges.addActionListener(this); shape_panel.add(fill_edges); shape_panel.setOpaque(true); e_color = new JCheckBox("highlight edge weights"); e_color.addActionListener(this); e_labels = new JCheckBox("show edge weight values"); e_labels.addActionListener(this); e_uarrow_pred = new JCheckBox("undirected"); e_uarrow_pred.addActionListener(this); e_darrow_pred = new JCheckBox("directed"); e_darrow_pred.addActionListener(this); e_darrow_pred.setSelected(true); e_arrow_centered = new JCheckBox("centered"); e_arrow_centered.addActionListener(this); 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); arrow_panel.add(e_arrow_centered); e_show_d = new JCheckBox("directed"); e_show_d.addActionListener(this); e_show_d.setSelected(true); e_show_u = new JCheckBox("undirected"); e_show_u.addActionListener(this); e_show_u.setSelected(true); 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(this); zoom_at_mouse.setSelected(true); final ScalingControl scaler = new CrossoverScalingControl(); JButton plus = new JButton("+"); plus.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { scaler.scale(vv, 1.1f, vv.getCenter()); } }); JButton minus = new JButton("-"); minus.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { scaler.scale(vv, 1 / 1.1f, vv.getCenter()); } }); JPanel zoomPanel = new JPanel(); 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); JPanel fontPanel = new JPanel(); // add font and zoom controls to center panel font = new JCheckBox("bold text"); font.addActionListener(this); font.setAlignmentX(Component.CENTER_ALIGNMENT); fontPanel.add(font); both_panel.add(zoomPanel); both_panel.add(fontPanel); JComboBox modeBox = gm.getModeComboBox(); modeBox.setAlignmentX(Component.CENTER_ALIGNMENT); JPanel modePanel = new JPanel(new BorderLayout()) { @Override public Dimension getMaximumSize() { return getPreferredSize(); } }; modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode")); modePanel.add(modeBox); JPanel comboGrid = new JPanel(new GridLayout(0, 1)); comboGrid.add(modePanel); fontPanel.add(comboGrid); JComboBox cb = new JComboBox(); cb.addItem(Renderer.VertexLabel.Position.N); cb.addItem(Renderer.VertexLabel.Position.NE); cb.addItem(Renderer.VertexLabel.Position.E); cb.addItem(Renderer.VertexLabel.Position.SE); cb.addItem(Renderer.VertexLabel.Position.S); cb.addItem(Renderer.VertexLabel.Position.SW); cb.addItem(Renderer.VertexLabel.Position.W); cb.addItem(Renderer.VertexLabel.Position.NW); cb.addItem(Renderer.VertexLabel.Position.N); cb.addItem(Renderer.VertexLabel.Position.CNTR); cb.addItem(Renderer.VertexLabel.Position.AUTO); cb.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { Renderer.VertexLabel.Position position = (Renderer.VertexLabel.Position) e.getItem(); vv.getRenderer().getVertexLabelRenderer().setPosition(position); vv.repaint(); } }); cb.setSelectedItem(Renderer.VertexLabel.Position.SE); JPanel positionPanel = new JPanel(); positionPanel.setBorder(BorderFactory.createTitledBorder("Label Position")); positionPanel.add(cb); comboGrid.add(positionPanel); }
From source file:com.pingtel.sipviewer.SIPViewerFrame.java
protected void initMenu() { JMenu menu;/*from ww w .ja va 2 s . c om*/ JMenu submenu; JMenuItem menuItem; JRadioButtonMenuItem rbMenuItem; // Create the menu bar. JMenuBar menuBar = new JMenuBar(); this.setJMenuBar(menuBar); // Build the File menu. menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); menuBar.add(menu); // Add the load-file items to the File menu. menuItem = new JMenuItem(); menuItem.setAction(new icOpenFileAction()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.ALT_MASK)); menuItem.setMnemonic(KeyEvent.VK_F); menu.add(menuItem); menuItem = new JMenuItem(); menuItem.setAction(new icImportSyslogAction()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, ActionEvent.ALT_MASK)); menuItem.setMnemonic(KeyEvent.VK_Y); menu.add(menuItem); menu.addSeparator(); menuItem = new JMenuItem(); menuItem.setAction(new icSaveAsAction()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.ALT_MASK)); menuItem.setMnemonic(KeyEvent.VK_S); menu.add(menuItem); menu.addSeparator(); // Add the reload item to the File menu. menuItem = new JMenuItem(); menuItem.setAction(new icReloadAction()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.ALT_MASK)); menuItem.setMnemonic(KeyEvent.VK_R); menu.add(menuItem); menu.addSeparator(); // Add the quit item to the File menu. menuItem = new JMenuItem(); menuItem.setAction(new icQuitAction()); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.ALT_MASK)); menuItem.setMnemonic(KeyEvent.VK_Q); menu.add(menuItem); // Build the Options menu. menu = new JMenu("Options"); menu.setMnemonic(KeyEvent.VK_O); menuBar.add(menu); // Add the split/single screen mode to the options menu menuItem = new JMenuItem(); menuItem.setAction(new icScreenModeAction()); menuItem.setMnemonic(KeyEvent.VK_M); menu.add(menuItem); menu.addSeparator(); // Add the show all dialogs option to the options menu menuItem = new JMenuItem(); menuItem.setAction(new icShowAllDialogsAction()); menuItem.setMnemonic(KeyEvent.VK_D); menu.add(menuItem); menu.addSeparator(); // Add the Time Zone Selection Time submenu submenu = new JMenu("Time Zone Setting"); submenu.setMnemonic(KeyEvent.VK_Z); ButtonGroup timeZoneGroup = new ButtonGroup(); // Set Time Zone to Local Time Zone m_localTimeZone = new JRadioButtonMenuItem(); m_localTimeZone.setAction(new icSetTimeToLocalZone()); m_localTimeZone.setMnemonic(KeyEvent.VK_L); timeZoneGroup.add(m_localTimeZone); m_localTimeZone.setSelected(true); submenu.add(m_localTimeZone); // Set Time Zone to UTC Time Zone m_utcTimeZone = new JRadioButtonMenuItem(); m_utcTimeZone.setAction(new icSetTimeToUTCZone()); m_utcTimeZone.setMnemonic(KeyEvent.VK_U); timeZoneGroup.add(m_utcTimeZone); submenu.add(m_utcTimeZone); menu.add(submenu); // Add the show/hide time index column menuItem = new JMenuItem(); menuItem.setAction(new icTimeVisibilityAction()); menuItem.setMnemonic(KeyEvent.VK_V); menu.add(menuItem); // Add the Time Display Format submenu submenu = new JMenu("Time Display Format"); submenu.setMnemonic(KeyEvent.VK_T); ButtonGroup group = new ButtonGroup(); m_dateAndTimeFormat = new JRadioButtonMenuItem(); m_dateAndTimeFormat.setAction(new icDateAndTimeAction()); m_dateAndTimeFormat.setMnemonic(KeyEvent.VK_I); group.add(m_dateAndTimeFormat); submenu.add(m_dateAndTimeFormat); m_defaultTimeFormat = new JRadioButtonMenuItem(); m_defaultTimeFormat.setAction(new icTimeOfDay()); m_defaultTimeFormat.setMnemonic(KeyEvent.VK_E); m_defaultTimeFormat.setSelected(true); group.add(m_defaultTimeFormat); submenu.add(m_defaultTimeFormat); m_sincePreviousFormat = new JRadioButtonMenuItem(); m_sincePreviousFormat.setAction(new icSincePrevious()); m_sincePreviousFormat.setMnemonic(KeyEvent.VK_P); group.add(m_sincePreviousFormat); submenu.add(m_sincePreviousFormat); m_sinceBeginningFormat = new JRadioButtonMenuItem(); m_sinceBeginningFormat.setAction(new icSinceBeginning()); m_sinceBeginningFormat.setMnemonic(KeyEvent.VK_B); group.add(m_sinceBeginningFormat); submenu.add(m_sinceBeginningFormat); m_sinceKeyIndexFormat = new JRadioButtonMenuItem(); m_sinceKeyIndexFormat.setAction(new icSinceKeyIndex()); m_sinceKeyIndexFormat.setMnemonic(KeyEvent.VK_K); group.add(m_sinceKeyIndexFormat); submenu.add(m_sinceKeyIndexFormat); menu.add(submenu); // Build the Help menu. menu = new JMenu("Help"); menu.setMnemonic(KeyEvent.VK_H); menuBar.add(menu); // Add the items to the File menu. menuItem = new JMenuItem(); menuItem.setAction(new icAboutAction()); menu.add(menuItem); }
From source file:edu.ku.brc.specify.tasks.subpane.wb.DataImportDialog.java
/** * Creates ui panel for allowing user to select delimiters for csv import * @return//from w w w . j a va 2s .c o m * JPanel */ private JPanel createDelimiterPanel() { JPanel myPanel = new JPanel(); CellConstraints cc = new CellConstraints(); FormLayout formLayout = new FormLayout("p,p,2px, p:g,2px, p,2px,p,2px,", "p,1px, p,1px, p,1px , p,1px , p,1px , p,1px, p,1px "); PanelBuilder builder = new PanelBuilder(formLayout, myPanel); //Color curColor = myPanel.getBackground(); //Color newColor = curColor;//.brighter(); tab = createRadioButton(getResourceString("TAB")); tab.addItemListener(new DelimButtonItemListener()); //tab.setBackground(newColor); space = createRadioButton(getResourceString("SPACE")); space.addItemListener(new DelimButtonItemListener()); //space.setBackground(newColor); comma = createRadioButton(getResourceString("COMMA")); comma.addItemListener(new DelimButtonItemListener()); comma.setSelected(true); //comma.setBackground(newColor); semicolon = createRadioButton(getResourceString("SEMICOLON")); semicolon.addItemListener(new DelimButtonItemListener()); //semicolon.setBackground(newColor); other = createRadioButton(getResourceString("OTHER")); other.addItemListener(new DelimButtonItemListener()); //other.setBackground(newColor); otherText = createTextField(); otherText.addKeyListener(new CharFieldKeyAdapter()); otherText.setColumns(1); otherText.setEnabled(false); otherText.setEditable(false); otherText.setDocument(new CharLengthLimitDocument(1));//limits the textfield to only allowing on character ButtonGroup group = new ButtonGroup(); group.add(tab); group.add(space); group.add(other); group.add(comma); group.add(semicolon); builder.addSeparator(getResourceString("SELECT_DELIMS"), cc.xyw(1, 1, 4)); builder.add(comma, cc.xyw(1, 3, 4)); builder.add(semicolon, cc.xyw(1, 5, 4)); builder.add(space, cc.xyw(1, 7, 4)); builder.add(tab, cc.xyw(1, 9, 4)); builder.add(other, cc.xy(1, 11)); builder.add(otherText, cc.xy(2, 11)); //myPanel.setBackground(newColor); return myPanel; }
From source file:com.mirth.connect.connectors.file.FileReader.java
private void initComponents() { schemeLabel = new JLabel(); schemeLabel.setText("Method:"); schemeComboBox = new MirthComboBox(); schemeComboBox.setModel(new DefaultComboBoxModel(new String[] { "file", "ftp", "sftp", "smb", "webdav" })); schemeComboBox.setToolTipText(/*from w ww .j av a 2 s . co m*/ "The basic method used to access files to be read - file (local filesystem), FTP, SFTP, Samba share, or WebDAV"); schemeComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { schemeComboBoxActionPerformed(evt); } }); testConnectionButton = new JButton(); testConnectionButton.setText("Test Read"); testConnectionButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { testConnectionActionPerformed(evt); } }); advancedSettingsButton = new JButton(new ImageIcon(Frame.class.getResource("images/wrench.png"))); advancedSettingsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { advancedFileSettingsActionPerformed(); } }); summaryLabel = new JLabel("Advanced Options:"); summaryField = new JLabel(""); directoryLabel = new JLabel(); directoryLabel.setText("Directory:"); directoryField = new MirthTextField(); directoryField.setToolTipText("The directory (folder) in which the files to be read can be found."); hostLabel = new JLabel(); hostLabel.setText("ftp://"); hostField = new MirthTextField(); hostField.setToolTipText( "The name or IP address of the host (computer) on which the files to be read can be found."); pathLabel = new JLabel(); pathLabel.setText("/"); pathField = new MirthTextField(); pathField.setToolTipText("The directory (folder) in which the files to be read can be found."); filenameFilterLabel = new JLabel(); filenameFilterLabel.setText("Filename Filter Pattern:"); fileNameFilterField = new MirthTextField(); fileNameFilterField.setToolTipText( "<html>The pattern which names of files must match in order to be read.<br>Files with names that do not match the pattern will be ignored.</html>"); filenameFilterRegexCheckBox = new MirthCheckBox(); filenameFilterRegexCheckBox.setBackground(UIConstants.BACKGROUND_COLOR); filenameFilterRegexCheckBox.setText("Regular Expression"); filenameFilterRegexCheckBox.setToolTipText( "<html>If Regex is checked, the pattern is treated as a regular expression.<br>If Regex is not checked, it is treated as a pattern that supports wildcards and a comma separated list.</html>"); directoryRecursionLabel = new JLabel(); directoryRecursionLabel.setText("Include All Subdirectories:"); directoryRecursionYesRadio = new MirthRadioButton(); directoryRecursionYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); directoryRecursionYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); directoryRecursionYesRadio.setText("Yes"); directoryRecursionYesRadio.setToolTipText( "<html>Select Yes to traverse directories recursively and search for files in each one.</html>"); directoryRecursionYesRadio.setMargin(new Insets(0, 0, 0, 0)); directoryRecursionYesRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { directoryRecursionYesRadioActionPerformed(evt); } }); directoryRecursionNoRadio = new MirthRadioButton(); directoryRecursionNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); directoryRecursionNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); directoryRecursionNoRadio.setSelected(true); directoryRecursionNoRadio.setText("No"); directoryRecursionNoRadio.setToolTipText( "<html>Select No to only search for files in the selected directory/location, ignoring subdirectories.</html>"); directoryRecursionNoRadio.setMargin(new Insets(0, 0, 0, 0)); directoryRecursionButtonGroup = new ButtonGroup(); directoryRecursionButtonGroup.add(directoryRecursionYesRadio); directoryRecursionButtonGroup.add(directoryRecursionNoRadio); ignoreDotFilesLabel = new JLabel(); ignoreDotFilesLabel.setText("Ignore . files:"); ignoreDotFilesYesRadio = new MirthRadioButton(); ignoreDotFilesYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); ignoreDotFilesYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); ignoreDotFilesYesRadio.setText("Yes"); ignoreDotFilesYesRadio.setToolTipText("Select Yes to ignore all files starting with a period."); ignoreDotFilesYesRadio.setMargin(new Insets(0, 0, 0, 0)); ignoreDotFilesNoRadio = new MirthRadioButton(); ignoreDotFilesNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); ignoreDotFilesNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); ignoreDotFilesNoRadio.setText("No"); ignoreDotFilesNoRadio.setToolTipText("Select No to process files starting with a period."); ignoreDotFilesNoRadio.setMargin(new Insets(0, 0, 0, 0)); ignoreDotFilesButtonGroup = new ButtonGroup(); ignoreDotFilesButtonGroup.add(ignoreDotFilesYesRadio); ignoreDotFilesButtonGroup.add(ignoreDotFilesNoRadio); anonymousLabel = new JLabel(); anonymousLabel.setText("Anonymous:"); anonymousYesRadio = new MirthRadioButton(); anonymousYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); anonymousYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); anonymousYesRadio.setText("Yes"); anonymousYesRadio .setToolTipText("Connects to the file anonymously instead of using a username and password."); anonymousYesRadio.setMargin(new Insets(0, 0, 0, 0)); anonymousYesRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { anonymousYesActionPerformed(evt); } }); anonymousNoRadio = new MirthRadioButton(); anonymousNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); anonymousNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); anonymousNoRadio.setSelected(true); anonymousNoRadio.setText("No"); anonymousNoRadio .setToolTipText("Connects to the file using a username and password instead of anonymously."); anonymousNoRadio.setMargin(new Insets(0, 0, 0, 0)); anonymousNoRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { anonymousNoActionPerformed(evt); } }); anonymousButtonGroup = new ButtonGroup(); anonymousButtonGroup.add(anonymousYesRadio); anonymousButtonGroup.add(anonymousNoRadio); usernameLabel = new JLabel(); usernameLabel.setText("Username:"); usernameField = new MirthTextField(); usernameField.setToolTipText("The user name used to gain access to the server."); passwordLabel = new JLabel(); passwordLabel.setText("Password:"); passwordField = new MirthPasswordField(); passwordField.setToolTipText("The password used to gain access to the server."); timeoutLabel = new JLabel(); timeoutLabel.setText("Timeout (ms):"); timeoutField = new MirthTextField(); timeoutField.setToolTipText("The socket timeout (in ms) for connecting to the server."); secureModeLabel = new JLabel(); secureModeLabel.setText("Secure Mode:"); secureModeYesRadio = new MirthRadioButton(); secureModeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); secureModeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); secureModeYesRadio.setText("Yes"); secureModeYesRadio.setToolTipText( "<html>Select Yes to connect to the server via HTTPS.<br>Select No to connect via HTTP.</html>"); secureModeYesRadio.setMargin(new Insets(0, 0, 0, 0)); secureModeYesRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { secureModeYesActionPerformed(evt); } }); secureModeNoRadio = new MirthRadioButton(); secureModeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); secureModeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); secureModeNoRadio.setSelected(true); secureModeNoRadio.setText("No"); secureModeNoRadio.setToolTipText( "<html>Select Yes to connect to the server via HTTPS.<br>Select No to connect via HTTP.</html>"); secureModeNoRadio.setMargin(new Insets(0, 0, 0, 0)); secureModeNoRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { secureModeNoActionPerformed(evt); } }); secureModeButtonGroup = new ButtonGroup(); secureModeButtonGroup.add(secureModeYesRadio); secureModeButtonGroup.add(secureModeNoRadio); passiveModeLabel = new JLabel(); passiveModeLabel.setText("Passive Mode:"); passiveModeYesRadio = new MirthRadioButton(); passiveModeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); passiveModeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); passiveModeYesRadio.setText("Yes"); passiveModeYesRadio.setToolTipText( "<html>Select Yes to connect to the server in \"passive mode\".<br>Passive mode sometimes allows a connection through a firewall that normal mode does not.</html>"); passiveModeYesRadio.setMargin(new Insets(0, 0, 0, 0)); passiveModeNoRadio = new MirthRadioButton(); passiveModeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); passiveModeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); passiveModeNoRadio.setSelected(true); passiveModeNoRadio.setText("No"); passiveModeNoRadio.setToolTipText( "Select Yes to connect to the server in \"normal mode\" as opposed to passive mode."); passiveModeNoRadio.setMargin(new Insets(0, 0, 0, 0)); passiveModeButtonGroup = new ButtonGroup(); passiveModeButtonGroup.add(passiveModeYesRadio); passiveModeButtonGroup.add(passiveModeNoRadio); validateConnectionLabel = new JLabel(); validateConnectionLabel.setText("Validate Connection:"); validateConnectionYesRadio = new MirthRadioButton(); validateConnectionYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); validateConnectionYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); validateConnectionYesRadio.setText("Yes"); validateConnectionYesRadio .setToolTipText("Select Yes to test the connection to the server before each operation."); validateConnectionYesRadio.setMargin(new Insets(0, 0, 0, 0)); validateConnectionNoRadio = new MirthRadioButton(); validateConnectionNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); validateConnectionNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); validateConnectionNoRadio.setText("No"); validateConnectionNoRadio .setToolTipText("Select No to skip testing the connection to the server before each operation."); validateConnectionNoRadio.setMargin(new Insets(0, 0, 0, 0)); validateConnectionButtonGroup = new ButtonGroup(); validateConnectionButtonGroup.add(validateConnectionYesRadio); validateConnectionButtonGroup.add(validateConnectionNoRadio); afterProcessingActionLabel = new JLabel(); afterProcessingActionLabel.setText("After Processing Action:"); afterProcessingActionComboBox = new MirthComboBox(); afterProcessingActionComboBox.setModel(new DefaultComboBoxModel(new String[] { "None", "Move", "Delete" })); afterProcessingActionComboBox.setToolTipText( "<html>Select Move to move and/or rename the file after successful processing.<br/>Select Delete to delete the file after successful processing.</html>"); afterProcessingActionComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { afterProcessingActionComboBoxActionPerformed(evt); } }); moveToDirectoryLabel = new JLabel(); moveToDirectoryLabel.setText("Move-to Directory:"); moveToDirectoryField = new MirthTextField(); moveToDirectoryField.setToolTipText( "<html>If successfully processed files should be moved to a different directory (folder), enter that directory here.<br>The directory name specified may include template substitutions from the list to the right.<br>If this field is left empty, successfully processed files will not be moved to a different directory.</html>"); moveToFileNameLabel = new JLabel(); moveToFileNameLabel.setText("Move-to File Name:"); moveToFileNameField = new MirthTextField(); moveToFileNameField.setToolTipText( "<html>If successfully processed files should be renamed, enter the new name here.<br>The filename specified may include template substitutions from the list to the right.<br>If this field is left empty, successfully processed files will not be renamed.</html>"); errorReadingActionLabel = new JLabel(); errorReadingActionLabel.setText("Error Reading Action:"); errorReadingActionComboBox = new MirthComboBox(); errorReadingActionComboBox.setModel(new DefaultComboBoxModel(new String[] { "None", "Move", "Delete" })); errorReadingActionComboBox.setToolTipText( "<html>Select Move to move and/or rename files that have failed to be read in.<br/>Select Delete to delete files that have failed to be read in.</html>"); errorReadingActionComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { errorReadingActionComboBoxActionPerformed(evt); } }); errorResponseActionLabel = new JLabel(); errorResponseActionLabel.setText("Error in Response Action:"); errorResponseActionComboBox = new MirthComboBox(); errorResponseActionComboBox .setModel(new DefaultComboBoxModel(new String[] { "After Processing Action", "Move", "Delete" })); errorResponseActionComboBox.setToolTipText( "<html>Select Move to move and/or rename the file if an ERROR response is returned.<br/>Select Delete to delete the file if an ERROR response is returned.<br/>If After Processing Action is selected, the After Processing Action will apply.<br/>This action is only available if Process Batch Files is disabled.</html>"); errorResponseActionComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { errorResponseActionComboBoxActionPerformed(evt); } }); errorMoveToDirectoryLabel = new JLabel(); errorMoveToDirectoryLabel.setText("Error Move-to Directory:"); errorMoveToDirectoryField = new MirthTextField(); errorMoveToDirectoryField.setToolTipText( "<html>If files which cause processing errors should be moved to a different directory (folder), enter that directory here.<br>The directory name specified may include template substitutions from the list to the right.<br>If this field is left empty, files which cause processing errors will not be moved to a different directory.</html>"); errorMoveToFileNameLabel = new JLabel(); errorMoveToFileNameLabel.setText("Error Move-to File Name:"); errorMoveToFileNameField = new MirthTextField(); errorMoveToFileNameField.setToolTipText( "<html>If files which cause processing errors should be renamed, enter the new name here.<br/>The filename specified may include template substitutions from the list to the right.<br/>If this field is left empty, files which cause processing errors will not be renamed.</html>"); variableListScrollPane = new JScrollPane(); variableListScrollPane.setBorder(null); variableListScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); variableListScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); mirthVariableList = new MirthVariableList(); mirthVariableList.setBorder(BorderFactory.createEtchedBorder()); mirthVariableList.setModel(new AbstractListModel() { String[] strings = { "channelName", "channelId", "DATE", "COUNT", "UUID", "SYSTIME", "originalFilename" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); variableListScrollPane.setViewportView(mirthVariableList); checkFileAgeLabel = new JLabel(); checkFileAgeLabel.setText("Check File Age:"); checkFileAgeYesRadio = new MirthRadioButton(); checkFileAgeYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); checkFileAgeYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); checkFileAgeYesRadio.setText("Yes"); checkFileAgeYesRadio .setToolTipText("Select Yes to skip files that are created within the specified age below."); checkFileAgeYesRadio.setMargin(new Insets(0, 0, 0, 0)); checkFileAgeYesRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { checkFileAgeYesActionPerformed(evt); } }); checkFileAgeNoRadio = new MirthRadioButton(); checkFileAgeNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); checkFileAgeNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); checkFileAgeNoRadio.setSelected(true); checkFileAgeNoRadio.setText("No"); checkFileAgeNoRadio.setToolTipText("Select No to process files regardless of age."); checkFileAgeNoRadio.setMargin(new Insets(0, 0, 0, 0)); checkFileAgeNoRadio.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { checkFileAgeNoActionPerformed(evt); } }); checkFileAgeButtonGroup = new ButtonGroup(); checkFileAgeButtonGroup.add(checkFileAgeYesRadio); checkFileAgeButtonGroup.add(checkFileAgeNoRadio); fileAgeLabel = new JLabel(); fileAgeLabel.setText("File Age (ms):"); fileAgeField = new MirthTextField(); fileAgeField.setToolTipText( "If Check File Age Yes is selected, only the files created that are older than the specified value in milliseconds will be processed."); fileSizeLabel = new JLabel(); fileSizeLabel.setText("File Size (bytes):"); fileSizeMinimumField = new MirthTextField(); fileSizeMinimumField.setToolTipText("<html>The minimum size (in bytes) of files to be accepted.</html>"); fileSizeDashLabel = new JLabel(); fileSizeDashLabel.setText("-"); fileSizeMaximumField = new MirthTextField(); fileSizeMaximumField.setToolTipText( "<html>The maximum size (in bytes) of files to be accepted.<br/>This option has no effect if Ignore Maximum is checked.</html>"); ignoreFileSizeMaximumCheckBox = new MirthCheckBox(); ignoreFileSizeMaximumCheckBox.setBackground(UIConstants.BACKGROUND_COLOR); ignoreFileSizeMaximumCheckBox.setText("Ignore Maximum"); ignoreFileSizeMaximumCheckBox.setToolTipText( "<html>If checked, only the minimum file size will be checked against incoming files.</html>"); ignoreFileSizeMaximumCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { ignoreFileSizeMaximumCheckBoxActionPerformed(evt); } }); sortFilesByLabel = new JLabel(); sortFilesByLabel.setText("Sort Files By:"); sortByComboBox = new MirthComboBox(); sortByComboBox.setModel(new DefaultComboBoxModel(new String[] { "Date", "Name", "Size" })); sortByComboBox.setToolTipText( "<html>Selects the order in which files should be processed, if there are multiple files available to be processed.<br>Files can be processed by Date (oldest last modification date first), Size (smallest first) or name (a before z, etc.).</html>"); fileTypeLabel = new JLabel(); fileTypeLabel.setText("File Type:"); fileTypeBinary = new MirthRadioButton(); fileTypeBinary.setBackground(UIConstants.BACKGROUND_COLOR); fileTypeBinary.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileTypeBinary.setText("Binary"); fileTypeBinary.setToolTipText( "<html>Select Binary if files contain binary data; the contents will be Base64 encoded before processing.<br>Select Text if files contain text data; the contents will be encoded using the specified character set encoding.</html>"); fileTypeBinary.setMargin(new Insets(0, 0, 0, 0)); fileTypeBinary.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileTypeBinaryActionPerformed(evt); } }); fileTypeText = new MirthRadioButton(); fileTypeText.setBackground(UIConstants.BACKGROUND_COLOR); fileTypeText.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); fileTypeText.setSelected(true); fileTypeText.setText("Text"); fileTypeText.setToolTipText( "<html>Select Binary if files contain binary data; the contents will be Base64 encoded before processing.<br>Select Text if files contain text data; the contents will be encoded using the specified character set encoding.</html>"); fileTypeText.setMargin(new Insets(0, 0, 0, 0)); fileTypeText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileTypeASCIIActionPerformed(evt); } }); fileTypeButtonGroup = new ButtonGroup(); fileTypeButtonGroup.add(fileTypeBinary); fileTypeButtonGroup.add(fileTypeText); encodingLabel = new JLabel(); encodingLabel.setText("Encoding:"); charsetEncodingComboBox = new MirthComboBox(); charsetEncodingComboBox.setModel(new DefaultComboBoxModel(new String[] { "Default", "UTF-8", "ISO-8859-1", "UTF-16 (le)", "UTF-16 (be)", "UTF-16 (bom)", "US-ASCII" })); charsetEncodingComboBox.setToolTipText( "If File Type Text is selected, select the character set encoding (ASCII, UTF-8, etc.) to be used in reading the contents of each file."); }
From source file:eu.apenet.dpt.standalone.gui.DataPreparationToolGUI.java
private void createLanguageMenu() { Locale currentLocale = Locale.getDefault(); ButtonGroup group = new ButtonGroup(); JRadioButtonMenuItem rbMenuItem = new JRadioButtonMenuItem("English"); rbMenuItem.setActionCommand("en"); if (!Arrays.asList(LANGUAGES_OF_TOOL).contains(currentLocale.getLanguage()) || currentLocale.getLanguage().equals("en")) { rbMenuItem.setSelected(true);//ww w. ja v a2 s . c o m } rbMenuItem.addActionListener(new LanguageActionListener()); group.add(rbMenuItem); languageMenu.add(rbMenuItem); rbMenuItem = new JRadioButtonMenuItem("Franais"); rbMenuItem.setActionCommand("fr"); if (currentLocale.getLanguage().equals("fr")) { rbMenuItem.setSelected(true); } rbMenuItem.addActionListener(new LanguageActionListener()); group.add(rbMenuItem); languageMenu.add(rbMenuItem); rbMenuItem = new JRadioButtonMenuItem("Deutsch"); rbMenuItem.setActionCommand("de"); if (currentLocale.getLanguage().equals("de")) { rbMenuItem.setSelected(true); } rbMenuItem.addActionListener(new LanguageActionListener()); group.add(rbMenuItem); languageMenu.add(rbMenuItem); rbMenuItem = new JRadioButtonMenuItem(""); rbMenuItem.setActionCommand("el"); if (currentLocale.getLanguage().equals("el")) { rbMenuItem.setSelected(true); } rbMenuItem.addActionListener(new LanguageActionListener()); group.add(rbMenuItem); languageMenu.add(rbMenuItem); rbMenuItem = new JRadioButtonMenuItem("Nederlands"); rbMenuItem.setActionCommand("nl"); if (currentLocale.getLanguage().equals("nl")) { rbMenuItem.setSelected(true); } rbMenuItem.addActionListener(new LanguageActionListener()); group.add(rbMenuItem); languageMenu.add(rbMenuItem); rbMenuItem = new JRadioButtonMenuItem("Magyar"); rbMenuItem.setActionCommand("hu"); if (currentLocale.getLanguage().equals("hu")) { rbMenuItem.setSelected(true); } rbMenuItem.addActionListener(new LanguageActionListener()); group.add(rbMenuItem); languageMenu.add(rbMenuItem); if (Utilities.isDev) { languageMenu.addSeparator(); rbMenuItem = new JRadioButtonMenuItem("XXXXXX"); rbMenuItem.setActionCommand("xx"); if (currentLocale.getLanguage().equals("xx")) { rbMenuItem.setSelected(true); } rbMenuItem.addActionListener(new LanguageActionListener()); group.add(rbMenuItem); languageMenu.add(rbMenuItem); } }
From source file:burlov.ultracipher.swing.SwingGuiApplication.java
private JMenuBar createMenuBar() { JMenuBar bar = new JMenuBar(); JMenu menu = null;//from ww w . j ava2 s .c o m /* * 'File' Menue */ menu = new JMenu("File"); menu.setMnemonic(KeyEvent.VK_F); bar.add(menu); JMenuItem item = new JMenuItem("Save database"); item.setAccelerator(KeyStroke.getKeyStroke("control S")); item.setMnemonic(KeyEvent.VK_S); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveDatabase(); } }); menu.add(item); item = new JMenuItem("Download database"); item.setMnemonic(KeyEvent.VK_L); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { downloadAndMergeData(); } }); menu.add(item); item = new JMenuItem("Edit sync account"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { editSyncAccount(); } }); menu.add(item); menu.add(new JSeparator()); JMenu submenu = new JMenu("Import"); menu.add(submenu); item = new JMenuItem("From CSV"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { importCSV(); } }); submenu.add(item); submenu = new JMenu("Export"); menu.add(submenu); item = new JMenuItem("As CSV"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { exportCSV(); } }); submenu.add(item); item = new JMenuItem("Change passphrase"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changePassword(); } }); /* * 'Edit' Menue */ menu = new JMenu("Edit"); menu.setMnemonic(KeyEvent.VK_E); bar.add(menu); item = menu.add(mainPanel.getNewEntryAction()); item.setMnemonic(KeyEvent.VK_N); item = menu.add(mainPanel.getDeleteEntryAction()); item.setMnemonic(KeyEvent.VK_D); menu.add(new JSeparator()); menu = new JMenu("Tools"); // item = new JMenuItem("Passwort generator"); // menu.add(item); // item.addActionListener(new ActionListener() { // // @Override // public void actionPerformed(ActionEvent e) { // passGenerator.setVisible(false); // passGenerator.setLocationRelativeTo(getMainFrame()); // passGenerator.setVisible(true); // } // }); item = new JMenuItem("Screen keyboard"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { screenKeyboard.setLocationRelativeTo(getMainFrame()); screenKeyboard.setVisible(true); } }); item = new JMenuItem("File digester"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { digester.setLocationRelativeTo(getMainFrame()); digester.setVisible(true); } }); bar.add(menu); /* * 'Help' Menue */ menu = new JMenu("Help"); menu.setMnemonic(KeyEvent.VK_H); bar.add(menu); item = new JMenuItem("Performance test"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { measurePerformance(); } }); item = new JMenuItem("System info"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showSystemInfo(); } }); item = new JMenuItem("About"); menu.add(item); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String text = "<html>Ultracipher 6.1<br>(C) Copyright 2015 Paul Burlov<br><br>" + "Encryption strength: 768Bit (6 x 128Bit keys)<br>Cipher cascade: AES/Twofish/Serpent/CAST6/SEED/Camellia" + "<br>Encryption mode: Two pass CBC" + "<br>Key derivation algorithm: SCrypt with N=2^14,P=8,R=1<br><br> " + "This product includes software developed by the<br>" + "<ul><li>Apache Software Foundation " + "<a href='http://www.apache.org'>http://www.apache.org</a>" + "<li>Legion of the Bouncy Castle <a href='http://bouncycastle.org/'>http://bouncycastle.org</a>" + "<li>Project SwingX" + "<li>Bytecode Pty Ltd." + "</ul></html>"; JOptionPane.showMessageDialog(getMainFrame(), text, "", JOptionPane.INFORMATION_MESSAGE, getAppIcon()); } }); bar.add(Box.createHorizontalGlue()); menu = new JMenu("Keyboard"); ButtonGroup group = new ButtonGroup(); JRadioButtonMenuItem radioitem = new JRadioButtonMenuItem("System"); radioitem.setSelected(true); group.add(radioitem); radioitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { translator.resetMapping(); } }); menu.add(radioitem); radioitem = new JRadioButtonMenuItem("Futhark runes"); group.add(radioitem); radioitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { translator.initForFuthark(); } }); menu.add(radioitem); radioitem = new JRadioButtonMenuItem("Anglo-Saxon runes"); group.add(radioitem); radioitem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { translator.initForAngloSaxon(); } }); menu.add(radioitem); bar.add(menu); // bar.add(Box.createHorizontalGlue()); // bar.add(new PassGeneratorPanel()); return bar; }