Example usage for org.jfree.layout LCBLayout LCBLayout

List of usage examples for org.jfree.layout LCBLayout LCBLayout

Introduction

In this page you can find the example usage for org.jfree.layout LCBLayout LCBLayout.

Prototype

public LCBLayout(final int maxrows) 

Source Link

Document

Creates a new LCBLayout with the specified maximum number of rows.

Usage

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

/**
 * Standard constructor: builds a panel for displaying/editing the
 * properties of the specified title.//from   ww w  . ja  v  a 2 s.c  o m
 * 
 * @param title
 *            the title, which should be changed.
 */
public DefaultTitleEditor(Title title) {
    if (title == null) {
        this.showTitle = false;
        this.titleFont = SimulationDiagramTheme.DEFAULT_TITLE_FONT;
        this.titleField = new JTextField();
        this.titlePaint = new PaintSample(Color.BLACK);

    } else {
        TextTitle t = (TextTitle) title;

        this.showTitle = title.isVisible();
        this.titleFont = t.getFont();
        this.titleField = new JTextField(t.getText());
        this.titlePaint = new PaintSample(t.getPaint());
    }

    System.out.println(this.titleFont.getName());

    setLayout(new BorderLayout());

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

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

    interior.add(new JLabel(localizationResources.getString("Show_Title")));
    this.showTitleCheckBox = new JCheckBox();
    this.showTitleCheckBox.setSelected(this.showTitle);
    this.showTitleCheckBox.setActionCommand("ShowTitle");
    this.showTitleCheckBox.addActionListener(this);
    interior.add(new JPanel());
    interior.add(this.showTitleCheckBox);

    JLabel titleLabel = new JLabel(localizationResources.getString("Text"));
    interior.add(titleLabel);
    interior.add(this.titleField);
    interior.add(new JPanel());

    JLabel fontLabel = new JLabel(localizationResources.getString("Font"));
    this.fontfield = new FontDisplayField(this.titleFont);
    this.selectFontButton = new JButton(localizationResources.getString("Select..."));
    this.selectFontButton.setActionCommand("SelectFont");
    this.selectFontButton.addActionListener(this);
    interior.add(fontLabel);
    interior.add(this.fontfield);
    interior.add(this.selectFontButton);

    JLabel colorLabel = new JLabel(localizationResources.getString("Color"));
    this.selectPaintButton = new JButton(localizationResources.getString("Select..."));
    this.selectPaintButton.setActionCommand("SelectPaint");
    this.selectPaintButton.addActionListener(this);
    interior.add(colorLabel);
    interior.add(this.titlePaint);
    interior.add(this.selectPaintButton);

    this.enableOrDisableControls();

    general.add(interior);
    add(general, BorderLayout.NORTH);
}

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

/**
 * Standard constructor: builds a property panel for the specified axis.
 * /*from  ww w .j av a  2  s.c  o m*/
 * @param axis
 *            the axis, which should be changed.
 */
public DefaultNumberAxisEditor(NumberAxis axis) {
    super(axis);

    this.autoRange = axis.isAutoRange();
    this.minimumValue = axis.getLowerBound();
    this.maximumValue = axis.getUpperBound();

    this.gridPaintSample = new PaintSample(Color.blue);
    this.gridStrokeSample = new StrokeSample(new BasicStroke(1.0f));

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

    JTabbedPane other = getOtherTabs();

    JPanel range = new JPanel(new LCBLayout(3));
    range.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    range.add(new JPanel());
    this.autoRangeCheckBox = new JCheckBox(localizationResources.getString("Auto-adjust_range"),
            this.autoRange);
    this.autoRangeCheckBox.setActionCommand("AutoRangeOnOff");
    this.autoRangeCheckBox.addActionListener(this);
    range.add(this.autoRangeCheckBox);
    range.add(new JPanel());

    range.add(new JLabel(localizationResources.getString("Minimum_range_value")));
    this.minimumRangeValue = new JTextField(Double.toString(this.minimumValue));
    this.minimumRangeValue.setEnabled(!this.autoRange);
    this.minimumRangeValue.setActionCommand("MinimumRange");
    this.minimumRangeValue.addActionListener(this);
    this.minimumRangeValue.addFocusListener(this);
    range.add(this.minimumRangeValue);
    range.add(new JPanel());

    range.add(new JLabel(localizationResources.getString("Maximum_range_value")));
    this.maximumRangeValue = new JTextField(Double.toString(this.maximumValue));
    this.maximumRangeValue.setEnabled(!this.autoRange);
    this.maximumRangeValue.setActionCommand("MaximumRange");
    this.maximumRangeValue.addActionListener(this);
    this.maximumRangeValue.addFocusListener(this);
    range.add(this.maximumRangeValue);
    range.add(new JPanel());

    other.add(localizationResources.getString("Range"), range);

}

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

/**
 * Standard constructor: builds a panel for displaying/editing the
 * properties of the specified axis.//from   w  w w  .j a  va2  s.c o  m
 * 
 * @param axis
 *            the axis whose properties are to be displayed/edited in the
 *            panel.
 */
public DefaultAxisEditor(Axis axis) {
    this.labelFont = axis.getLabelFont();
    this.labelPaintSample = new PaintSample(axis.getLabelPaint());
    this.tickLabelFont = axis.getTickLabelFont();
    this.tickLabelPaintSample = new PaintSample(axis.getTickLabelPaint());

    // Insets values
    this.tickLabelInsets = axis.getTickLabelInsets();
    this.labelInsets = axis.getLabelInsets();

    setLayout(new BorderLayout());

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

    JPanel interior = new JPanel(new LCBLayout(5));
    interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    interior.add(new JLabel(localizationResources.getString("Label")));
    this.label = new JTextField(axis.getLabel());
    interior.add(this.label);
    interior.add(new JPanel());

    interior.add(new JLabel(localizationResources.getString("Font")));
    this.labelFontField = new FontDisplayField(this.labelFont);
    interior.add(this.labelFontField);
    JButton b = new JButton(localizationResources.getString("Select..."));
    b.setActionCommand("SelectLabelFont");
    b.addActionListener(this);
    interior.add(b);

    interior.add(new JLabel(localizationResources.getString("Paint")));
    interior.add(this.labelPaintSample);
    b = new JButton(localizationResources.getString("Select..."));
    b.setActionCommand("SelectLabelPaint");
    b.addActionListener(this);
    interior.add(b);

    general.add(interior);

    add(general, BorderLayout.NORTH);

    this.slot1 = new JPanel(new BorderLayout());

    JPanel other = new JPanel(new BorderLayout());
    other.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            localizationResources.getString("Other")));

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

    JPanel ticks = new JPanel(new LCBLayout(3));
    ticks.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    this.showTickLabelsCheckBox = new JCheckBox(localizationResources.getString("Show_tick_labels"),
            axis.isTickLabelsVisible());
    ticks.add(this.showTickLabelsCheckBox);
    ticks.add(new JPanel());
    ticks.add(new JPanel());

    ticks.add(new JLabel(localizationResources.getString("Tick_label_font")));
    this.tickLabelFontField = new FontDisplayField(this.tickLabelFont);
    ticks.add(this.tickLabelFontField);
    b = new JButton(localizationResources.getString("Select..."));
    b.setActionCommand("SelectTickLabelFont");
    b.addActionListener(this);
    ticks.add(b);

    this.showTickMarksCheckBox = new JCheckBox(localizationResources.getString("Show_tick_marks"),
            axis.isTickMarksVisible());
    ticks.add(this.showTickMarksCheckBox);
    ticks.add(new JPanel());
    ticks.add(new JPanel());

    this.otherTabs.add(localizationResources.getString("Ticks"), ticks);

    other.add(this.otherTabs);

    this.slot1.add(other);

    this.slot2 = new JPanel(new BorderLayout());
    this.slot2.add(this.slot1, BorderLayout.NORTH);
    add(this.slot2);

}

From source file:org.gumtree.vis.awt.time.TimePlotChartEditor.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"));
    ////from w  w  w  .jav  a  2s . com
    //      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);
    //      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 Curve"));

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

    int numberOfDataset = chart.getXYPlot().getDatasetCount();
    currentDataset = null;
    currentSeriesIndex = -1;
    List<String> seriesNames = new ArrayList<String>();
    for (int i = 0; i < numberOfDataset; i++) {
        XYDataset dataset = chart.getXYPlot().getDataset(i);
        if (dataset != null && dataset instanceof ITimeSeriesSet) {
            int numberOfSeries = dataset.getSeriesCount();
            for (int j = 0; j < numberOfSeries; j++) {
                String seriesName = (String) dataset.getSeriesKey(j);
                seriesNames.add(seriesName);
                if (seriesName.equals(currentSeriesKey)) {
                    currentDataset = (IDataset) dataset;
                    currentSeriesIndex = j;
                }
            }
        }
    }
    if ((currentDataset == null || currentSeriesIndex < 0) && seriesNames.size() > 0) {
        for (int i = 0; i < numberOfDataset; i++) {
            XYDataset dataset = chart.getXYPlot().getDataset(i);
            if (dataset != null && dataset instanceof ITimeSeriesSet && dataset.getSeriesCount() > 0) {
                currentDataset = (IDataset) dataset;
                currentSeriesIndex = 0;
                currentSeriesKey = (String) dataset.getSeriesKey(currentSeriesIndex);
                break;
            }
        }
    }

    //Select curve combo
    this.seriesCombo = new JComboBox(seriesNames.toArray());
    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 Visible"));
    showMarker = new JCheckBox();
    showMarker.setActionCommand(SHOW_MARKER_COMMAND);
    showMarker.addActionListener(this);
    interior.add(showMarker);
    interior.add(new JLabel());

    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, BorderLayout.NORTH);
    curves.setName("Curves");
    wrap.setName("Curves");
    wrap.add(curves, BorderLayout.NORTH);
    return wrap;
}

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  a va 2 s  .c om*/
 * <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.hist2d.Hist2DChartEditor.java

private JPanel createMaskingPanel(JFreeChart chart) {
    JPanel wrap = new JPanel(new BorderLayout());

    JPanel maskingPanel = new JPanel(new GridLayout(1, 1));
    maskingPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    //Horizontal group
    JPanel managePanel = new JPanel(new BorderLayout());
    managePanel.setBorder(/*from  w ww  . j  a  va  2  s .  c o m*/
            BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Region of Interests"));

    JPanel inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    inner.add(new JLabel("Select Region"));
    roiCombo = new JComboBox(panel.getMasks().toArray());
    //      colourScaleCombo.setMaximumRowCount(7);
    roiCombo.setActionCommand(CHANGE_ROI_COMMAND);
    roiCombo.addActionListener(this);
    roiCombo.setSelectedIndex(-1);
    inner.add(roiCombo);
    inner.add(new JLabel());

    inner.add(new JLabel("or create"));
    JPanel createNewPanel = new JPanel(new GridLayout(1, 2));
    newRectangleButton = new JButton("New Rectangle");
    newRectangleButton.setActionCommand(CREATE_NEW_RECT_REGION_COMMAND);
    newRectangleButton.addActionListener(this);
    newEllipseButton = new JButton("New Ellipse");
    newEllipseButton.setActionCommand(CREATE_NEW_ELLIPSE_REGION_COMMAND);
    newEllipseButton.addActionListener(this);
    createNewPanel.add(newRectangleButton);
    createNewPanel.add(newEllipseButton);
    inner.add(createNewPanel);
    inner.add(new JLabel());

    JPanel editPanel = new JPanel(new BorderLayout());
    editPanel
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Edit the Region"));

    JPanel editInner = new JPanel(new LCBLayout(6));
    editInner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    editInner.add(new JLabel("Name"));
    roiName = new JTextField(10);
    //      colourScaleCombo.setMaximumRowCount(7);
    roiName.setActionCommand(CHANGE_ROI_NAME_COMMAND);
    roiName.addActionListener(this);
    editInner.add(roiName);
    editInner.add(new JLabel());

    editInner.add(new JLabel("Usage"));
    ButtonGroup buttonGroup = new ButtonGroup();
    JPanel radioPanel = new JPanel(new GridLayout(1, 2));
    inclusiveRadio = new JRadioButton("inclusive");
    inclusiveRadio.setActionCommand(USE_INCLUSIVE_COMMAND);
    inclusiveRadio.addActionListener(this);
    buttonGroup.add(inclusiveRadio);
    radioPanel.add(inclusiveRadio);
    exclusiveRadio = new JRadioButton("exclusive");
    exclusiveRadio.setActionCommand(USE_EXCLUSIVE_COMMAND);
    exclusiveRadio.addActionListener(this);
    buttonGroup.add(exclusiveRadio);
    radioPanel.add(exclusiveRadio);
    editInner.add(radioPanel);
    editInner.add(new JLabel());

    editInner.add(new JLabel("Shape"));
    //      ButtonGroup shapeGroup = new ButtonGroup();
    //      JPanel shapePanel = new JPanel(new GridLayout(1, 2));
    //      rectangleRadio = new JRadioButton("rectangle");
    //      rectangleRadio.setActionCommand(CHOOSE_RECTANGLE_SHAPE_COMMAND);
    //      rectangleRadio.addActionListener(this);
    //      shapeGroup.add(rectangleRadio);
    //      shapePanel.add(rectangleRadio);
    //      ellipseRadio = new JRadioButton("ellipse");
    //      ellipseRadio.setActionCommand(CHOOSE_ELLIPSE_SHAPE_COMMAND);
    //      ellipseRadio.addActionListener(this);
    //      shapeGroup.add(ellipseRadio);
    //      shapePanel.add(ellipseRadio);
    //      editInner.add(shapePanel);
    shapeLabel = new JLabel();
    editInner.add(shapeLabel);
    editInner.add(new JLabel());

    editInner.add(new JLabel("X Range"));
    JPanel xRangePanel = new JPanel(new GridLayout(1, 2));
    JPanel xMinPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    xMinPanel.add(new JLabel("min: "));
    xMin = new JTextField(10);
    //      xMin.setActionCommand(CHANGE_XMIN_COMMAND);
    //      xMin.addActionListener(this);
    xMin.addKeyListener(this);
    xMinPanel.add(xMin);
    xRangePanel.add(xMinPanel);
    JPanel xMaxPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    xMaxPanel.add(new JLabel("max: "));
    xMax = new JTextField(10);
    //      xMax.setActionCommand(CHANGE_XMAX_COMMAND);
    xMax.addKeyListener(this);
    xMaxPanel.add(xMax);
    xRangePanel.add(xMaxPanel);
    editInner.add(xRangePanel);
    editInner.add(new JLabel());

    editInner.add(new JLabel("Y Range"));
    JPanel yRangePanel = new JPanel(new GridLayout(1, 2));
    JPanel yMinPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    yMinPanel.add(new JLabel("min: "));
    yMin = new JTextField(10);
    //      yMin.setActionCommand(CHANGE_YMIN_COMMAND);
    //      yMin.addActionListener(this);
    yMin.addKeyListener(this);
    yMinPanel.add(yMin);
    yRangePanel.add(yMinPanel);
    JPanel yMaxPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    yMaxPanel.add(new JLabel("max: "));
    yMax = new JTextField(10);
    //      yMax.setActionCommand(CHANGE_YMAX_COMMAND);
    //      yMax.addActionListener(this);
    yMax.addKeyListener(this);
    yMaxPanel.add(yMax);
    yRangePanel.add(yMaxPanel);
    editInner.add(yRangePanel);
    editInner.add(new JLabel());

    editInner.add(new JLabel());
    JPanel applyPanel = new JPanel(new GridLayout(1, 2));
    deleteButton = new JButton("Remove");
    deleteButton.setEnabled(false);
    deleteButton.setActionCommand(REMOVE_CHANGE_ACTION);
    deleteButton.addActionListener(this);
    applyPanel.add(deleteButton);
    applyPanel.add(new JLabel());
    applyButton = new JButton("Apply");
    applyButton.setEnabled(false);
    applyButton.setActionCommand(APPLY_CHANGE_ACTION);
    applyButton.addActionListener(this);
    applyPanel.add(applyButton);
    editInner.add(applyPanel);
    editInner.add(new JLabel());
    //      inner.add(new JLabel("X Range"));
    //      inner.add(inclusiveRadio);
    //      exclusiveRadio = new JRadioButton("exclusive");
    //      exclusiveRadio.setActionCommand(USE_EXCLUSIVE_COMMAND);
    //      exclusiveRadio.addActionListener(this);
    //      inner.add(exclusiveRadio);
    editPanel.add(editInner, BorderLayout.NORTH);
    managePanel.add(editPanel, BorderLayout.SOUTH);
    managePanel.add(inner, BorderLayout.NORTH);
    maskingPanel.add(managePanel);
    wrap.setName("ROI");

    wrap.add(maskingPanel, BorderLayout.NORTH);
    return wrap;
}

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 v a 2 s.  c  o 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:org.gumtree.vis.awt.time.TimePlotChartEditor.java

private JPanel createCordinatePanel() {
    JPanel wrap = new JPanel(new BorderLayout());
    JPanel coordinate = new JPanel(new GridLayout(2, 1));
    coordinate.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    //Horizontal group
    JPanel horizontal = new JPanel(new BorderLayout());
    horizontal.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Time Axis"));

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

    showAllHistory = new JRadioButton("Show all history");
    showAllHistory.setActionCommand(SHOW_ALL_HISTORY_COMMAND);
    showAllHistory.addActionListener(this);
    inner.add(showAllHistory);//w ww .  jav  a  2 s  . c  o m
    inner.add(new JLabel());
    inner.add(new JLabel());
    //
    showPartHistory = new JRadioButton("Fix time range");
    showPartHistory.setActionCommand(FIXED_LENGTH_HISTORY_COMMAND);
    showPartHistory.addActionListener(this);
    inner.add(showPartHistory);
    timeField = new JTextField(5);
    inner.add(timeField);
    inner.add(new JLabel("seconds"));
    axisControlGroup.add(showAllHistory);
    axisControlGroup.add(showPartHistory);

    horizontal.add(inner, BorderLayout.NORTH);

    //Vertical group
    //       JPanel vertical = new JPanel(new BorderLayout());
    //       vertical.setBorder(BorderFactory.createTitledBorder(
    //            BorderFactory.createEtchedBorder(), "Vertical Axis"));
    //
    //       inner = new JPanel(new LCBLayout(6));
    //      inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    //      inner.add(new JLabel("Logarithm Y Axis"));
    //      logarithmY = new JCheckBox();
    //      logarithmY.setActionCommand(LOGARITHM_Y_AXIS_COMMAND);
    //      logarithmY.addActionListener(this);
    //      inner.add(logarithmY);
    //      inner.add(new JLabel());
    //
    //      inner.add(new JLabel("Flip Y Axis"));
    //      flipY = new JCheckBox();
    //      flipY.setActionCommand(FLIP_Y_AXIS_COMMAND);
    //      flipY.addActionListener(this);
    //      inner.add(flipY);
    //      inner.add(new JLabel());

    //       vertical.add(inner, BorderLayout.NORTH);

    coordinate.add(horizontal, BorderLayout.NORTH);
    //      coordinate.add(vertical);
    wrap.setName("Coordinate");
    wrap.add(coordinate, BorderLayout.NORTH);
    return wrap;
}

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

private JPanel createMaskingPanel(JFreeChart chart) {
    JPanel wrap = new JPanel(new BorderLayout());

    JPanel maskingPanel = new JPanel(new GridLayout(1, 1));
    maskingPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    //Horizontal group
    JPanel managePanel = new JPanel(new BorderLayout());
    managePanel.setBorder(/*from  www.j ava  2  s .  c om*/
            BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Region of Interests"));

    JPanel inner = new JPanel(new LCBLayout(6));
    inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    inner.add(new JLabel("Select Region"));
    roiCombo = new JComboBox(panel.getMasks().toArray());
    //      colourScaleCombo.setMaximumRowCount(7);
    roiCombo.setSelectedIndex(-1);
    roiCombo.setActionCommand(CHANGE_ROI_COMMAND);
    roiCombo.addActionListener(this);
    inner.add(roiCombo);
    inner.add(new JLabel());

    inner.add(new JLabel("or create"));
    newRectangleButton = new JButton("New Region of Interests");
    newRectangleButton.setActionCommand(CREATE_NEW_RECT_REGION_COMMAND);
    newRectangleButton.addActionListener(this);
    inner.add(newRectangleButton);
    inner.add(new JLabel());

    JPanel editPanel = new JPanel(new BorderLayout());
    editPanel
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Edit the Region"));

    JPanel editInner = new JPanel(new LCBLayout(6));
    editInner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    editInner.add(new JLabel("Name"));
    roiName = new JTextField(10);
    //      colourScaleCombo.setMaximumRowCount(7);
    roiName.setActionCommand(CHANGE_ROI_NAME_COMMAND);
    roiName.addActionListener(this);
    editInner.add(roiName);
    editInner.add(new JLabel());

    editInner.add(new JLabel("Usage"));
    ButtonGroup buttonGroup = new ButtonGroup();
    JPanel radioPanel = new JPanel(new GridLayout(1, 2));
    inclusiveRadio = new JRadioButton("inclusive");
    inclusiveRadio.setActionCommand(USE_INCLUSIVE_COMMAND);
    inclusiveRadio.addActionListener(this);
    buttonGroup.add(inclusiveRadio);
    radioPanel.add(inclusiveRadio);
    exclusiveRadio = new JRadioButton("exclusive");
    exclusiveRadio.setActionCommand(USE_EXCLUSIVE_COMMAND);
    exclusiveRadio.addActionListener(this);
    buttonGroup.add(exclusiveRadio);
    radioPanel.add(exclusiveRadio);
    editInner.add(radioPanel);
    editInner.add(new JLabel());

    editInner.add(new JLabel("X Range"));
    JPanel xRangePanel = new JPanel(new GridLayout(1, 2));
    JPanel xMinPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    xMinPanel.add(new JLabel("min: "));
    xMin = new JTextField(10);
    //      xMin.setActionCommand(CHANGE_XMIN_COMMAND);
    //      xMin.addActionListener(this);
    xMin.addKeyListener(this);
    xMinPanel.add(xMin);
    xRangePanel.add(xMinPanel);
    JPanel xMaxPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    xMaxPanel.add(new JLabel("max: "));
    xMax = new JTextField(10);
    //      xMax.setActionCommand(CHANGE_XMAX_COMMAND);
    xMax.addKeyListener(this);
    xMaxPanel.add(xMax);
    xRangePanel.add(xMaxPanel);
    editInner.add(xRangePanel);
    editInner.add(new JLabel());

    editInner.add(new JLabel());
    JPanel applyPanel = new JPanel(new GridLayout(1, 2));
    deleteButton = new JButton("Remove");
    deleteButton.setEnabled(false);
    deleteButton.setActionCommand(REMOVE_CHANGE_ACTION);
    deleteButton.addActionListener(this);
    applyPanel.add(deleteButton);
    applyPanel.add(new JLabel());
    applyButton = new JButton("Apply");
    applyButton.setEnabled(false);
    applyButton.setActionCommand(APPLY_CHANGE_ACTION);
    applyButton.addActionListener(this);
    applyPanel.add(applyButton);
    editInner.add(applyPanel);
    editInner.add(new JLabel());
    //      inner.add(new JLabel("X Range"));
    //      inner.add(inclusiveRadio);
    //      exclusiveRadio = new JRadioButton("exclusive");
    //      exclusiveRadio.setActionCommand(USE_EXCLUSIVE_COMMAND);
    //      exclusiveRadio.addActionListener(this);
    //      inner.add(exclusiveRadio);
    editPanel.add(editInner, BorderLayout.NORTH);
    managePanel.add(editPanel, BorderLayout.SOUTH);
    managePanel.add(inner, BorderLayout.NORTH);
    maskingPanel.add(managePanel);
    wrap.setName("ROI");

    wrap.add(maskingPanel, BorderLayout.NORTH);
    return wrap;
}

From source file:org.jfree.chart.demo.JFreeChartDemo.java

/**
 * Creates a tabbed pane containing descriptions of the demo charts.
 *
 * @param resources  localised resources.
 *
 * @return a tabbed pane./*  w w w  . ja  va 2  s .  c  o m*/
 */
private JTabbedPane createTabbedPane(final ResourceBundle resources) {

    final Font font = new Font("Dialog", Font.PLAIN, 12);
    final JTabbedPane tabs = new JTabbedPane();

    int tab = 1;
    final Vector titles = new Vector(0);
    final String[] tabTitles;
    String title = null;

    while (tab > 0) {
        try {
            title = resources.getString("tabs." + tab);
            if (title != null) {
                titles.add(title);
            } else {
                tab = -1;
            }
            ++tab;
        } catch (Exception ex) {
            tab = -1;
        }
    }

    if (titles.size() == 0) {
        titles.add("Default");
    }

    tab = titles.size();
    this.panels = new JPanel[tab];
    tabTitles = new String[tab];

    --tab;
    for (; tab >= 0; --tab) {
        title = titles.get(tab).toString();
        tabTitles[tab] = title;
    }
    titles.removeAllElements();

    for (int i = 0; i < tabTitles.length; ++i) {
        this.panels[i] = new JPanel();
        this.panels[i].setLayout(new LCBLayout(20));
        this.panels[i].setPreferredSize(new Dimension(360, 20));
        this.panels[i].setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
        tabs.add(tabTitles[i], new JScrollPane(this.panels[i]));
    }

    String description;
    final String buttonText = resources.getString("charts.display");
    JButton b1;

    // Load the CHARTS ...
    String usage = null;
    for (int i = 0; i <= CHART_COMMANDS.length - 1; ++i) {
        try {
            usage = resources.getString(CHART_COMMANDS[i][2] + ".usage");
        } catch (Exception ex) {
            usage = null;
        }

        if ((usage == null) || usage.equalsIgnoreCase("All") || usage.equalsIgnoreCase("Swing")) {

            title = resources.getString(CHART_COMMANDS[i][2] + ".title");
            description = resources.getString(CHART_COMMANDS[i][2] + ".description");
            try {
                tab = Integer.parseInt(resources.getString(CHART_COMMANDS[i][2] + ".tab"));
                --tab;
            } catch (Exception ex) {
                System.err.println("Demo : Error retrieving tab identifier for chart " + CHART_COMMANDS[i][2]);
                System.err.println("Demo : Error = " + ex.getMessage());
                tab = 0;
            }
            if ((tab < 0) || (tab >= this.panels.length)) {
                tab = 0;
            }

            System.out.println("Demo : adding " + CHART_COMMANDS[i][0] + " to panel " + tab);
            this.panels[tab].add(RefineryUtilities.createJLabel(title, font));
            this.panels[tab].add(new DescriptionPanel(new JTextArea(description)));
            b1 = RefineryUtilities.createJButton(buttonText, font);
            b1.setActionCommand(CHART_COMMANDS[i][0]);
            b1.addActionListener(this);
            this.panels[tab].add(b1);
        }
    }

    return tabs;

}