예제 #1
0
  private void createBarChartPanel() {

    // create components
    ckAutoBarWidth = new JCheckBox();
    ckAutoBarWidth.addActionListener(this);
    lblBarWidth = new JLabel();
    fldBarWidth = new MyTextFieldD(app, fieldWidth);
    fldBarWidth.setEditable(true);
    fldBarWidth.addActionListener(this);
    fldBarWidth.addFocusListener(this);

    // barChartWidthPanel
    barChartWidthPanel = new JPanel();
    barChartWidthPanel.setLayout(new BoxLayout(barChartWidthPanel, BoxLayout.Y_AXIS));
    barChartWidthPanel.add(LayoutUtil.flowPanel(ckAutoBarWidth));
    barChartWidthPanel.add(LayoutUtil.flowPanel(tab, lblBarWidth, fldBarWidth));

    layoutBarChartPanel();
  }
예제 #2
0
  /** Creates a panel to evaluate the regression model for a given x value */
  private void createPredictionPanel() {

    JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
    lblEvaluate = new JLabel();
    fldInputX = new MyTextFieldD(app);
    fldInputX.addActionListener(this);

    fldInputX.setColumns(6);
    lblOutputY = new JLabel();
    fldOutputY = new JLabel();

    p.add(lblEvaluate);
    p.add(new JLabel("x = "));
    p.add(fldInputX);
    p.add(new JLabel("y = "));
    p.add(lblOutputY);
    p.add(fldOutputY);

    predictionPanel = new JPanel(new BorderLayout());
    predictionPanel.add(p, loc.borderWest());
  }
예제 #3
0
  private void createGraphPanel() {

    // create components
    ckAutoWindow = new JCheckBox();
    ckAutoWindow.addActionListener(this);

    ckShowGrid = new JCheckBox();
    ckShowGrid.addActionListener(this);

    lblXMin = new JLabel();
    fldXMin = new MyTextFieldD(app, fieldWidth);
    fldXMin.setEditable(true);
    fldXMin.addActionListener(this);
    fldXMin.addFocusListener(this);

    lblXMax = new JLabel();
    fldXMax = new MyTextFieldD(app, fieldWidth);
    fldXMax.addActionListener(this);
    fldXMax.addFocusListener(this);

    lblYMin = new JLabel();
    fldYMin = new MyTextFieldD(app, fieldWidth);
    fldYMin.addActionListener(this);
    fldYMin.addFocusListener(this);

    lblYMax = new JLabel();
    fldYMax = new MyTextFieldD(app, fieldWidth);
    fldYMax.addActionListener(this);
    fldYMax.addFocusListener(this);

    lblXInterval = new JLabel();
    fldXInterval = new MyTextFieldD(app, fieldWidth);
    fldXInterval.addActionListener(this);
    fldXInterval.addFocusListener(this);

    lblYInterval = new JLabel();
    fldYInterval = new MyTextFieldD(app, fieldWidth);
    fldYInterval.addActionListener(this);
    fldYInterval.addFocusListener(this);

    /*
     * Coordinate alternative
     */
    rbStandToStand = new JRadioButton();
    rbStandToStand.addActionListener(this);
    rbLogToStand = new JRadioButton();
    rbLogToStand.addActionListener(this);
    rbStandToLog = new JRadioButton();
    rbStandToLog.addActionListener(this);
    rbLogToLog = new JRadioButton();
    rbLogToLog.addActionListener(this);

    ButtonGroup logAxesButtons = new ButtonGroup();
    logAxesButtons.add(rbStandToStand);
    logAxesButtons.add(rbLogToStand);
    logAxesButtons.add(rbStandToLog);
    logAxesButtons.add(rbLogToLog);

    // create graph options panel
    JPanel graphOptionsPanel = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.weightx = 1;
    c.anchor = GridBagConstraints.LINE_START;
    graphOptionsPanel.add(ckShowGrid, c);
    c.insets = new Insets(0, 0, 4, 0);
    graphOptionsPanel.add(ckAutoWindow, c);

    // create window dimensions panel
    dimPanel = new JPanel(new GridBagLayout());
    GridBagConstraints c1 = new GridBagConstraints();
    c1.gridx = 0;
    c1.gridy = 0;
    c1.weightx = 0;
    c1.insets = new Insets(2, 10, 0, 0);
    c1.anchor = GridBagConstraints.EAST;

    GridBagConstraints c2 = new GridBagConstraints();
    c2.gridx = 1;
    c2.gridy = 0;
    c2.weightx = 1;
    c2.insets = c1.insets;
    c2.anchor = GridBagConstraints.WEST;

    // x dimensions
    dimPanel.add(lblXMin, c1);
    dimPanel.add(fldXMin, c2);

    c1.gridy++;
    c2.gridy++;
    dimPanel.add(lblXMax, c1);
    dimPanel.add(fldXMax, c2);

    c1.gridy++;
    c2.gridy++;
    dimPanel.add(lblXInterval, c1);
    dimPanel.add(fldXInterval, c2);

    // y dimensions
    c1.insets.top += 8; // add vertical gap
    c1.gridy++;
    c2.gridy++;
    dimPanel.add(lblYMin, c1);
    dimPanel.add(fldYMin, c2);
    c1.insets.top -= 8; // remove vertical gap

    c1.gridy++;
    c2.gridy++;
    dimPanel.add(lblYMax, c1);
    dimPanel.add(fldYMax, c2);

    c1.gridy++;
    c2.gridy++;
    dimPanel.add(lblYInterval, c1);
    dimPanel.add(fldYInterval, c2);

    // create coordinate mode panel
    coordPanel = new JPanel(new GridBagLayout());
    coordPanel.add(rbStandToStand, c);
    coordPanel.add(rbLogToStand, c);
    coordPanel.add(rbStandToLog, c);
    coordPanel.add(rbLogToLog, c);

    // put the sub-panels together
    Box vBox = Box.createVerticalBox();
    vBox.add(graphOptionsPanel);
    vBox.add(dimPanel);
    if (app.has(Feature.LOG_AXES)) {
      vBox.add(coordPanel);
    }

    graphPanel = new JPanel(new BorderLayout());
    graphPanel.add(vBox, BorderLayout.NORTH);
    graphPanel.setBorder(BorderFactory.createEmptyBorder());
  }