Example usage for javax.swing JCheckBox JCheckBox

List of usage examples for javax.swing JCheckBox JCheckBox

Introduction

In this page you can find the example usage for javax.swing JCheckBox JCheckBox.

Prototype

public JCheckBox() 

Source Link

Document

Creates an initially unselected check box button with no text, no icon.

Usage

From source file:com.digitexx.ancestry.gui.FrmUpperLowerData.java

private void initGUI() {
    try {//  w w  w .  j  a v a  2 s.  c om
        this.setTitle("Uppercase & Lowercase data");
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        AnchorLayout thisLayout = new AnchorLayout();
        getContentPane().setLayout(thisLayout);
        {
            panelMain = new JPanel();
            BorderLayout panelMainLayout = new BorderLayout();
            panelMain.setLayout(panelMainLayout);
            getContentPane().add(panelMain, new AnchorConstraint(0, 1000, 944, 0, AnchorConstraint.ANCHOR_REL,
                    AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
            panelMain.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
            panelMain.setPreferredSize(new java.awt.Dimension(775, 488));
            {
                splitPaneMain = new JSplitPane();
                panelMain.add(splitPaneMain, BorderLayout.CENTER);
                splitPaneMain.setOrientation(JSplitPane.VERTICAL_SPLIT);
                splitPaneMain.setDividerLocation(200);
                {
                    panelColumnLog = new JPanel();
                    BorderLayout panelLogLayout = new BorderLayout();
                    panelColumnLog.setLayout(panelLogLayout);
                    splitPaneMain.add(panelColumnLog, JSplitPane.RIGHT);
                    panelColumnLog.setPreferredSize(new java.awt.Dimension(417, 482));
                    {
                        splitPaneColumnAndLog = new JSplitPane();
                        panelColumnLog.add(splitPaneColumnAndLog, BorderLayout.CENTER);
                        splitPaneColumnAndLog.setDividerLocation(200);
                        {
                            panelLog = new JPanel();
                            BorderLayout panelLogLayout1 = new BorderLayout();
                            panelLog.setLayout(panelLogLayout1);
                            splitPaneColumnAndLog.add(panelLog, JSplitPane.RIGHT);
                            {
                                scrollPaneLog = new JScrollPane();
                                panelLog.add(scrollPaneLog, BorderLayout.CENTER);
                                {
                                    textPaneLog = new JTextPane();
                                    scrollPaneLog.setViewportView(textPaneLog);
                                }
                            }
                        }
                        {
                            panelColumn = new JPanel();
                            BorderLayout panelColumnLayout = new BorderLayout();
                            panelColumn.setLayout(panelColumnLayout);
                            splitPaneColumnAndLog.add(panelColumn, JSplitPane.LEFT);
                            {
                                scrollPaneColumn = new JScrollPane();
                                panelColumn.add(scrollPaneColumn, BorderLayout.CENTER);
                                {
                                    tableField = new JTable() {
                                        @Override
                                        public boolean isCellEditable(int row, int column) {
                                            if (getColumnName(column).equals("Check")) {
                                                return true;
                                            } else {
                                                return false;
                                            }
                                        }

                                        @Override
                                        public Class<?> getColumnClass(int column) {
                                            if (getColumnName(column).equals("Check")) {
                                                return Boolean.class;
                                            } else {
                                                return super.getColumnClass(column);
                                            }
                                        }
                                    };
                                    scrollPaneColumn.setViewportView(tableField);
                                }
                            }
                        }
                    }
                }
                {
                    panelPath = new JPanel();
                    BorderLayout panelPathLayout = new BorderLayout();
                    panelPath.setLayout(panelPathLayout);
                    splitPaneMain.add(panelPath, JSplitPane.LEFT);
                    panelPath.setPreferredSize(new java.awt.Dimension(769, 316));
                    {
                        scrollPanePath = new JScrollPane();
                        panelPath.add(scrollPanePath, BorderLayout.CENTER);
                        {
                            jListPath = new JList();
                            scrollPanePath.setViewportView(jListPath);
                            jListPath.setFont(new java.awt.Font("Arial", 0, 14));
                        }
                    }
                }
            }
        }
        {
            panelFooter = new JPanel();
            AnchorLayout panelFooterLayout = new AnchorLayout();
            getContentPane().add(panelFooter,
                    new AnchorConstraint(944, 1000, 1000, 0, AnchorConstraint.ANCHOR_REL,
                            AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL,
                            AnchorConstraint.ANCHOR_REL));
            panelFooter.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
            panelFooter.setLayout(panelFooterLayout);
            panelFooter.setPreferredSize(new java.awt.Dimension(775, 29));
            {
                buttonRun = new JButton();
                panelFooter.add(buttonRun, new AnchorConstraint(86, 998, 948, 890, AnchorConstraint.ANCHOR_REL,
                        AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
                buttonRun.setText("Run");
                buttonRun.setFont(new java.awt.Font("Arial", 1, 16));
                buttonRun.setPreferredSize(new java.awt.Dimension(83, 25));
                buttonRun.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        buttonRunActionPerformed(evt);
                    }
                });
            }
            {
                checkboxRework = new JCheckBox();
                panelFooter.add(checkboxRework,
                        new AnchorConstraint(86, 155, 948, 3, AnchorConstraint.ANCHOR_REL,
                                AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL,
                                AnchorConstraint.ANCHOR_REL));
                checkboxRework.setText("Rework");
                checkboxRework.setFont(new java.awt.Font("Arial", 1, 16));
                checkboxRework.setForeground(new java.awt.Color(255, 0, 0));
                checkboxRework.setPreferredSize(new java.awt.Dimension(118, 25));
                checkboxRework.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        checkboxReworkActionPerformed(evt);
                    }
                });
            }
        }
        pack();
        this.setSize(783, 551);
        AppUtility.centerFrame(this);
        this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent evt) {
                exit();
            }
        });
        ;
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ch.zhaw.simulation.diagram.charteditor.DefaultPlotEditor.java

/**
 * Standard constructor - constructs a panel for editing the properties of
 * the specified plot.//  ww w.j  av  a2  s.c o m
 * <P>
 * In designing the panel, we need to be aware that subclasses of Plot will
 * need to implement subclasses of PlotPropertyEditPanel - so we need to
 * leave one or two 'slots' where the subclasses can extend the user
 * interface.
 * 
 * @param plot
 *            the plot, which should be changed.
 */
public DefaultPlotEditor(Plot plot) {
    this.plotInsets = plot.getInsets();
    this.backgroundPaintSample = new PaintSample(plot.getBackgroundPaint());
    this.outlineStrokeSample = new StrokeSample(plot.getOutlineStroke());
    this.outlinePaintSample = new PaintSample(plot.getOutlinePaint());
    // Disabled because makes no sense for us
    // if (plot instanceof CategoryPlot) {
    // this.plotOrientation = ((CategoryPlot) plot).getOrientation();
    // } else if (plot instanceof XYPlot) {
    // this.plotOrientation = ((XYPlot) plot).getOrientation();
    // }
    if (plot instanceof CategoryPlot) {
        CategoryItemRenderer renderer = ((CategoryPlot) plot).getRenderer();
        if (renderer instanceof LineAndShapeRenderer) {
            LineAndShapeRenderer r = (LineAndShapeRenderer) renderer;
            this.drawLines = BooleanUtilities.valueOf(r.getBaseLinesVisible());
            this.drawShapes = BooleanUtilities.valueOf(r.getBaseShapesVisible());
        }
    } else if (plot instanceof XYPlot) {
        XYItemRenderer renderer = ((XYPlot) plot).getRenderer();
        if (renderer instanceof StandardXYItemRenderer) {
            StandardXYItemRenderer r = (StandardXYItemRenderer) renderer;
            this.drawLines = BooleanUtilities.valueOf(r.getPlotLines());
            this.drawShapes = BooleanUtilities.valueOf(r.getBaseShapesVisible());
        }
    }

    setLayout(new BorderLayout());

    this.availableStrokeSamples = new StrokeSample[4];
    this.availableStrokeSamples[0] = new StrokeSample(null);
    this.availableStrokeSamples[1] = new StrokeSample(new BasicStroke(1.0f));
    this.availableStrokeSamples[2] = new StrokeSample(new BasicStroke(2.0f));
    this.availableStrokeSamples[3] = new StrokeSample(new BasicStroke(3.0f));

    // create a panel for the settings...
    JPanel panel = new JPanel(new BorderLayout());
    panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            plot.getPlotType() + localizationResources.getString(":")));

    JPanel general = new JPanel(new BorderLayout());
    general.setBorder(BorderFactory.createTitledBorder(localizationResources.getString("General")));

    JPanel interior = new JPanel(new LCBLayout(7));
    interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    interior.add(new JLabel(localizationResources.getString("Outline_stroke")));

    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (StrokeSample s : this.availableStrokeSamples) {
        model.addElement(s.getStroke());
    }
    this.cbOutlineStroke = new JComboBox(model);
    this.cbOutlineStroke.setSelectedItem(this.outlineStrokeSample.getStroke());
    this.cbOutlineStroke.setRenderer(new StrokeComboboxRenderer());

    interior.add(this.cbOutlineStroke);
    interior.add(new JLabel());

    interior.add(new JLabel(localizationResources.getString("Outline_Paint")));
    JButton button = new JButton(localizationResources.getString("Select..."));
    button.setActionCommand("OutlinePaint");
    button.addActionListener(this);
    interior.add(this.outlinePaintSample);
    interior.add(button);

    interior.add(new JLabel(localizationResources.getString("Background_paint")));
    button = new JButton(localizationResources.getString("Select..."));
    button.setActionCommand("BackgroundPaint");
    button.addActionListener(this);
    interior.add(this.backgroundPaintSample);
    interior.add(button);

    // Disabled because makes no sense for us
    // if (this.plotOrientation != null) {
    // boolean isVertical =
    // this.plotOrientation.equals(PlotOrientation.VERTICAL);
    // int index = isVertical ? ORIENTATION_VERTICAL :
    // ORIENTATION_HORIZONTAL;
    // interior.add(new
    // JLabel(localizationResources.getString("Orientation")));
    // this.orientationCombo = new JComboBox(orientationNames);
    // this.orientationCombo.setSelectedIndex(index);
    // this.orientationCombo.setActionCommand("Orientation");
    // this.orientationCombo.addActionListener(this);
    // interior.add(this.orientationCombo);
    // interior.add(new JPanel());
    // }

    if (this.drawLines != null) {
        interior.add(new JLabel(localizationResources.getString("Draw_lines")));
        this.drawLinesCheckBox = new JCheckBox();
        this.drawLinesCheckBox.setSelected(this.drawLines.booleanValue());
        this.drawLinesCheckBox.setActionCommand("DrawLines");
        this.drawLinesCheckBox.addActionListener(this);
        interior.add(new JPanel());
        interior.add(this.drawLinesCheckBox);
    }

    if (this.drawShapes != null) {
        interior.add(new JLabel(localizationResources.getString("Draw_shapes")));
        this.drawShapesCheckBox = new JCheckBox();
        this.drawShapesCheckBox.setSelected(this.drawShapes.booleanValue());
        this.drawShapesCheckBox.setActionCommand("DrawShapes");
        this.drawShapesCheckBox.addActionListener(this);
        interior.add(new JPanel());
        interior.add(this.drawShapesCheckBox);
    }

    general.add(interior, BorderLayout.NORTH);

    JPanel appearance = new JPanel(new BorderLayout());
    appearance.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    appearance.add(general, BorderLayout.NORTH);

    JTabbedPane tabs = new JTabbedPane();
    tabs.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    Axis domainAxis = null;
    if (plot instanceof CategoryPlot) {
        domainAxis = ((CategoryPlot) plot).getDomainAxis();
    } else if (plot instanceof XYPlot) {
        domainAxis = ((XYPlot) plot).getDomainAxis();
    }
    this.domainAxisPropertyPanel = DefaultAxisEditor.getInstance(domainAxis);
    if (this.domainAxisPropertyPanel != null) {
        this.domainAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Domain_Axis"), this.domainAxisPropertyPanel);
    }

    Axis rangeAxis = null;
    if (plot instanceof CategoryPlot) {
        rangeAxis = ((CategoryPlot) plot).getRangeAxis();
    } else if (plot instanceof XYPlot) {
        rangeAxis = ((XYPlot) plot).getRangeAxis();
    }

    this.rangeAxisPropertyPanel = DefaultAxisEditor.getInstance(rangeAxis);
    if (this.rangeAxisPropertyPanel != null) {
        this.rangeAxisPropertyPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
        tabs.add(localizationResources.getString("Range_Axis"), this.rangeAxisPropertyPanel);
    }

    tabs.add(localizationResources.getString("Appearance"), appearance);
    panel.add(tabs);

    add(panel);
}

From source file:org.gumtree.vis.plot1d.Plot1DChartEditor.java

private JPanel createCurvesPanel() {
    JPanel wrap = new JPanel(new BorderLayout());
    JPanel curves = new JPanel(new BorderLayout());
    curves.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    JPanel general = new JPanel(new BorderLayout());
    general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "General"));

    JPanel inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    inner.add(new JLabel("Show Marker"));
    showMarker = new JCheckBox();
    showMarker.setActionCommand(SHOW_MARKER_COMMAND);
    showMarker.addActionListener(this);
    inner.add(showMarker);/*from   w ww .j  a  va2  s.  co m*/
    inner.add(new JLabel());

    inner.add(new JLabel("Show Error"));
    showError = new JCheckBox();
    showError.setActionCommand(SHOW_ERROR_COMMAND);
    showError.addActionListener(this);
    inner.add(showError);
    inner.add(new JLabel());

    general.add(inner, BorderLayout.NORTH);
    curves.add(general, BorderLayout.NORTH);

    JPanel individual = new JPanel(new BorderLayout());
    individual.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Individual"));

    JPanel interior = new JPanel(new LCBLayout(6));
    interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    XYDataset dataset = chart.getXYPlot().getDataset();
    int numberOfSeries = dataset.getSeriesCount();
    String[] seriesNames = new String[numberOfSeries];
    currentSeriesIndex = -1;
    for (int i = 0; i < numberOfSeries; i++) {
        seriesNames[i] = (String) dataset.getSeriesKey(i);
        if (seriesNames[i].equals(currentSeriesKey)) {
            currentSeriesIndex = i;
        }
    }
    if (currentSeriesIndex < 0 && seriesNames.length > 0) {
        currentSeriesIndex = 0;
        currentSeriesKey = seriesNames[currentSeriesIndex];
    }

    //Select curve combo
    this.seriesCombo = new JComboBox(seriesNames);
    seriesCombo.setActionCommand(CHANGE_CURVE_COMMAND);
    seriesCombo.addActionListener(this);
    interior.add(new JLabel("Select Curve"));
    interior.add(seriesCombo);
    interior.add(new JLabel(""));

    interior.add(new JLabel("Curve Stroke"));
    curveStrokeSample = new StrokeSample(new BasicStroke());
    curveStrokeSample.setEnabled(false);
    interior.add(curveStrokeSample);
    //      JButton button = new JButton(localizationResources.getString("Edit..."));
    Float[] strokes = new Float[] { 0f, 0.2f, 0.5f, 1f, 1.5f, 2f, 3f };
    strokeCombo = new JComboBox(strokes);
    strokeCombo.setActionCommand(CURVE_STROCK_COMMAND);
    strokeCombo.addActionListener(this);
    interior.add(strokeCombo);

    interior.add(new JLabel("Curve Colour"));
    curveColorPaint = new PaintSample(chart.getBackgroundPaint());
    interior.add(curveColorPaint);
    JButton button = new JButton(localizationResources.getString("Edit..."));
    button.setActionCommand(CURVE_COLOR_COMMAND);
    button.addActionListener(this);
    interior.add(button);

    interior.add(new JLabel("Marker Shape"));
    shapeLabel = new JLabel();
    interior.add(shapeLabel);
    Integer[] shapeIndex = new Integer[MarkerShape.size];
    for (int i = 0; i < shapeIndex.length; i++) {
        shapeIndex[i] = i;
    }
    shapeCombo = new JComboBox(shapeIndex);
    comboRender = new ImageComboRender();
    comboRender.setShapes(StaticValues.LOCAL_SHAPE_SERIES);
    shapeCombo.setRenderer(comboRender);
    shapeCombo.setMaximumRowCount(7);
    shapeCombo.setActionCommand(MARKER_SHAPE_COMMAND);
    shapeCombo.addActionListener(this);
    interior.add(shapeCombo);

    interior.add(new JLabel("Marker Filled"));
    markerFilled = new JCheckBox();
    markerFilled.setActionCommand(MARKER_FILLED_COMMAND);
    markerFilled.addActionListener(this);
    interior.add(markerFilled);
    interior.add(new JLabel());

    interior.add(new JLabel("Curve Visable"));
    curveVisable = new JCheckBox();
    curveVisable.setActionCommand(CURVE_VISIBLE_COMMAND);
    curveVisable.addActionListener(this);
    interior.add(curveVisable);
    interior.add(new JLabel());

    individual.add(interior, BorderLayout.NORTH);
    curves.add(individual);
    curves.setName("Curves");
    wrap.setName("Curves");
    wrap.add(curves, BorderLayout.NORTH);
    return wrap;
}

From source file:com.t3.macro.api.functions.input.ColumnPanel.java

/** Creates a single checkbox control. */
public JComponent createCheckControl(VarSpec vs) {
    JCheckBox check = new JCheckBox();
    check.setText("    "); // so a focus indicator will appear
    if (vs.value.compareTo("0") != 0)
        check.setSelected(true);/*from w  ww  .  j av a 2  s  .c  o m*/
    return check;
}

From source file:com.sec.ose.osi.ui.frm.main.report.JPanBillOfMaterials.java

public JCheckBox getJCheckBoxCheckAll() {

    if (jCheckBoxCheckAll == null) {
        jCheckBoxCheckAll = new JCheckBox();
        jCheckBoxCheckAll.setSelected(false);
        jCheckBoxCheckAll.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                eventHandler.handleEvent(EventHandler.CHECK_ALL_CHECKBOX);
            }//from w  ww .j  av  a 2s.c  om
        });
    }
    return jCheckBoxCheckAll;
}

From source file:sim.util.media.chart.BoxPlotGenerator.java

protected void buildGlobalAttributes(LabelledList list) {
    // create the chart
    ((CategoryPlot) (chart.getPlot())).setRangeGridlinesVisible(false);
    ((CategoryPlot) (chart.getPlot())).setRangeGridlinePaint(new Color(200, 200, 200));

    xLabel = new PropertyField() {
        public String newValue(String newValue) {
            setXAxisLabel(newValue);//from w  ww.  j a  v a2s .c o m
            getChartPanel().repaint();
            return newValue;
        }
    };
    xLabel.setValue(getXAxisLabel());

    list.add(new JLabel("X Label"), xLabel);

    yLabel = new PropertyField() {
        public String newValue(String newValue) {
            setYAxisLabel(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    yLabel.setValue(getYAxisLabel());

    list.add(new JLabel("Y Label"), yLabel);

    yLog = new JCheckBox();
    yLog.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (yLog.isSelected()) {
                LogarithmicAxis logAxis = new LogarithmicAxis(yLabel.getValue());
                logAxis.setStrictValuesFlag(false);
                ((CategoryPlot) (chart.getPlot())).setRangeAxis(logAxis);
            } else
                ((CategoryPlot) (chart.getPlot())).setRangeAxis(new NumberAxis(yLabel.getValue()));
        }
    });

    list.add(new JLabel("Y Log Axis"), yLog);

    final JCheckBox ygridlines = new JCheckBox();
    ygridlines.setSelected(false);
    ItemListener il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                ((CategoryPlot) (chart.getPlot())).setRangeGridlinesVisible(true);
            } else {
                ((CategoryPlot) (chart.getPlot())).setRangeGridlinesVisible(false);
            }
        }
    };
    ygridlines.addItemListener(il);

    // JFreeChart's Box Plots look awful when wide because the mean
    // circle is based on the width of the bar to the exclusion of all
    // else.  So I've restricted the width to be no more than 0.4, and 0.1
    // is the suggested default.

    final double INITIAL_WIDTH = 0.1;
    final double MAXIMUM_RATIONAL_WIDTH = 0.4;

    maximumWidthField = new NumberTextField(INITIAL_WIDTH, 2.0, 0) {
        public double newValue(double newValue) {
            if (newValue <= 0.0 || newValue > MAXIMUM_RATIONAL_WIDTH)
                newValue = currentValue;
            ((BoxAndWhiskerRenderer) (((CategoryPlot) (chart.getPlot())).getRenderer()))
                    .setMaximumBarWidth(newValue);
            //update();
            return newValue;
        }
    };
    list.addLabelled("Max Width", maximumWidthField);

    Box box = Box.createHorizontalBox();
    box.add(new JLabel(" Y"));
    box.add(ygridlines);
    box.add(Box.createGlue());
    list.add(new JLabel("Y Grid Lines"), ygridlines);

    mean = new JCheckBox();
    mean.setSelected(true);
    il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            BoxAndWhiskerRenderer renderer = ((BoxAndWhiskerRenderer) ((CategoryPlot) (chart.getPlot()))
                    .getRenderer());
            renderer.setMeanVisible(mean.isSelected());
        }
    };
    mean.addItemListener(il);

    median = new JCheckBox();
    median.setSelected(true);
    il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            BoxAndWhiskerRenderer renderer = ((BoxAndWhiskerRenderer) ((CategoryPlot) (chart.getPlot()))
                    .getRenderer());
            renderer.setMedianVisible(median.isSelected());
        }
    };
    median.addItemListener(il);

    list.add(new JLabel("Mean"), mean);
    list.add(new JLabel("Median"), median);

    final JCheckBox horizontal = new JCheckBox();
    horizontal.setSelected(false);
    il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            CategoryPlot plot = (CategoryPlot) (chart.getPlot());
            if (e.getStateChange() == ItemEvent.SELECTED) {
                plot.setOrientation(PlotOrientation.HORIZONTAL);
            } else {
                plot.setOrientation(PlotOrientation.VERTICAL);
            }
            //updateGridLines();
        }
    };
    horizontal.addItemListener(il);

    list.add(new JLabel("Horizontal"), horizontal);

    final JCheckBox whiskersUseFillColorButton = new JCheckBox();
    whiskersUseFillColorButton.setSelected(false);
    whiskersUseFillColorButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            BoxAndWhiskerRenderer renderer = ((BoxAndWhiskerRenderer) ((CategoryPlot) (chart.getPlot()))
                    .getRenderer());
            renderer.setUseOutlinePaintForWhiskers(!whiskersUseFillColorButton.isSelected());
        }
    });

    box = Box.createHorizontalBox();
    box.add(new JLabel(" Colored"));
    box.add(whiskersUseFillColorButton);
    box.add(Box.createGlue());
    list.add(new JLabel("Whiskers"), box);
}

From source file:net.aepik.alasca.gui.ldap.SchemaObjectEditorFrame.java

/**
 * Initialize graphical components with values.
 *//*from   w w w. ja v  a 2  s . c om*/
private void init() {
    String objectType = this.objetSchema.getType();
    SchemaSyntax syntax = objetSchema.getSyntax();
    String[] params_name = syntax.getParameters(objectType);

    if (params_name == null || params_name.length == 0) {
        return;
    }

    this.labels = new Hashtable<String, JComponent>();
    this.values = new Hashtable<String, JComponent>();
    this.valuesPresent = new Hashtable<String, JCheckBox>();
    Vector<String> parametresEffectues = new Vector<String>();

    for (int i = 0; i < params_name.length; i++) {
        if (parametresEffectues.contains(params_name[i])) {
            continue;
        }

        JComponent label = null;
        JComponent composant = null;
        JCheckBox checkbox = new JCheckBox();
        String[] param_values;
        String[] param_others = syntax.getOthersParametersFor(objectType, params_name[i]);

        // If SUP parameters, add corresponding object names.
        if (params_name[i].compareTo("SUP") == 0) {
            SchemaObject[] objects = this.schema.getObjectsInOrder(objectType);
            param_values = new String[objects.length];
            for (int j = 0; j < objects.length; j++) {
                param_values[j] = objects[j].getNameFirstValue();
            }
        }

        // Else, read the syntax to find needed values.
        else {
            param_values = syntax.getParameterDefaultValues(objectType, params_name[i]);
        }

        // Plusieurs clefs.
        // C'est une liste de clefs possibles.
        if (param_others != null && param_others.length > 1) {
            label = new JComboBox(param_others);
            composant = new JLabel();
            boolean ok = false;

            for (int j = 0; j < param_others.length && !ok; j++) {
                if (objetSchema.isKeyExists(param_others[j])) {
                    ok = true;
                    ((JComboBox) label).setSelectedItem(param_others[j]);
                    checkbox.setSelected(true);
                }
            }
            for (int j = 0; j < param_others.length; j++) {
                parametresEffectues.add(param_others[j]);
            }

        }

        // Aucune valeur possible
        // La prsence du paramtre suffit => JCheckBox.
        else if (param_values.length == 0) {
            label = new JLabel(params_name[i]);
            composant = new JLabel("");
            parametresEffectues.add(params_name[i]);
            checkbox.setSelected(objetSchema.isKeyExists(params_name[i]));

        }

        // Une valeur, on regarde si c'est une valeur prcise.
        // - Si c'est une chane qui peut tre quelconque => JTextField.
        // - Si la valeur est en fait un objet => JTextField + Objet.
        else if (param_values.length == 1 && param_values[0] != null) {
            String tmp = objetSchema.isKeyExists(params_name[i])
                    ? objetSchema.getValue(params_name[i]).toString()
                    : param_values[0];

            label = new JLabel(params_name[i]);
            composant = new JTextField(tmp, 30);
            parametresEffectues.add(params_name[i]);
            checkbox.setSelected(objetSchema.isKeyExists(params_name[i]));

        }

        // Plusieurs valeurs.
        // C'est une liste de choix possibles => JComboBox.
        else if (param_values.length > 1) {
            String tmp = objetSchema.isKeyExists(params_name[i])
                    ? objetSchema.getValue(params_name[i]).toString()
                    : param_values[0];

            if (!ArrayUtils.contains(param_values, tmp)) {
                Vector<String> list = new Vector<String>();
                for (String param_value : param_values) {
                    list.add(param_value);
                }
                list.add(0, tmp);
                param_values = list.toArray(new String[0]);
            }

            label = new JLabel(params_name[i]);
            composant = new JComboBox(param_values);
            ((JComboBox) composant).setEditable(true);
            ((JComboBox) composant).setSelectedItem(tmp);
            parametresEffectues.add(params_name[i]);
            checkbox.setSelected(objetSchema.isKeyExists(params_name[i]));
        }

        // Set elements into the frame.
        if (composant != null && label != null) {
            this.labels.put(params_name[i], label);
            this.values.put(params_name[i], composant);
            this.valuesPresent.put(params_name[i], checkbox);
            SchemaValue v = syntax.createSchemaValue(objectType, params_name[i], null);
            if (v.isValues() && !(composant instanceof JComboBox)) {
                composant.setEnabled(false);
            }
        }
    } // end for
}

From source file:edu.gmu.cs.sim.util.media.chart.BoxPlotGenerator.java

protected void buildGlobalAttributes(LabelledList list) {
    // create the chart
    ((CategoryPlot) (chart.getPlot())).setRangeGridlinesVisible(false);
    ((CategoryPlot) (chart.getPlot())).setRangeGridlinePaint(new Color(200, 200, 200));

    xLabel = new PropertyField() {
        public String newValue(String newValue) {
            setXAxisLabel(newValue);/*from ww w.  j  a v  a  2  s  . co m*/
            getChartPanel().repaint();
            return newValue;
        }
    };
    xLabel.setValue(getXAxisLabel());

    list.add(new JLabel("X Label"), xLabel);

    yLabel = new PropertyField() {
        public String newValue(String newValue) {
            setYAxisLabel(newValue);
            getChartPanel().repaint();
            return newValue;
        }
    };
    yLabel.setValue(getYAxisLabel());

    list.add(new JLabel("Y Label"), yLabel);

    yLog = new JCheckBox();
    yLog.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (yLog.isSelected()) {
                LogarithmicAxis logAxis = new LogarithmicAxis(yLabel.getValue());
                logAxis.setStrictValuesFlag(false);
                ((CategoryPlot) (chart.getPlot())).setRangeAxis(logAxis);
            } else {
                ((CategoryPlot) (chart.getPlot())).setRangeAxis(new NumberAxis(yLabel.getValue()));
            }
        }
    });

    list.add(new JLabel("Y Log Axis"), yLog);

    final JCheckBox ygridlines = new JCheckBox();
    ygridlines.setSelected(false);
    ItemListener il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                ((CategoryPlot) (chart.getPlot())).setRangeGridlinesVisible(true);
            } else {
                ((CategoryPlot) (chart.getPlot())).setRangeGridlinesVisible(false);
            }
        }
    };
    ygridlines.addItemListener(il);

    // JFreeChart's Box Plots look awful when wide because the mean
    // circle is based on the width of the bar to the exclusion of all
    // else.  So I've restricted the width to be no more than 0.4, and 0.1
    // is the suggested default.

    final double INITIAL_WIDTH = 0.1;
    final double MAXIMUM_RATIONAL_WIDTH = 0.4;

    maximumWidthField = new NumberTextField(INITIAL_WIDTH, 2.0, 0) {
        public double newValue(double newValue) {
            if (newValue <= 0.0 || newValue > MAXIMUM_RATIONAL_WIDTH) {
                newValue = currentValue;
            }
            ((BoxAndWhiskerRenderer) (((CategoryPlot) (chart.getPlot())).getRenderer()))
                    .setMaximumBarWidth(newValue);
            //update();
            return newValue;
        }
    };
    list.addLabelled("Max Width", maximumWidthField);

    Box box = Box.createHorizontalBox();
    box.add(new JLabel(" Y"));
    box.add(ygridlines);
    box.add(Box.createGlue());
    list.add(new JLabel("Y Grid Lines"), ygridlines);

    mean = new JCheckBox();
    mean.setSelected(true);
    il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            BoxAndWhiskerRenderer renderer = ((BoxAndWhiskerRenderer) ((CategoryPlot) (chart.getPlot()))
                    .getRenderer());
            renderer.setMeanVisible(mean.isSelected());
        }
    };
    mean.addItemListener(il);

    median = new JCheckBox();
    median.setSelected(true);
    il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            BoxAndWhiskerRenderer renderer = ((BoxAndWhiskerRenderer) ((CategoryPlot) (chart.getPlot()))
                    .getRenderer());
            renderer.setMedianVisible(median.isSelected());
        }
    };
    median.addItemListener(il);

    list.add(new JLabel("Mean"), mean);
    list.add(new JLabel("Median"), median);

    final JCheckBox horizontal = new JCheckBox();
    horizontal.setSelected(false);
    il = new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            CategoryPlot plot = (CategoryPlot) (chart.getPlot());
            if (e.getStateChange() == ItemEvent.SELECTED) {
                plot.setOrientation(PlotOrientation.HORIZONTAL);
            } else {
                plot.setOrientation(PlotOrientation.VERTICAL);
            }
            //updateGridLines();
        }
    };
    horizontal.addItemListener(il);

    list.add(new JLabel("Horizontal"), horizontal);

    final JCheckBox whiskersUseFillColorButton = new JCheckBox();
    whiskersUseFillColorButton.setSelected(false);
    whiskersUseFillColorButton.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            BoxAndWhiskerRenderer renderer = ((BoxAndWhiskerRenderer) ((CategoryPlot) (chart.getPlot()))
                    .getRenderer());
            renderer.setUseOutlinePaintForWhiskers(!whiskersUseFillColorButton.isSelected());
        }
    });

    box = Box.createHorizontalBox();
    box.add(new JLabel(" Colored"));
    box.add(whiskersUseFillColorButton);
    box.add(Box.createGlue());
    list.add(new JLabel("Whiskers"), box);
}

From source file:com.jwmsolutions.timeCheck.gui.TodoForm.java

private JCheckBox getJchkCompleted() {
    if (jchkCompleted == null) {
        jchkCompleted = new JCheckBox();
        jchkCompleted.setText("Completed");
        jchkCompleted.setHorizontalAlignment(SwingConstants.RIGHT);
        jchkCompleted.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                jchkCompletedActionPerformed(evt);
            }//from w  ww.j av  a2s.c  om
        });
    }
    return jchkCompleted;
}

From source file:com.supermap.desktop.icloud.CloudLicenseDialog.java

private void initComponents() {
    this.panelCloudImage = new JPanel();
    this.panelUserImage = new JPanel();
    this.labelWarning = new JLabel("");
    this.labelUserName = new JLabel();
    this.labelPassWord = new JLabel();
    this.textFieldUserName = new JTextField();
    this.fieldPassWord = new JPasswordField();
    this.labelRegister = new JLabel();
    this.labelFindPassword = new JLabel();
    this.checkBoxSavePassword = new JCheckBox();
    this.checkBoxAutoLogin = new JCheckBox();
    this.buttonLogin = new JButton();
    this.buttonClose = new JButton();
    initToken();//from w ww  .ja v  a  2  s .c  o m
    this.checkBoxAutoLogin.setVisible(false);
}