Normand Briere
2019-12-25 3d30e720e6f012f2d9996b136154dd551844998a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// Decompiled by Jad v1.5.7b. Copyright 1997-99 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   LatheEditor.java
 
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
 
class LatheEditor extends /*Biparam*/ObjEditor implements ActionListener //, ObjectUI
{
   LatheEditor(Lathe inLathe, GroupEditor callee)
   {
            super(inLathe, callee);
            lathe = (Lathe) inLathe;
            spline = lathe.spline;
            
            objEditor = callee.GetEditor();
            
            SetupUI2(callee.GetEditor());
        }
        
   LatheEditor(Lathe inLathe, Object3D copy, GroupEditor callee)
   {
       super(inLathe, copy, null, callee); // false);
       //parent = this;
       lathe = (Lathe) copy;
       spline = lathe.spline;
       
                objEditor = this;
                
       SetupWindow();
       SetupUI2(this);
   }
   
   void SetupUI2(ObjEditor oe)
   {
                super.SetupUI2(oe);
                
       oe.ctrlPanel.add(typeLabel = new JLabel("Spline Type:")); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
 
                oe.ctrlPanel.Return();
                
                oe.ctrlPanel.add(typeMenu = new JComboBox()); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
       typeMenu.addActionListener(this);
 
                oe.ctrlPanel.Return();
                
                typeMenu.addItem("Linear");
       typeMenu.addItem("Quadratic");
       typeMenu.addItem("Cubic");
       //typeMenu.select(spline.type - 1);
                /*
       oe.aConstraints.gridwidth = ObjEditor.GRIDWIDTH;
       oe.ctrlPanel.add(prompt = new JLabel("Ctrl key inserts/deletes"), oe.aConstraints);
       oe.aConstraints.gridwidth = 1;
       oe.topView.object = spline;
       oe.aConstraints.gridx = 0;
       oe.aConstraints.gridy += 1;
                 */
   }
   
   void refreshContents2()
   {
       objEditor.refreshContents();
   }
   
   void Clear()
   {
       super.Clear();
       
       lathe = null;
       spline = null;
   }
   
   public void closeUI()
   {
       ObjEditor oe = GetEditor();
       
       typeMenu.removeActionListener(this);
       oe.ctrlPanel.remove(typeMenu);
       oe.ctrlPanel.remove(typeLabel);
       //oe.ctrlPanel.repaint();
       
       super.closeUI();
   }
   
   public void actionPerformed(ActionEvent e)
   {
       if (e.getSource() == typeMenu)
       {
           //System.out.println(e);
           applySelf();
           //refreshContents();
           client.refreshEditWindow();
       }
       else
           super.actionPerformed(e);
   }
   
   /*
   public void doLayout()
   {
       super.doLayout();
       labelAndField(typeLabel, typeMenu);
       prompt.setBounds(5, widgetPos, 190, textHeight);
   }
   */
   
   public boolean action(Event event, Object obj)
   {
       if (event.target == typeMenu)
       {
           spline.type = typeMenu.getSelectedIndex() + 1;
           topView.repaint();
           return true;
       } else
       {
           return super.action(event, obj);
       }
   }
   
   public void applySelf()
   {
// june 2013        super.applySelf();
       spline.type = typeMenu.getSelectedIndex() + 1;
       lathe.recalculate();
   }
   
   Lathe lathe;
   Spline spline;
   JLabel typeLabel;
   JComboBox typeMenu;
   JLabel prompt;
}