| 91 | |
| 92 | // Konstruktor |
| 93 | OneParameter(Project pro) { |
| 94 | project = pro; |
| 95 | |
| 96 | setLayout(new BorderLayout()); |
| 97 | JPanel flowPanel = new JPanel(); |
| 98 | JPanel parText = new JPanel(new FlowLayout()); |
| 99 | |
| 100 | // flowPanel.add(cbox); |
| 101 | |
| 102 | nameLabel = new JLabel("p" + parNo); |
| 103 | fctLabel = new JLabel(" "+nameLabel.getText()+":="); |
| 104 | fct.setText(" "+nameLabel.getText()+" "); |
| 105 | fct.addActionListener(new ActionListener() { |
| 106 | public void actionPerformed(ActionEvent evt) { |
| 107 | fct.setText(fct.getText()); |
| 108 | repaint(); |
| 109 | } |
| 110 | }); |
| 111 | |
| 112 | flowPanel.add(nameLabel); |
| 113 | |
| 114 | parSlider = new JSlider(0, 1000); |
| 115 | parSlider.setValue(500); |
| 116 | parSlider.setMinorTickSpacing(10); |
| 117 | parSlider.setMajorTickSpacing(100); |
| 118 | parSlider.setPaintTicks(true); |
| 119 | parSlider.addChangeListener(new ChangeListener() { |
| 120 | public void stateChanged(ChangeEvent evt) { |
| 121 | updateparSliderAndLabel(); |
| 122 | } |
| 123 | }); |
| 124 | |
| 125 | flowPanel.add(new JLabel(" ")); |
| 126 | |
| 127 | flowPanel.add(fromLabel); |
| 128 | flowPanel.add(from); |
| 129 | from.addActionListener(new ActionListener() { |
| 130 | public void actionPerformed(ActionEvent evt) { |
| 131 | try { |
| 132 | double tmp = Double.parseDouble(from.getText()); |
| 133 | if (tmp <= oldTo) { |
| 134 | tmp = Math.round(tmp * 1000) / 1000.0; |
| 135 | // System.out.println("newFrom:"+tmp); |
| 136 | oldFrom = tmp; |
| 137 | newFrom = tmp; |
| 138 | updateparSliderAndLabel(); |
| 139 | } else { |
| 140 | from.setText("" + oldFrom); |
| 141 | } |
| 142 | } catch (Exception nanEx) { |
| 143 | from.setText("" + oldFrom); |
| 144 | // System.out.println("oldFrom:"+oldFrom); |
| 145 | } |
| 146 | } |
| 147 | }); |
| 148 | to.addActionListener(new ActionListener() { |
| 149 | public void actionPerformed(ActionEvent evt) { |
| 150 | try { |