import java.awt.*;
|
import java.awt.event.*;
|
import javax.swing.*;
|
import javax.swing.event.*;
|
|
class BezierEditor extends ObjEditor // implements ActionListener
|
{
|
BezierEditor(Object3D inBezier, GroupEditor callee)
|
{
|
super(inBezier, callee);
|
bezier = (BezierElement) inBezier;
|
|
objEditor = callee.GetEditor();
|
|
SetupUI2(objEditor);
|
}
|
|
BezierEditor(Object3D inBezier, Object3D copy, GroupEditor callee)
|
{
|
super(inBezier, copy, callee); // false);
|
bezier = (BezierElement) copy;
|
|
objEditor = this;
|
|
SetupWindow();
|
SetupUI2(this);
|
}
|
|
void SetupUI2(ObjEditor oe)
|
{
|
super.SetupUI2(oe);
|
|
oe.ctrlPanel.add(depthLabel = new JLabel("Depth")); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
oe.ctrlPanel.Return();
|
oe.ctrlPanel.add(depthField = new NumberSlider(0, 5)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount()-2);
|
|
depthField.setInteger(bezier.GetDepth());
|
depthField.addChangeListener(this);
|
}
|
|
void refreshContents()
|
{
|
objEditor.refreshContents();
|
}
|
|
void Clear()
|
{
|
super.Clear();
|
|
bezier = null;
|
}
|
|
public void closeUI()
|
{
|
ObjEditor oe = GetEditor();
|
|
depthField.removeChangeListener(this);
|
oe.ctrlPanel.remove(depthLabel);
|
oe.ctrlPanel.remove(depthField);
|
|
super.closeUI();
|
}
|
|
public void stateChanged(ChangeEvent e)
|
{
|
if (e.getSource() == depthField)
|
{
|
applySelf();
|
// june 2013 super.applySelf();
|
refreshContents();
|
}
|
else
|
super.stateChanged(e);
|
}
|
|
/*
|
public void actionPerformed(ActionEvent e)
|
{
|
if (e.getSource() == depthField)
|
{
|
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)
|
{
|
return super.action(event, obj);
|
}
|
|
public void applySelf()
|
{
|
// june 2013 super.applySelf();
|
|
bezier.SetDepth(depthField.getInteger());
|
bezier.recalculate();
|
}
|
|
BezierElement bezier;
|
JLabel depthLabel;
|
NumberSlider depthField;
|
}
|