Normand Briere
2019-08-23 60cec91731a350fe67e9b5ffe7a00d70e9026314
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, 1024+biparam.minUDivs, biparam.uDivs);
70
- Return();
71
- vDivsField = AddSlider(oe.ctrlPanel, "V #", biparam.minVDivs, 1024+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);
106
+ oe.ctrlPanel.add(optionCB = new JCheckBox("Close Surface", biparam.endcaps)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
103107 optionCB.addItemListener(this);
104
-// oe.aConstraints.anchor = GridBagConstraints.EAST;
105
- oe.aConstraints.gridwidth = 1;
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()
....@@ -205,7 +206,7 @@
205206 public void applySelf()
206207 {
207208 //System.out.println("Biparam :: applySelf");
208
- //super.applySelf();
209
+ super.applySelf();
209210 int udivs = uDivsField.getInteger(); // biparam.minUDivs, 99);
210211 int vdivs = vDivsField.getInteger(); // biparam.minUDivs, 99);
211212 //biparam.name = nameField.getText();
....@@ -244,8 +245,9 @@
244245 // oe.ctrlPanel.remove(uDivsLabel);
245246 // oe.ctrlPanel.remove(vDivsLabel);
246247 // //oe.ctrlPanel.repaint();
247
- Remove(uDivsField);
248
- Remove(vDivsField);
248
+// Remove(uDivsField);
249
+// Remove(vDivsField);
250
+ oe.ctrlPanel.remove(uvPanel);
249251
250252 super.closeUI();
251253 }
....@@ -261,12 +263,14 @@
261263 }
262264
263265 Biparam biparam;
264
- JLabel uDivsLabel;
265
- JLabel vDivsLabel;
266
- NumberSlider uDivsField;
267
- NumberSlider vDivsField;
266
+ //JLabel uDivsLabel;
267
+ //JLabel vDivsLabel;
268
+ cNumberSlider uDivsField;
269
+ cNumberSlider vDivsField;
268270 JCheckBox optionCB;
269271
272
+ cGridBag uvPanel;
273
+
270274 ObjectUI parent;
271275
272276 //ObjEditor objEditor;