Search in sources :

Example 1 with NSlider

use of automenta.vivisect.swing.NSlider in project opennars by opennars.

the class NARGraphPanel method newCanvasPanel.

protected JPanel newCanvasPanel() {
    JPanel m = new JPanel(new FlowLayout(FlowLayout.LEFT));
    NSlider blur = new NSlider(0, 0, 1.0f) {

        @Override
        public void onChange(float v) {
            canvas.setMotionBlur(v);
        }
    };
    blur.setPrefix("Blur: ");
    blur.setPreferredSize(new Dimension(60, 25));
    m.add(blur);
    return m;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) NSlider(automenta.vivisect.swing.NSlider) Dimension(java.awt.Dimension)

Example 2 with NSlider

use of automenta.vivisect.swing.NSlider in project opennars by opennars.

the class NARControls method newSpeedSlider.

private NSlider newSpeedSlider() {
    final StringBuilder sb = new StringBuilder(32);
    final NSlider s = new NSlider(0f, 0f, 1.0f) {

        @Override
        public String getText() {
            if (value == null) {
                return "";
            }
            if (sb.length() > 0)
                sb.setLength(0);
            sb.append(memory.time());
            if (currentSpeed == 0) {
                sb.append(" - pause");
            } else if (currentSpeed == 1.0) {
                sb.append(" - max speed");
            } else {
                sb.append(" - ").append(nar.getMinCyclePeriodMS()).append(" ms/step");
            }
            return sb.toString();
        }

        @Override
        public void onChange(float v) {
            setSpeed(v);
        }
    };
    this.speedSlider = s;
    return s;
}
Also used : NSlider(automenta.vivisect.swing.NSlider)

Example 3 with NSlider

use of automenta.vivisect.swing.NSlider in project narchy by automenta.

the class PredictGUI method addSlider.

private NSlider addSlider(String label, AtomicDouble value, float min, float max) {
    NSlider slider;
    add(new JLabel(label), cons);
    add(slider = new NSlider(value, min, max), cons);
    return slider;
}
Also used : NSlider(automenta.vivisect.swing.NSlider)

Example 4 with NSlider

use of automenta.vivisect.swing.NSlider in project opennars by opennars.

the class NARControls method newIntSlider.

private NSlider newIntSlider(final PortableInteger x, final String prefix, int min, int max) {
    final NSlider s = new NSlider(x.intValue(), min, max) {

        @Override
        public String getText() {
            return prefix + ": " + super.getText();
        }

        @Override
        public void setValue(float v) {
            int i = (int) Math.round(v);
            super.setValue(i);
            x.set(i);
        }

        @Override
        public void onChange(float v) {
        }
    };
    return s;
}
Also used : NSlider(automenta.vivisect.swing.NSlider)

Example 5 with NSlider

use of automenta.vivisect.swing.NSlider in project opennars by opennars.

the class NARControls method newParameterPanel.

private JComponent newParameterPanel() {
    JPanel p = new JPanel();
    JPanel pc = new JPanel();
    pc.setLayout(new GridLayout(1, 0));
    stopButton = new AwesomeButton(FA_StopCharacter);
    stopButton.setBackground(Color.DARK_GRAY);
    stopButton.addActionListener(this);
    pc.add(stopButton);
    walkButton = new AwesomeButton('\uf051');
    walkButton.setBackground(Color.DARK_GRAY);
    walkButton.setToolTipText("Walk 1 Cycle");
    walkButton.addActionListener(this);
    pc.add(walkButton);
    JButton focusButton = new AwesomeButton(FA_FocusCharacter);
    focusButton.setBackground(Color.DARK_GRAY);
    focusButton.setToolTipText("Focus");
    focusButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            setSpeed(1.0f);
            volumeSlider.setValue(0.0f);
        }
    });
    pc.add(focusButton);
    JButton pluginsButton = new AwesomeButton(FA_ControlCharacter);
    pluginsButton.setToolTipText("Plugins");
    pluginsButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            new NWindow("Plugins", new PluginPanel(nar)).show(350, 600);
        }
    });
    pc.add(pluginsButton);
    p.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.NORTH;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.gridx = 0;
    c.ipady = 8;
    p.add(pc, c);
    NSlider vs = newVolumeSlider();
    vs.setFont(vs.getFont().deriveFont(Font.BOLD));
    p.add(vs, c);
    NSlider ss = newSpeedSlider();
    ss.setFont(vs.getFont());
    p.add(ss, c);
    c.ipady = 4;
    p.add(new NSlider(memory.param.decisionThreshold, "Decision Threshold", 0.0f, 1.0f), c);
    p.add(new NSlider(Parameters.projectionDecay, "Projection Decay", 0.0f, 1.0f), c);
    p.add(new NSlider(memory.param.taskLinkForgetDurations, "Task Duration", 0.0f, 20), c);
    p.add(new NSlider(memory.param.termLinkForgetDurations, "Belief Duration", 0.0f, 20), c);
    p.add(new NSlider(memory.param.conceptForgetDurations, "Concept Duration", 0.0f, 20), c);
    p.add(new NSlider(memory.param.eventForgetDurations, "Event Duration", 0.0f, 20), c);
    return p;
}
Also used : JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) GridBagConstraints(java.awt.GridBagConstraints) ActionListener(java.awt.event.ActionListener) GridBagLayout(java.awt.GridBagLayout) NSlider(automenta.vivisect.swing.NSlider) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) NWindow(automenta.vivisect.swing.NWindow) PluginPanel(nars.gui.output.PluginPanel) AwesomeButton(automenta.vivisect.swing.AwesomeButton)

Aggregations

NSlider (automenta.vivisect.swing.NSlider)6 JPanel (javax.swing.JPanel)3 Dimension (java.awt.Dimension)2 FlowLayout (java.awt.FlowLayout)2 AwesomeButton (automenta.vivisect.swing.AwesomeButton)1 NWindow (automenta.vivisect.swing.NWindow)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 GridLayout (java.awt.GridLayout)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 JButton (javax.swing.JButton)1 PluginPanel (nars.gui.output.PluginPanel)1