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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations