diff options
| author | Joshua Rahm <joshua.rahm@colorado.edu> | 2015-01-30 17:11:48 -0700 |
|---|---|---|
| committer | Joshua Rahm <joshua.rahm@colorado.edu> | 2015-01-30 17:11:48 -0700 |
| commit | 1c5e38fe69ac8a6decbdd8abe93112f4e3369315 (patch) | |
| tree | 926cef8cb76d46862ed2c4ec7028720611e47476 /src/RegressionDialog.java | |
| download | Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.tar.gz Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.tar.bz2 Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.zip | |
added source
Diffstat (limited to 'src/RegressionDialog.java')
| -rw-r--r-- | src/RegressionDialog.java | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/src/RegressionDialog.java b/src/RegressionDialog.java new file mode 100644 index 0000000..a7217e1 --- /dev/null +++ b/src/RegressionDialog.java @@ -0,0 +1,96 @@ +/* */ import GUIComponents.PushablePanel; +/* */ import GUIComponents.ToggleButtonGroup; +/* */ import GUIComponents.WrapperPanel; +/* */ import java.awt.Color; +/* */ import java.awt.Dimension; +/* */ import java.awt.Frame; +/* */ import java.awt.event.ActionEvent; +/* */ import java.awt.event.ActionListener; +/* */ import java.util.ArrayList; +/* */ import javax.swing.BoxLayout; +/* */ import javax.swing.JButton; +/* */ import javax.swing.JComponent; +/* */ import javax.swing.JDialog; +/* */ import javax.swing.JPanel; +/* */ import javax.swing.JToggleButton; +/* */ +/* */ public abstract class RegressionDialog extends JDialog +/* */ implements ActionListener +/* */ { +/* */ private StatPlotDialog dialog; +/* */ private PushablePanel panel; +/* 23 */ private ToggleButtonGroup buttonGroup = new ToggleButtonGroup(); +/* 24 */ private ArrayList<ActionListener> listeners = new ArrayList(); +/* */ private JButton ok; +/* */ private JButton cancel; +/* */ +/* */ public RegressionDialog(Frame owner, String title, StatPlotDialog dialog) +/* */ { +/* 27 */ super(owner, title, true); +/* 28 */ JPanel main = new JPanel(); +/* 29 */ main.setLayout(new BoxLayout(main, 1)); +/* 30 */ this.dialog = dialog; +/* 31 */ this.panel = new PushablePanel(); +/* 32 */ for (int i = 0; i < dialog.getPlots().size(); i++) { +/* 33 */ JToggleButton button = new JToggleButton("Statplot #" + (i + 1)); +/* 34 */ button.setBackground(Color.white); +/* 35 */ this.buttonGroup.addToggleButton(button); +/* 36 */ this.panel.pushComponent(button); +/* */ } +/* 38 */ this.panel.setPreferredSize(new Dimension(150, 250)); +/* 39 */ this.ok = new JButton("Calculate"); +/* 40 */ this.cancel = new JButton("Cancel"); +/* 41 */ this.ok.addActionListener(this); +/* 42 */ this.cancel.addActionListener(this); +/* 43 */ main.add(this.panel); +/* 44 */ main.add(new WrapperPanel(new JComponent[] { this.ok, this.cancel })); +/* 45 */ add(main); +/* 46 */ pack(); +/* */ } +/* */ public void addActionListener(ActionListener listen) { +/* 49 */ this.listeners.add(listen); +/* */ } +/* */ +/* */ public void actionPerformed(ActionEvent e) { +/* 53 */ if (e.getSource() == this.ok) { +/* 54 */ e.setSource(this); +/* 55 */ for (int i = 0; i < this.listeners.size(); i++) { +/* 56 */ ((ActionListener)this.listeners.get(i)).actionPerformed(e); +/* */ } +/* 58 */ calculateRegression(); +/* */ } +/* 60 */ setVisible(false); +/* */ } +/* */ public ToggleButtonGroup getToggleButtonGroup() { +/* 63 */ return this.buttonGroup; +/* */ } +/* */ public void setVisible(boolean b) { +/* 66 */ if (b) { +/* 67 */ this.panel.removeAllComponents(); +/* 68 */ this.buttonGroup = new ToggleButtonGroup(); +/* 69 */ for (int i = 0; i < this.dialog.getPlots().size(); i++) { +/* 70 */ JToggleButton button = new JToggleButton("Statplot #" + (i + 1)); +/* 71 */ button.setBackground(Color.white); +/* 72 */ this.buttonGroup.addToggleButton(button); +/* 73 */ this.panel.pushComponent(button); +/* */ } +/* 75 */ super.setVisible(b); +/* */ } +/* */ else { +/* 78 */ super.setVisible(b); +/* */ } +/* */ } +/* */ +/* 82 */ public StatPlotDialog getStatPlotDialog() { return this.dialog; } +/* */ +/* */ public StatPlot getSelectedStatPlot() { +/* 85 */ return (StatPlot)this.dialog.getPlots().get(this.buttonGroup.getSelectedIndex()); +/* */ } +/* */ +/* */ public abstract double[] calculateRegression(); +/* */ } + +/* Location: Modulus.jar + * Qualified Name: RegressionDialog + * JD-Core Version: 0.6.2 + */
\ No newline at end of file |