Normand Briere
2019-11-17 cb37a129d1adb403019c96e798e86e2da9667f15
BiparamEditor.java
....@@ -4,6 +4,8 @@
44 import javax.swing.*;
55 import javax.swing.event.*;
66
7
+import grafeme.ui.*;
8
+
79 class BiparamEditor extends ObjEditor implements ItemListener, ChangeListener, ObjectUI, ActionListener
810 {
911 BiparamEditor(Biparam inBP, GroupEditor callee)
....@@ -65,11 +67,16 @@
6567 oe.aConstraints.gridwidth = 1;
6668 */
6769 super.SetupUI2(oe);
68
-
69
- uDivsField = AddSlider(oe.ctrlPanel, "U #", biparam.minUDivs, 250+biparam.minUDivs, biparam.uDivs);
70
- Return();
71
- vDivsField = AddSlider(oe.ctrlPanel, "V #", biparam.minVDivs, (int)(250/6.28)+biparam.minVDivs, biparam.vDivs);
72
- Return();
70
+
71
+ uvPanel = new cGridBag().setVertical(true);
72
+
73
+ int count = 50;
74
+
75
+ uDivsField = (cNumberSlider)AddSlider(uvPanel, "U #", biparam.minUDivs, (int)(count*this.biparam.uStretch()) + biparam.minUDivs, biparam.uDivs).getComponent(1);
76
+ vDivsField = (cNumberSlider)AddSlider(uvPanel, "V #", biparam.minVDivs, (int)(count) + biparam.minVDivs, biparam.vDivs).getComponent(1);
77
+
78
+ oe.ctrlPanel.add(uvPanel);
79
+ oe.ctrlPanel.Return();
7380 // oe.aConstraints.gridwidth = 1;
7481 // oe.aConstraints.fill = GridBagConstraints.VERTICAL;
7582 // oe.ctrlPanel.add(uDivsLabel = new JLabel("U #"), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
....@@ -96,17 +103,11 @@
96103 // oe.aConstraints.gridwidth = 1;
97104 if (biparam instanceof Cone) // ends)
98105 {
99
- oe.aConstraints.gridy += 1;
100
- oe.aConstraints.gridwidth = 3;
101
-// oe.aConstraints.anchor = GridBagConstraints.WEST;
102
- oe.ctrlPanel.add(optionCB = new JCheckBox("Close Surface", biparam.endcaps), oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
103
- optionCB.addItemListener(this);
104
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
105
- oe.aConstraints.gridwidth = 1;
106
+ oe.ctrlPanel.add(optionCB = new JCheckBox("Close Surface", biparam.endcaps)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
107
+ optionCB.addItemListener(this);
108
+ oe.ctrlPanel.Return();
106109 //endcaps.setState(!biparam.endcaps);
107110 }
108
- oe.aConstraints.gridy += 1;
109
- oe.aConstraints.gridx = 0;
110111 }
111112
112113 void Clear()
....@@ -141,6 +142,7 @@
141142 if (//e.getSource() == nameField ||
142143 e.getSource() == optionCB)
143144 {
145
+ new Exception().printStackTrace();
144146 //System.out.println(e);
145147 applySelf();
146148 //super.applySelf();
....@@ -205,7 +207,7 @@
205207 public void applySelf()
206208 {
207209 //System.out.println("Biparam :: applySelf");
208
- //super.applySelf();
210
+ super.applySelf();
209211 int udivs = uDivsField.getInteger(); // biparam.minUDivs, 99);
210212 int vdivs = vDivsField.getInteger(); // biparam.minUDivs, 99);
211213 //biparam.name = nameField.getText();
....@@ -244,8 +246,9 @@
244246 // oe.ctrlPanel.remove(uDivsLabel);
245247 // oe.ctrlPanel.remove(vDivsLabel);
246248 // //oe.ctrlPanel.repaint();
247
- Remove(uDivsField);
248
- Remove(vDivsField);
249
+// Remove(uDivsField);
250
+// Remove(vDivsField);
251
+ oe.ctrlPanel.remove(uvPanel);
249252
250253 super.closeUI();
251254 }
....@@ -263,10 +266,12 @@
263266 Biparam biparam;
264267 //JLabel uDivsLabel;
265268 //JLabel vDivsLabel;
266
- NumberSlider uDivsField;
267
- NumberSlider vDivsField;
269
+ cNumberSlider uDivsField;
270
+ cNumberSlider vDivsField;
268271 JCheckBox optionCB;
269272
273
+ cGridBag uvPanel;
274
+
270275 ObjectUI parent;
271276
272277 //ObjEditor objEditor;