private JPanel createRegressionPanel() { // components String[] orders = {"2", "3", "4", "5", "6", "7", "8", "9"}; cbPolyOrder = new JComboBox(orders); cbPolyOrder.setSelectedIndex(0); cbPolyOrder.addActionListener(this); cbPolyOrder.setFocusable(false); regressionLabels = new String[Regression.values().length]; setRegressionLabels(); cbRegression = new JComboBox(regressionLabels); cbRegression.addActionListener(this); cbRegression.setFocusable(false); lblRegEquation = new JLabel(); lblEqn = new JLabel(); // regression combo panel JPanel cbPanel = new JPanel(); cbPanel.setLayout(new BoxLayout(cbPanel, BoxLayout.Y_AXIS)); cbPanel.add(LayoutUtil.flowPanel(cbRegression)); cbPanel.add(LayoutUtil.flowPanel(cbPolyOrder)); // regression label panel JPanel eqnPanel = new JPanel(new BorderLayout()); eqnPanel.add(lblRegEquation, BorderLayout.CENTER); JScrollPane scroller = new JScrollPane(eqnPanel); scroller.setBorder(BorderFactory.createEmptyBorder()); // prediction panel createPredictionPanel(); // model panel: equation + prediction JPanel modelPanel = new JPanel(); modelPanel.setLayout(new BoxLayout(modelPanel, BoxLayout.Y_AXIS)); modelPanel.add(scroller); modelPanel.add(predictionPanel); // put it all together regressionPanel = new JPanel(new BorderLayout(30, 0)); regressionPanel.add(modelPanel, BorderLayout.CENTER); regressionPanel.add(cbPanel, loc.borderWest()); regressionPanel.setBorder(BorderFactory.createTitledBorder(loc.getMenu("RegressionModel"))); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(regressionPanel, BorderLayout.CENTER); return mainPanel; }
public void setLabels() { // titled borders classesPanel.setBorder(BorderFactory.createTitledBorder(loc.getMenu("Classes"))); showPanel.setBorder(BorderFactory.createTitledBorder(loc.getMenu("Show"))); freqPanel.setBorder(BorderFactory.createTitledBorder(loc.getMenu("FrequencyType"))); dimPanel.setBorder(BorderFactory.createTitledBorder(loc.getPlain("Dimensions"))); coordPanel.setBorder(BorderFactory.createTitledBorder(loc.getMenu("Coordinate Mode"))); // histogram options ckManual.setText(loc.getMenu("SetClasssesManually")); lblFreqType.setText(loc.getMenu("FrequencyType") + ":"); rbFreq.setText(loc.getMenu("Count")); rbNormalized.setText(loc.getMenu("Normalized")); rbRelative.setText(loc.getMenu("Relative")); ckCumulative.setText(loc.getMenu("Cumulative")); lblOverlay.setText(loc.getMenu("Overlay")); ckOverlayNormal.setText(loc.getMenu("NormalCurve")); ckOverlayPolygon.setText(loc.getMenu("FrequencyPolygon")); ckShowFrequencyTable.setText(loc.getMenu("FrequencyTable")); ckShowHistogram.setText(loc.getMenu("Histogram")); lblClassRule.setText(loc.getMenu("ClassRule") + ":"); rbRightRule.setText(loc.getMenu("RightClassRule")); rbLeftRule.setText(loc.getMenu("LeftClassRule")); // bar chart lblBarWidth.setText(loc.getMenu("Width")); ckAutoBarWidth.setText(loc.getMenu("AutoDimension")); // graph options ckAutoWindow.setText(loc.getMenu("AutoDimension")); ckShowGrid.setText(loc.getMenu("ShowGrid")); lblXMin.setText(loc.getMenu("xmin") + ":"); lblXMax.setText(loc.getMenu("xmax") + ":"); lblYMin.setText(loc.getMenu("ymin") + ":"); lblYMax.setText(loc.getMenu("ymax") + ":"); lblXInterval.setText(loc.getMenu("xstep") + ":"); lblYInterval.setText(loc.getMenu("ystep") + ":"); rbStandToStand.setText(loc.getMenu("Standard To Standard")); rbLogToStand.setText(loc.getMenu("Logarithmic To Standard")); rbStandToLog.setText(loc.getMenu("Standard To Logarithmic")); rbLogToLog.setText(loc.getMenu("Logarithmic To Logarithmic")); // scatterplot options ckShowLines.setText(loc.getMenu("LineGraph")); // boxplot options ckShowOutliers.setText(loc.getMenu("ShowOutliers")); repaint(); }
public void setPanel(PlotType plotType) { tabbedPane.removeAll(); this.setVisible(true); // add plot-specific tab String tabTitle = plotType.getTranslatedKey(loc); tabbedPane.insertTab(tabTitle, null, new JScrollPane(mainPanel), null, 0); classesPanel.setVisible(false); histogramPanel.setVisible(false); scatterplotPanel.setVisible(false); barChartPanel.setVisible(false); boxPlotPanel.setVisible(false); rbNormalized.setVisible(false); ckOverlayNormal.setVisible(false); ckShowHistogram.setVisible(false); ckCumulative.setVisible(false); ckOverlayPolygon.setVisible(false); // add graph tab tabbedPane.addTab(loc.getMenu("Graph"), new JScrollPane(graphPanel)); graphPanel.setVisible(true); showYAxisSettings = true; // set visibility for plot-specific panels switch (plotType) { case HISTOGRAM: classesPanel.setVisible(true); histogramPanel.setVisible(true); rbNormalized.setVisible(true); ckOverlayNormal.setVisible(true); ckShowHistogram.setVisible(true); ckCumulative.setVisible(true); ckOverlayPolygon.setVisible(true); layoutHistogramPanel(); break; case BOXPLOT: case MULTIBOXPLOT: boxPlotPanel.setVisible(true); break; case BARCHART: barChartPanel.setVisible(true); layoutBarChartPanel(); break; case SCATTERPLOT: scatterplotPanel.setVisible(true); break; // graph tab only case DOTPLOT: case NORMALQUANTILE: case RESIDUAL: tabbedPane.removeTabAt(0); break; case STEMPLOT: this.setVisible(false); break; } setLabels(); updateGUI(); }