List of usage examples for javax.swing JCheckBox JCheckBox
public JCheckBox(Action a)
From source file:idontwant2see.IDontWant2See.java
private AbstractAction getActionInputTitle(final Program p, final String part) { return new AbstractAction(mLocalizer.msg("menu.userEntered", "User entered value")) { public void actionPerformed(final ActionEvent e) { final JCheckBox caseSensitive = new JCheckBox(mLocalizer.msg("caseSensitive", "case sensitive")); String title = p.getTitle(); ArrayList<String> items = new ArrayList<String>(); if (!StringUtils.isEmpty(part)) { String shortTitle = title.trim().substring(0, title.length() - part.length()).trim(); shortTitle = StringUtils.removeEnd(shortTitle, "-").trim(); shortTitle = StringUtils.removeEnd(shortTitle, "(").trim(); items.add(shortTitle + "*"); }/*from ww w . ja v a 2s . c om*/ int index = title.indexOf(" - "); if (index > 0) { items.add(title.substring(0, index).trim() + "*"); } items.add(title); index = title.lastIndexOf(':'); if (index > 0) { items.add(title.substring(0, index).trim() + "*"); } final JComboBox input = new JComboBox(items.toArray(new String[items.size()])); input.setEditable(true); input.addAncestorListener(new AncestorListener() { public void ancestorAdded(final AncestorEvent event) { event.getComponent().requestFocus(); } public void ancestorMoved(final AncestorEvent event) { } public void ancestorRemoved(final AncestorEvent event) { } }); if (JOptionPane.showConfirmDialog(UiUtilities.getLastModalChildOf(getParentFrame()), new Object[] { mLocalizer.msg("exclusionText", "What should be excluded? (You can use the wildcard *)"), input, caseSensitive }, mLocalizer.msg("exclusionTitle", "Exclusion value entering"), JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) { String test = ""; String result = (String) input.getSelectedItem(); if (result != null) { test = result.replaceAll("\\*+", "\\*").trim(); if (test.length() >= 0 && !test.equals("*")) { mSettings.getSearchList() .add(new IDontWant2SeeListEntry(result, caseSensitive.isSelected())); mSettings.setLastEnteredExclusionString(result); updateFilter(!mSettings.isSwitchToMyFilter()); } } if (test.trim().length() <= 1) { JOptionPane.showMessageDialog(UiUtilities.getLastModalChildOf(getParentFrame()), mLocalizer.msg("notValid", "The entered text is not valid."), Localizer.getLocalization(Localizer.I18N_ERROR), JOptionPane.ERROR_MESSAGE); } } } }; }
From source file:JXButtonPanel.java
private JXButtonPanel createCheckBoxJXButtonPanel() { JXButtonPanel panel = new JXButtonPanel(); panel.setLayout(new GridLayout(0, 1)); JCheckBox one = new JCheckBox("One"); panel.add(one);//from ww w . ja va2s . c om JCheckBox two = new JCheckBox("Two"); panel.add(two); JCheckBox three = new JCheckBox("Three"); panel.add(three); JCheckBox four = new JCheckBox("Four"); panel.add(four); panel.setBorder(BorderFactory.createTitledBorder("JXButtonPanel")); return panel; }
From source file:com.declarativa.interprolog.gui.Ini.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try {// ww w. java 2s . c o m Forest<String, Integer> forest = new DelegateForest<>(); ObservableGraph g = new ObservableGraph(new BalloonLayoutDemo().createTree(forest)); Layout layout = new BalloonLayout(forest); //Layout layout = new TreeLayout(forest, 70, 70); final BaseJungScene scene = new SceneImpl(g, layout); jLayeredPane1.setLayout(new BorderLayout()); jLayeredPane1.add(new JScrollPane(scene.createView()), BorderLayout.CENTER); final JCheckBox checkbox = new JCheckBox("Animate iterative layouts"); scene.setLayoutAnimationFramesPerSecond(48); //********************** DefaultComboBoxModel<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapes = new DefaultComboBoxModel<>(); shapes.addElement(new EdgeShape.QuadCurve<String, Number>()); shapes.addElement(new EdgeShape.BentLine<String, Number>()); shapes.addElement(new EdgeShape.CubicCurve<String, Number>()); shapes.addElement(new EdgeShape.Line<String, Number>()); shapes.addElement(new EdgeShape.Box<String, Number>()); shapes.addElement(new EdgeShape.Orthogonal<String, Number>()); shapes.addElement(new EdgeShape.Wedge<String, Number>(10)); /* final JComboBox<Transformer<Context<Graph<String, Number>, Number>, Shape>> shapesBox = new JComboBox<>(shapes); shapesBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { Transformer<Context<Graph<String, Number>, Number>, Shape> xform = (Transformer<Context<Graph<String, Number>, Number>, Shape>) shapesBox.getSelectedItem(); scene.setConnectionEdgeShape(xform); } }); shapesBox.setRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList<?> jlist, Object o, int i, boolean bln, boolean bln1) { o = o.getClass().getSimpleName(); return super.getListCellRendererComponent(jlist, o, i, bln, bln1); //To change body of generated methods, choose Tools | Templates. } }); shapesBox.setSelectedItem(new EdgeShape.QuadCurve<>()); */ final JLabel selectionLabel = new JLabel("<html> </html>"); System.out.println("LOOKUP IS " + scene.getLookup()); Lookup.Result<String> selectedNodes = scene.getLookup().lookupResult(String.class); LookupListener listener = new LookupListener() { @Override public void resultChanged(LookupEvent le) { System.out.println("RES CHANGED"); Lookup.Result<String> res = (Lookup.Result<String>) le.getSource(); StringBuilder sb = new StringBuilder("<html>"); List<String> l = new ArrayList<>(res.allInstances()); Collections.sort(l); for (String s : l) { if (sb.length() != 0) { sb.append(", "); } sb.append(s); } sb.append("</html>"); selectionLabel.setText(sb.toString()); System.out.println("LOOKUP EVENT " + sb); } }; selectedNodes.addLookupListener(listener); selectedNodes.allInstances(); checkbox.setSelected(true); checkbox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { scene.setAnimateIterativeLayouts(checkbox.isSelected()); } }); jLayeredPane1.setSize(456, 458); //// jf.setSize(jf.getGraphicsConfiguration().getBounds().width - 120, 700); this.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent we) { scene.relayout(true); scene.validate(); } }); /* int returnVal = fileChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); fileChooser.addChoosableFileFilter(new FileFilter() { public String getDescription() { return "Prolog native program (*.P)"; } public boolean accept(File f) { if (f.isDirectory()) { return true; } else { return f.getName().toLowerCase().endsWith(".P"); } } }); try { // What to do with the file, e.g. display it in a TextArea prologOutput.read(new FileReader(file.getAbsolutePath()), null); } catch (IOException ex) { System.out.println("problem accessing file" + file.getAbsolutePath()); } } else { System.out.println("File access cancelled by user."); } */ //One file chooser for each buton click } catch (IOException ex) { Exceptions.printStackTrace(ex); System.out.println("AUCH"); } }
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 . j a va 2 s . 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.esa.snap.rcp.statistics.DensityPlotPanel.java
private JPanel createOptionsPanel() { toggleColorCheckBox = new JCheckBox("Invert plot colors"); toggleColorCheckBox.addActionListener(e -> toggleColor()); toggleColorCheckBox.setEnabled(false); final JPanel optionsPanel = GridBagUtils.createPanel(); final GridBagConstraints gbc = GridBagUtils .createConstraints("anchor=NORTHWEST,fill=HORIZONTAL,insets.top=0,weightx=1,gridx=0"); GridBagUtils.addToPanel(optionsPanel, axisRangeControls[X_VAR].getPanel(), gbc, "gridy=0, insets.top=2"); GridBagUtils.addToPanel(optionsPanel, xProductList, gbc, "gridy=1,insets.left=4,insets.right=2"); GridBagUtils.addToPanel(optionsPanel, xBandList, gbc, "gridy=2,insets.left=4,insets.right=2"); GridBagUtils.addToPanel(optionsPanel, axisRangeControls[Y_VAR].getPanel(), gbc, "gridy=3,insets.left=0,insets.right=0"); GridBagUtils.addToPanel(optionsPanel, yProductList, gbc, "gridy=4,insets.left=4,insets.right=2"); GridBagUtils.addToPanel(optionsPanel, yBandList, gbc, "gridy=5,insets.left=4,insets.right=2"); GridBagUtils.addToPanel(optionsPanel, new JPanel(), gbc, "gridy=6"); GridBagUtils.addToPanel(optionsPanel, new JSeparator(), gbc, "gridy=7,insets.left=4,insets.right=2"); GridBagUtils.addToPanel(optionsPanel, toggleColorCheckBox, gbc, "gridy=8,insets.left=0,insets.right=0"); return optionsPanel; }
From source file:com.vgi.mafscaling.ClosedLoop.java
protected void createGraghTab() { JPanel cntlPanel = new JPanel(); JPanel plotPanel = createGraphPlotPanel(cntlPanel); add(plotPanel, "<html><div style='text-align: center;'>C<br>h<br>a<br>r<br>t</div></html>"); GridBagLayout gbl_cntlPanel = new GridBagLayout(); gbl_cntlPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_cntlPanel.rowHeights = new int[] { 0, 0 }; gbl_cntlPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };/*from w w w. j a va 2 s .c o m*/ gbl_cntlPanel.rowWeights = new double[] { 0 }; cntlPanel.setLayout(gbl_cntlPanel); GridBagConstraints gbc_check = new GridBagConstraints(); gbc_check.insets = insets2; gbc_check.gridx = 0; gbc_check.gridy = 0; checkBoxDvdtData = new JCheckBox("dV/dt"); checkBoxDvdtData.setActionCommand("dvdt"); checkBoxDvdtData.addActionListener(this); cntlPanel.add(checkBoxDvdtData, gbc_check); gbc_check.gridx++; checkBoxIatData = new JCheckBox("IAT"); checkBoxIatData.setActionCommand("iat"); checkBoxIatData.addActionListener(this); cntlPanel.add(checkBoxIatData, gbc_check); gbc_check.gridx++; checkBoxTrpmData = new JCheckBox("Trims/RPM"); checkBoxTrpmData.setActionCommand("trpm"); checkBoxTrpmData.addActionListener(this); cntlPanel.add(checkBoxTrpmData, gbc_check); gbc_check.gridx++; checkBoxMnmdData = new JCheckBox("Mean/Mode"); checkBoxMnmdData.setActionCommand("mnmd"); checkBoxMnmdData.addActionListener(this); cntlPanel.add(checkBoxMnmdData, gbc_check); gbc_check.gridx++; checkBoxRunData = new JCheckBox("Total Correction"); checkBoxRunData.setActionCommand("corrdata"); checkBoxRunData.addActionListener(this); cntlPanel.add(checkBoxRunData, gbc_check); gbc_check.gridx++; createGraphCommonControls(cntlPanel, gbc_check.gridx); createChart(plotPanel, Y2AxisName); createMafSmoothingPanel(plotPanel); }
From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java
/** * Setup the General Tab Pane/*from ww w . j a v a 2 s . c o m*/ * * @return JPanel for pane */ private JPanel setupGeneralTab() { JPanel generalTab = new JPanel(); generalTab.setLayout(new BorderLayout()); /* -- Create Main Panels -- */ JPanel centerPanel = new JPanel(); JPanel northPanel = new JPanel(); JPanel southPanel = new JPanel(); generalTab.add(centerPanel, BorderLayout.CENTER); generalTab.add(northPanel, BorderLayout.NORTH); /* -- Create Center Contents -- */ // Statistics Panel JPanel statsPanel = setupStatsPanel(); // Log Panel JPanel logPanel = new JPanel(); logPanel.setLayout(new BorderLayout()); logPanel.setBorder(BorderFactory.createTitledBorder("Log Output")); JTextPane logTextPane = new JTextPane(); logTextPane.setEditable(false); logTextPane.setBackground(Color.BLACK); logTextPane.setForeground(Color.WHITE); logPanel.add(new JScrollPane(logTextPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); addUIElement("general.log", logTextPane); // Add to component map JPanel logOptionsPanel = new JPanel(); logPanel.add(logOptionsPanel, BorderLayout.SOUTH); logOptionsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT)); final JCheckBox logScrollCheckbox = new JCheckBox("Auto-Scroll Log"); logScrollCheckbox.setSelected(true); logScrollCheckbox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JTextPaneAppender.setAutoScroll(logScrollCheckbox.isSelected()); } }); logOptionsPanel.add(logScrollCheckbox); // Enable Logging JTextPaneAppender.setTextPane(logTextPane); centerPanel.setLayout(new BorderLayout(10, 10)); centerPanel.add(statsPanel, BorderLayout.NORTH); centerPanel.add(logPanel, BorderLayout.CENTER); /* -- Create Buttons (South) -- */ generalTab.add(southPanel, BorderLayout.SOUTH); final JButton shutdownButton = new JButton("Shutdown"); shutdownButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doShutdownCluster(); } }); southPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 10, 10)); southPanel.add(shutdownButton); addUIElement("general.shutdown", shutdownButton); // Add to components map return generalTab; }
From source file:com.ciphertool.zodiacengine.gui.view.SwingUserInterface.java
private void appendRunContinuouslyCheckBox(GridBagLayout gridBagLayout, GridBagConstraints constraints, JPanel mainPanel) {/* w ww .ja v a 2s . co m*/ runContinuouslyCheckBox = new JCheckBox(continuousText); runContinuouslyCheckBox.addActionListener(getRunContinuouslyCheckBoxActionListener()); runContinuouslyCheckBox.setSelected(true); constraints.weightx = LAYOUT_LABEL_WEIGHT; constraints.gridwidth = GridBagConstraints.RELATIVE; JLabel dummyJLabel = new JLabel(); gridBagLayout.setConstraints(dummyJLabel, constraints); mainPanel.add(dummyJLabel); constraints.weightx = LAYOUT_INPUT_WEIGHT; constraints.gridwidth = GridBagConstraints.REMAINDER; gridBagLayout.setConstraints(runContinuouslyCheckBox, constraints); mainPanel.add(runContinuouslyCheckBox); }
From source file:com.marginallyclever.makelangelo.MainGUI.java
protected boolean ChooseImageConversionOptions(boolean isDXF) { final JDialog driver = new JDialog(mainframe, translator.get("ConversionOptions"), true); driver.setLayout(new GridBagLayout()); final String[] choices = machineConfiguration.getKnownMachineNames(); final JComboBox<String> machine_choice = new JComboBox<String>(choices); machine_choice.setSelectedIndex(machineConfiguration.getCurrentMachineIndex()); final JSlider input_paper_margin = new JSlider(JSlider.HORIZONTAL, 0, 50, 100 - (int) (machineConfiguration.paper_margin * 100)); input_paper_margin.setMajorTickSpacing(10); input_paper_margin.setMinorTickSpacing(5); input_paper_margin.setPaintTicks(false); input_paper_margin.setPaintLabels(true); //final JCheckBox allow_metrics = new JCheckBox(String.valueOf("I want to add the distance drawn to the // total")); //allow_metrics.setSelected(allowMetrics); final JCheckBox reverse_h = new JCheckBox(translator.get("FlipForGlass")); reverse_h.setSelected(machineConfiguration.reverseForGlass); final JButton cancel = new JButton(translator.get("Cancel")); final JButton save = new JButton(translator.get("Start")); String[] filter_names = new String[image_converters.size()]; Iterator<Filter> fit = image_converters.iterator(); int i = 0;//from w ww . j av a2 s.c o m while (fit.hasNext()) { Filter f = fit.next(); filter_names[i++] = f.GetName(); } final JComboBox<String> input_draw_style = new JComboBox<String>(filter_names); input_draw_style.setSelectedIndex(GetDrawStyle()); GridBagConstraints c = new GridBagConstraints(); //c.gridwidth=4; c.gridx=0; c.gridy=0; driver.add(allow_metrics,c); int y = 0; c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("MenuLoadMachineConfig")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 2; c.gridx = 1; c.gridy = y++; driver.add(machine_choice, c); if (!isDXF) { c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("ConversionStyle")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = y++; driver.add(input_draw_style, c); } c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 0; c.gridy = y; driver.add(new JLabel(translator.get("PaperMargin")), c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 3; c.gridx = 1; c.gridy = y++; driver.add(input_paper_margin, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; c.gridx = 1; c.gridy = y++; driver.add(reverse_h, c); c.anchor = GridBagConstraints.EAST; c.gridwidth = 1; c.gridx = 2; c.gridy = y; driver.add(save, c); c.anchor = GridBagConstraints.WEST; c.gridwidth = 1; c.gridx = 3; c.gridy = y++; driver.add(cancel, c); startConvertingNow = false; ActionListener driveButtons = new ActionListener() { public void actionPerformed(ActionEvent e) { Object subject = e.getSource(); if (subject == save) { long new_uid = Long.parseLong(choices[machine_choice.getSelectedIndex()]); machineConfiguration.LoadConfig(new_uid); SetDrawStyle(input_draw_style.getSelectedIndex()); machineConfiguration.paper_margin = (100 - input_paper_margin.getValue()) * 0.01; machineConfiguration.reverseForGlass = reverse_h.isSelected(); machineConfiguration.SaveConfig(); // if we aren't connected, don't show the new if (connectionToRobot != null && !connectionToRobot.isRobotConfirmed()) { // Force update of graphics layout. previewPane.updateMachineConfig(); // update window title mainframe.setTitle( translator.get("TitlePrefix") + Long.toString(machineConfiguration.robot_uid) + translator.get("TitleNotConnected")); } startConvertingNow = true; driver.dispose(); } if (subject == cancel) { driver.dispose(); } } }; save.addActionListener(driveButtons); cancel.addActionListener(driveButtons); driver.getRootPane().setDefaultButton(save); driver.pack(); driver.setVisible(true); return startConvertingNow; }
From source file:com.vgi.mafscaling.LogPlay.java
private JCheckBox addCheckBox(int column, String text) { JCheckBox check = new JCheckBox(text); check.addActionListener(this); GridBagConstraints gbc_check = new GridBagConstraints(); gbc_check.insets = insets0;//from w w w . j a va 2 s . co m gbc_check.anchor = GridBagConstraints.WEST; gbc_check.gridx = column; gbc_check.gridy = 1; playerPanel.add(check, gbc_check); return check; }