use of maspack.widgets.DoubleIntervalField in project artisynth_core by artisynth.
the class NumericProbeEditor method fillPanes.
private void fillPanes() {
vectorPane.removeAll();
propPane.removeAll();
addVectorButton = new JButton(GuiStorage.getAddIcon());
GuiUtils.setFixedSize(addVectorButton, 25, 25);
addVectorButton.addActionListener(this);
addVectorButton.setActionCommand("Add");
addVectorButton.setAlignmentX(LEFT_ALIGNMENT);
addVectorButton.setOpaque(true);
addPropertyButton = new JButton(GuiStorage.getAddIcon());
GuiUtils.setFixedSize(addPropertyButton, 25, 25);
addPropertyButton.setActionCommand("Add Property");
addPropertyButton.addActionListener(this);
addPropertyButton.setAlignmentX(LEFT_ALIGNMENT);
addPropertyButton.setOpaque(true);
infoPaneA = new JPanel();
infoPaneA.setLayout(new BoxLayout(infoPaneA, BoxLayout.X_AXIS));
infoPaneA.setOpaque(false);
infoPaneB = new JPanel();
infoPaneB.setLayout(new BoxLayout(infoPaneB, BoxLayout.X_AXIS));
infoPaneB.setOpaque(false);
nameLabel = new JLabel("Name");
infoPaneA.setAlignmentX(LEFT_ALIGNMENT);
infoPaneA.add(nameLabel);
infoPaneA.add(Box.createRigidArea(new Dimension(15, 0)));
infoPaneA.add(Box.createHorizontalGlue());
infoPaneA.add(new JLabel("Dim"));
infoPaneC = new JPanel();
infoPaneC.setLayout(new BoxLayout(infoPaneC, BoxLayout.X_AXIS));
infoPaneC.add(Box.createHorizontalGlue());
infoPaneC.add(new JLabel("Formula"));
infoPaneC.add(Box.createHorizontalGlue());
infoPaneC.setOpaque(false);
infoPaneC.setAlignmentX(LEFT_ALIGNMENT);
infoPaneB.add(Box.createRigidArea(new Dimension(50, 0)));
infoPaneB.add(Box.createHorizontalGlue());
infoPaneB.add(new JLabel("Component"));
infoPaneB.add(Box.createHorizontalGlue());
infoPaneB.add(new JLabel("Property"));
infoPaneB.setAlignmentX(LEFT_ALIGNMENT);
infoPaneB.add(Box.createRigidArea(new Dimension(100, 0)));
vectorPane.add(infoPaneA);
propPane.add(infoPaneB);
equationPane.add(infoPaneC);
// filePane.add(new JLabel("File:"));
// filePane.add(horizontalSpacer(10));
attachedFileField = new StringField("attached file", 24);
// filePane.add(attachedFileField);
// filePane.add(horizontalSpacer(10));
browseButton = new JButton("Browse");
browseButton.addActionListener(this);
attachedFileField.addMajorComponent(browseButton);
// filePane.add(browseButton);
// todo: retreive default values from Probe class
startTimeField = new DoubleField("start time", Probe.getDefaultStartTime());
startTimeField.setColumns(8);
startTimeField.setFormat("%8.4f");
endTimeField = new DoubleField("end time", Probe.getDefaultStopTime());
endTimeField.setColumns(8);
endTimeField.setFormat("%8.4f");
scaleField = new DoubleField("scale", Probe.getDefaultScale());
scaleField.setColumns(8);
intervalField = new DoubleField("update interval", 0.01, "%8.4f");
intervalField.setColumns(8);
// intervalField.setFormat ("%8.4f");
probeNameField = new StringField("name", 8);
probeNameField.setValue("");
probeNameField.setStretchable(true);
dispUpperField = new DoubleField("upper", 50);
dispUpperField.setColumns(4);
dispLowerField = new DoubleField("lower", -50);
dispLowerField.setColumns(4);
rangeField = new DoubleIntervalField("display range");
rangeField.setGUIVoidEnabled(true);
rangeField.setVoidValueEnabled(true);
// optionsPane.add(probeNameField);
// optionsPane.add(horizontalSpacer(5));
// optionsPane.add(startTimeField);
// optionsPane.add(horizontalSpacer(5));
// optionsPane.add(endTimeField);
// optionsPane.add(horizontalSpacer(5));
leftPropertyPanel.addWidget(probeNameField);
leftPropertyPanel.addWidget(startTimeField);
leftPropertyPanel.addWidget(endTimeField);
// optionsPane.add(scaleField);
// optionsPane.add(Box.createRigidArea(new Dimension(5, 0)));
addProbeButton = new JButton("Done");
addProbeButton.addActionListener(this);
closeButton = new JButton("Cancel");
closeButton.addActionListener(this);
bottomPane.add(addProbeButton);
bottomPane.add(Box.createRigidArea(new Dimension(10, 0)));
bottomPane.add(closeButton);
}
use of maspack.widgets.DoubleIntervalField in project artisynth_core by artisynth.
the class NumericProbeDisplayLarge method initialize.
private void initialize() {
setSize(new Dimension(700, 400));
String inputOutputString = (myProbe.isInput()) ? "Input probe" : "Output probe";
setTitle(myTrackNumber + " " + inputOutputString + ": " + myProbe.getName());
// create probe panels based on the fact if it is input or output probes
myPanel = (NumericProbePanel) myProbe.getDisplay(getWidth(), getHeight(), LARGE_PROBE_DISPLAY);
if (myPanel.isAutoRanging()) {
myPanel.adjustRangeIfNecessary();
}
JToolBar sideToolBar = new JToolBar(JToolBar.VERTICAL);
zoomInBtn = ButtonCreator.createIconicButton(zoomInIcon, "Zoom In", "Zoom In", true, false, this);
zoomOutBtn = ButtonCreator.createIconicButton(zoomOutIcon, "Zoom Out", "Zoom Out", true, false, this);
moveDisplayBtn = ButtonCreator.createIconicButton(moveDisplayIcon, "Move Display", "Move Display", true, false, this);
pointerBtn = ButtonCreator.createIconicButton(pointerIcon, "Edit Plot", "Edit Plot", true, false, this);
upArrowBtn = ButtonCreator.createIconicButton(upArrowIcon, "Increase Range", "Increase Range", true, false, this);
downArrowBtn = ButtonCreator.createIconicButton(downArrowIcon, "Decrease Range", "Decrease Range", true, false, this);
fitRangeBtn = ButtonCreator.createIconicButton(fitRangeIcon, "Fit Range", "Fit Range", true, false, this);
autoRangeCheck = new BooleanSelector("Auto range", true);
autoRangeCheck.addValueChangeListener(this);
setYRange(myPanel.getAutoRange());
setXRange(myPanel.getDefaultDomain());
yRangeField = new DoubleIntervalField("Y range", new DoubleInterval(yMin, yMax), "%.6g");
yRangeField.addValueChangeListener(this);
xRangeField = new DoubleIntervalField("X range", new DoubleInterval(xMin, xMax), "%.6g");
xRangeField.addValueChangeListener(this);
sideToolBar.add(pointerBtn);
sideToolBar.addSeparator();
sideToolBar.add(zoomInBtn);
sideToolBar.add(zoomOutBtn);
sideToolBar.add(moveDisplayBtn);
sideToolBar.addSeparator();
sideToolBar.add(upArrowBtn);
sideToolBar.add(downArrowBtn);
sideToolBar.add(fitRangeBtn);
sideToolBar.addSeparator();
JToolBar rangeToolBar = new JToolBar();
rangeToolBar.add(autoRangeCheck);
rangeToolBar.addSeparator();
rangeToolBar.add(yRangeField);
rangeToolBar.addSeparator();
rangeToolBar.add(xRangeField);
rangeToolBar.addSeparator();
normalBorder = zoomInBtn.getBorder();
getContentPane().setLayout(new BorderLayout());
getContentPane().add(myPanel, BorderLayout.CENTER);
getContentPane().add(sideToolBar, BorderLayout.WEST);
getContentPane().add(rangeToolBar, BorderLayout.NORTH);
pack();
}
use of maspack.widgets.DoubleIntervalField in project artisynth_core by artisynth.
the class PropertyWidgetDialog method initialize.
private void initialize() {
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
Container pane = getContentPane();
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
LabeledComponentPanel propPanel = new LabeledComponentPanel();
propPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
// myChooser = new PropertyChooser ("component/property", 30, myMain);
// myChooser.setAlignmentX (Component.CENTER_ALIGNMENT);
// myChooser.addValueChangeListener (this);
// pane.add (Box.createRigidArea (new Dimension (0, 4)));
// propPanel.addWidget (myChooser);
myPropField = new PropertyField("component/property", 30, myMain);
myPropField.setAlignmentX(Component.CENTER_ALIGNMENT);
myPropField.addValueChangeListener(this);
propPanel.addWidget(myPropField);
propPanel.addWidget(new JSeparator());
mySliderSelector = new BooleanSelector("slider");
mySliderSelector.addValueChangeListener(this);
propPanel.addWidget(mySliderSelector);
myRangeField = new DoubleIntervalField("range", new DoubleInterval(0, 1), "%.6g");
// new VectorMultiField (
// "range", new String[] { "min:", "max:" }, new Vector2d (0, 1),
// "%.6f");
// myRangeField.setAlignmentX (Component.CENTER_ALIGNMENT);
propPanel.addWidget(myRangeField);
myLabelTextField = new StringField("labelText", 20);
myLabelTextField.setEnabledAll(false);
myLabelTextField.addValueCheckListener(new ValueCheckListener() {
public Object validateValue(ValueChangeEvent e, StringHolder errMsg) {
String newName = (String) e.getValue();
String err = ModelComponentBase.checkName(newName, null);
if (err != null) {
err = "Invalid name '" + newName + "': " + err;
newName = null;
}
if (errMsg != null) {
errMsg.value = err;
}
return newName;
}
});
propPanel.addWidget(myLabelTextField);
myLabelFontColorSelector = new ColorSelector("labelFontColor");
myLabelFontColorSelector.enableNullColors();
myLabelFontColorSelector.setValue(null);
propPanel.addWidget(myLabelFontColorSelector);
myBackgroundColorSelector = new ColorSelector("backgroundColor");
myBackgroundColorSelector.enableNullColors();
myBackgroundColorSelector.setValue(null);
propPanel.addWidget(myBackgroundColorSelector);
// sliderPanel.add (myRangeField);
// pane.add (Box.createRigidArea (new Dimension (0, 4)));
// pane.add (sliderPanel);
pane.add(propPanel);
pane.add(new JSeparator());
// set slider value here because valueChanged needs some
// other widgets instantiated.
mySliderSelector.setValue(false);
mySliderSelector.setEnabledAll(false);
OptionPanel options = new OptionPanel("OK Cancel", this);
myOKButton = options.getButton("OK");
myOKButton.setEnabled(false);
options.setAlignmentX(Component.CENTER_ALIGNMENT);
pane.add(options);
pack();
}
Aggregations