From b3ae4e889872ca0b9ca76f1d17b2f0b961226729 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 05 Aug 2019 21:48:55 -0400
Subject: [PATCH] Fix physics UI

---
 SuperEditor.java |   69 ++++++++++++++++------------------
 1 files changed, 33 insertions(+), 36 deletions(-)

diff --git a/SuperEditor.java b/SuperEditor.java
index b7632c5..52a920d 100644
--- a/SuperEditor.java
+++ b/SuperEditor.java
@@ -8,6 +8,8 @@
 import javax.swing.*;
 import javax.swing.event.*;
 
+import grafeme.ui.*;
+
 class SuperEditor extends BiparamEditor implements ChangeListener, ObjectUI // ActionListener
 {
 	/*
@@ -46,38 +48,29 @@
 	void SetupUI2(ObjEditor oe)
 	{
             super.SetupUI2(oe);
-		ObjEditor.aConstraints.gridwidth = 1;
-		oe.ctrlPanel.add(northLabel = new JLabel("XY Exp"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount()-2);
-		ObjEditor.aConstraints.fill = GridBagConstraints.HORIZONTAL;
-		ObjEditor.aConstraints.gridx += 1;
-		ObjEditor.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
-		oe.ctrlPanel.add(northField = new NumberSlider(0.0001,20,-1), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount()-2);
-		ObjEditor.aConstraints.gridx = 0;
-		ObjEditor.aConstraints.gridy += 1;
-		ObjEditor.aConstraints.gridwidth = 1;
-		ObjEditor.aConstraints.fill = GridBagConstraints.NONE;
-		oe.ctrlPanel.add(eastLabel = new JLabel("Z Exp"), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount()-2);
-		ObjEditor.aConstraints.gridx += 1;
-		ObjEditor.aConstraints.fill = GridBagConstraints.HORIZONTAL;
-		ObjEditor.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
-		oe.ctrlPanel.add(eastField = new NumberSlider(0.0001,20,-1), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount()-2);
-		ObjEditor.aConstraints.gridx = 0;
-		ObjEditor.aConstraints.gridy += 1;
-		ObjEditor.aConstraints.gridwidth = 1;
-			ObjEditor.aConstraints.gridwidth = 3;
-//			ObjEditor.aConstraints.anchor = GridBagConstraints.WEST;
-            oe.ctrlPanel.add(optionCB = new JCheckBox("Reverse", (superE.radius<0)), ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount()-2);
+            
+            northPanel = new cGridBag();
+            
+		northPanel.add(northLabel = new JLabel("XY factor")); //, ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount()-2);
+                northPanel.add(northField = new cNumberSlider(this, 0.0001,20, -1)); //, ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount()-2);
+                oe.ctrlPanel.add(northPanel);		
+                
+                oe.ctrlPanel.Return();
+            eastPanel = new cGridBag();
+                eastPanel.add(eastLabel = new JLabel("Z factor")); //, ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount()-2);
+                eastPanel.add(eastField = new cNumberSlider(this, 0.0001,20, -1)); //, ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount()-2);
+                oe.ctrlPanel.add(eastPanel);		
+
+                oe.ctrlPanel.Return();
+                //			ObjEditor.aConstraints.anchor = GridBagConstraints.WEST;
+            oe.ctrlPanel.add(optionCB = new JCheckBox("Reverse", (superE.radius<0))); //, ObjEditor.aConstraints, oe.ctrlPanel.getComponentCount()-2);
 			optionCB.addItemListener(this);
-//			ObjEditor.aConstraints.anchor = GridBagConstraints.EAST;
-			ObjEditor.aConstraints.gridwidth = 1;
-		ObjEditor.aConstraints.gridx = 0;
-		ObjEditor.aConstraints.gridy += 1;
-		northField.setFloat(superE.north);
+
+                oe.ctrlPanel.Return();
+                
+                northField.setFloat(superE.north);
 		eastField.setFloat(superE.east);
-		northField.addChangeListener(this);
-		eastField.addChangeListener(this);
-		ObjEditor.aConstraints.fill = GridBagConstraints.NONE;
-	}
+        }
 	
 	public void closeUI()
 	{
@@ -87,10 +80,12 @@
 		eastField.removeChangeListener(this);
 		optionCB.removeItemListener(this);
 		oe.ctrlPanel.remove(optionCB);
-		oe.ctrlPanel.remove(northField);
-		oe.ctrlPanel.remove(eastField);
-		oe.ctrlPanel.remove(northLabel);
-		oe.ctrlPanel.remove(eastLabel);
+		oe.ctrlPanel.remove(northPanel);
+		oe.ctrlPanel.remove(eastPanel);
+//		oe.ctrlPanel.remove(northField);
+//		oe.ctrlPanel.remove(eastField);
+//		oe.ctrlPanel.remove(northLabel);
+//		oe.ctrlPanel.remove(eastLabel);
 		//oe.ctrlPanel.repaint();
 		
 		super.closeUI();
@@ -184,9 +179,11 @@
 	Superellipsoid superE;
 	JLabel northLabel;
 	JLabel eastLabel;
-	NumberSlider northField;
-	NumberSlider eastField;
+	cNumberSlider northField;
+	cNumberSlider eastField;
 	
+        cGridBag northPanel;
+        cGridBag eastPanel;
 	//BiparamEditor objEditor;
 }
 

--
Gitblit v1.6.2