Search in sources :

Example 11 with DoubleField

use of maspack.widgets.DoubleField in project artisynth_core by artisynth.

the class MenuBarHandler method createTimeDisplay.

private DoubleField createTimeDisplay() {
    DoubleField display = new DoubleField("", 0, "%9.5f");
    display.setToolTipText("current time");
    display.getTextField().setToolTipText("current time");
    display.setEnabledAll(false);
    display.setColumns(7);
    return display;
}
Also used : DoubleField(maspack.widgets.DoubleField)

Example 12 with DoubleField

use of maspack.widgets.DoubleField in project artisynth_core by artisynth.

the class ExcitationTargetAgent method createTargetList.

protected void createTargetList() {
    myTargetPanel = new SelectableComponentPanel();
    myTargetPanel.setSelectionManager(mySelectionManager);
    myTargetPanel.setSpacing(0);
    for (int i = 0; i < myExciter.numTargets(); i++) {
        DoubleField widget = createTargetWidget(myExciter.getTarget(i), myExciter.getGain(i));
        myTargetPanel.addWidget(widget);
        myTargetPanel.mapWidgetToComponent(widget, myExciter.getTarget(i));
    }
    myTargetPanel.addMouseListener(new ListMouseHandler());
    JLabel label = new JLabel("Existing targets and gains:");
    GuiUtils.setItalicFont(label);
    addToContentPane(label);
    myListScroller = new JScrollPane(myTargetPanel);
    myListScroller.setPreferredSize(new Dimension(280, 150));
    myListScroller.setMinimumSize(new Dimension(280, 150));
    addToContentPane(myListScroller);
}
Also used : JScrollPane(javax.swing.JScrollPane) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) SelectableComponentPanel(artisynth.core.gui.SelectableComponentPanel) DoubleField(maspack.widgets.DoubleField)

Example 13 with DoubleField

use of maspack.widgets.DoubleField in project artisynth_core by artisynth.

the class MotionTargetComponentAgent method createTargetList.

protected void createTargetList() {
    myTargetPanel = new SelectableComponentPanel();
    myTargetPanel.setSelectionManager(mySelectionManager);
    myTargetPanel.setSpacing(0);
    for (int i = 0; i < myController.getMotionSources().size(); i++) {
        DoubleField widget = createTargetWidget(myController.getMotionSources().get(i), myController.getMotionTargetWeights().get(i));
        myTargetPanel.addWidget(widget);
        myTargetPanel.mapWidgetToComponent(widget, myController.getMotionSources().get(i));
    }
    myTargetPanel.addMouseListener(new ListMouseHandler());
    JLabel label = new JLabel("Existing targets and weights:");
    GuiUtils.setItalicFont(label);
    addToContentPane(label);
    myListScroller = new JScrollPane(myTargetPanel);
    myListScroller.setPreferredSize(new Dimension(480, 150));
    myListScroller.setMinimumSize(new Dimension(480, 150));
    addToContentPane(myListScroller);
}
Also used : JScrollPane(javax.swing.JScrollPane) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) SelectableComponentPanel(artisynth.core.gui.SelectableComponentPanel) DoubleField(maspack.widgets.DoubleField)

Example 14 with DoubleField

use of maspack.widgets.DoubleField in project artisynth_core by artisynth.

the class MotionTargetComponentAgent method selectionChanged.

public void selectionChanged(SelectionEvent e) {
    ModelComponent c = e.getLastAddedComponent();
    if (isValidTarget(c)) {
        MotionTargetComponent comp = (MotionTargetComponent) c;
        if (myState == State.SelectingTargets && !myController.getMotionSources().contains(comp) && !myController.getMotionTargets().contains(comp)) {
            myController.addMotionTarget(comp, 1.0);
            DoubleField widget = createTargetWidget(comp, 1.0);
            myTargetPanel.addWidget(widget);
            myTargetPanel.mapWidgetToComponent(widget, comp);
            myTargetPanel.revalidate();
            myTargetPanel.repaint();
        }
    // else if (myExciter.findTarget(ex) != -1)
    // { mySelectedTargets.add (ex);
    // }
    }
}
Also used : ModelComponent(artisynth.core.modelbase.ModelComponent) MotionTargetComponent(artisynth.core.mechmodels.MotionTargetComponent) DoubleField(maspack.widgets.DoubleField)

Example 15 with DoubleField

use of maspack.widgets.DoubleField in project artisynth_core by artisynth.

the class MotionTargetComponentAgent method createTargetWidget.

DoubleField createTargetWidget(MotionTargetComponent target, double gain) {
    String name = ComponentUtils.getPathName(myAncestor, target);
    DoubleField field = new DoubleField(name, gain);
    field.addValueChangeListener(new WeightHandler(target));
    field.setLabelStretchable(true);
    field.setStretchable(true);
    return field;
}
Also used : DoubleField(maspack.widgets.DoubleField)

Aggregations

DoubleField (maspack.widgets.DoubleField)19 BooleanSelector (maspack.widgets.BooleanSelector)4 Dimension (java.awt.Dimension)3 JLabel (javax.swing.JLabel)3 IntegerField (maspack.widgets.IntegerField)3 VectorField (maspack.widgets.VectorField)3 SelectableComponentPanel (artisynth.core.gui.SelectableComponentPanel)2 ModelComponent (artisynth.core.modelbase.ModelComponent)2 JButton (javax.swing.JButton)2 JScrollPane (javax.swing.JScrollPane)2 StringHolder (maspack.util.StringHolder)2 OptionPanel (maspack.widgets.OptionPanel)2 ValueChangeEvent (maspack.widgets.ValueChangeEvent)2 ValueCheckListener (maspack.widgets.ValueCheckListener)2 MuscleElementDesc (artisynth.core.femmodels.MuscleElementDesc)1 ExcitationComponent (artisynth.core.mechmodels.ExcitationComponent)1 MotionTargetComponent (artisynth.core.mechmodels.MotionTargetComponent)1 WayPoint (artisynth.core.probes.WayPoint)1 File (java.io.File)1 BoxLayout (javax.swing.BoxLayout)1