示例#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 updateGUI() {

    // set updating flag so we don't have to add/remove action listeners
    isUpdating = true;

    // histogram/barchart
    ckManual.setSelected(settings.isUseManualClasses());
    rbFreq.setSelected(settings.getFrequencyType() == StatPanelSettings.TYPE_COUNT);
    rbRelative.setSelected(settings.getFrequencyType() == StatPanelSettings.TYPE_RELATIVE);
    rbNormalized.setSelected(settings.getFrequencyType() == StatPanelSettings.TYPE_NORMALIZED);
    rbLeftRule.setSelected(settings.isLeftRule());
    ckCumulative.setSelected(settings.isCumulative());
    ckOverlayNormal.setSelected(settings.isHasOverlayNormal());
    ckOverlayPolygon.setSelected(settings.isHasOverlayPolygon());
    ckShowGrid.setSelected(settings.showGrid);
    ckAutoWindow.setSelected(settings.isAutomaticWindow());
    ckShowFrequencyTable.setSelected(settings.isShowFrequencyTable());
    ckShowHistogram.setSelected(settings.isShowHistogram());

    if (settings.dataSource != null) {
      ckManual.setVisible(settings.getDataSource().getGroupType() != GroupType.CLASS);
      freqPanel.setVisible(settings.getDataSource().getGroupType() == GroupType.RAWDATA);
    }
    // normal overlay
    ckOverlayNormal.setEnabled(settings.getFrequencyType() == StatPanelSettings.TYPE_NORMALIZED);

    // bar chart width
    ckAutoBarWidth.setSelected(settings.isAutomaticBarWidth());
    fldBarWidth.setText("" + settings.getBarWidth());
    fldBarWidth.setEnabled(!ckAutoBarWidth.isSelected());

    // window dimension
    lblYMin.setVisible(showYAxisSettings);
    fldYMin.setVisible(showYAxisSettings);
    lblYMax.setVisible(showYAxisSettings);
    fldYMax.setVisible(showYAxisSettings);
    lblYInterval.setVisible(showYAxisSettings);
    fldYInterval.setVisible(showYAxisSettings);

    dimPanel.setEnabled(!ckAutoWindow.isSelected());
    fldXMin.setEnabled(!ckAutoWindow.isSelected());
    fldXMax.setEnabled(!ckAutoWindow.isSelected());
    fldXInterval.setEnabled(!ckAutoWindow.isSelected());
    fldYMin.setEnabled(!ckAutoWindow.isSelected());
    fldYMax.setEnabled(!ckAutoWindow.isSelected());
    fldYInterval.setEnabled(!ckAutoWindow.isSelected());

    lblXMin.setEnabled(!ckAutoWindow.isSelected());
    lblXMax.setEnabled(!ckAutoWindow.isSelected());
    lblXInterval.setEnabled(!ckAutoWindow.isSelected());
    lblYMin.setEnabled(!ckAutoWindow.isSelected());
    lblYMax.setEnabled(!ckAutoWindow.isSelected());
    lblYInterval.setEnabled(!ckAutoWindow.isSelected());

    // coordinate mode
    rbStandToStand.setSelected(settings.getCoordMode() == StatPanelSettings.CoordMode.STANDTOSTAND);
    rbLogToStand.setSelected(settings.getCoordMode() == StatPanelSettings.CoordMode.LOGTOSTAND);
    rbStandToLog.setSelected(settings.getCoordMode() == StatPanelSettings.CoordMode.STANDTOLOG);
    rbLogToLog.setSelected(settings.getCoordMode() == StatPanelSettings.CoordMode.LOGTOLOG);

    // update automatic dimensions
    fldXMin.setText("" + daModel.format(settings.xMin));
    fldXMax.setText("" + daModel.format(settings.xMax));
    fldXInterval.setText("" + daModel.format(settings.xAxesInterval));

    fldYMin.setText("" + daModel.format(settings.yMin));
    fldYMax.setText("" + daModel.format(settings.yMax));
    fldYInterval.setText("" + daModel.format(settings.yAxesInterval));

    // show outliers
    ckShowOutliers.setSelected(settings.isShowOutliers());

    isUpdating = false;
    repaint();
  }
示例#4
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());
  }
示例#5
0
 /** Clears the X and Y fields of the prediction panel */
 public void clearPredictionPanel() {
   fldInputX.setText("");
   fldOutputY.setText("");
 }