Search in sources :

Example 6 with NSlider

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

the class NARGraphDisplay method getControls.

// 
// @Override
// public int getTextColor(V v) {
// return defaultTextColor;
// 
// }
// 
public JPanel getControls() {
    JPanel menu = new JPanel(new FlowLayout(FlowLayout.LEFT));
    NSlider nodeSize = new NSlider(this.nodeSize, 1, maxNodeSize) {

        @Override
        public void onChange(float v) {
            NARGraphDisplay.this.nodeSize = v;
        // app.drawn = false;
        }
    };
    nodeSize.setPrefix("Node Size: ");
    nodeSize.setPreferredSize(new Dimension(80, 25));
    menu.add(nodeSize);
    NSlider edgeWidth = new NSlider(this.lineWidth, 0f, maxNodeSize / 4f) {

        @Override
        public void onChange(float v) {
            lineWidth = v;
        // app.drawn = false;
        }
    };
    edgeWidth.setPrefix("Line Thick: ");
    edgeWidth.setPreferredSize(new Dimension(80, 25));
    menu.add(edgeWidth);
    NSlider nodeSpeed = new NSlider(this.nodeSpeed, 0.001f, 0.99f) {

        @Override
        public void onChange(float v) {
            NARGraphDisplay.this.nodeSpeed = (float) v;
        // app.drawn = false;
        }
    };
    nodeSpeed.setPrefix("Speed: ");
    nodeSpeed.setPreferredSize(new Dimension(70, 25));
    menu.add(nodeSpeed);
    NSlider fontSize = new NSlider(this.textSize, 0f, 2f) {

        @Override
        public void onChange(float v) {
            NARGraphDisplay.this.textSize = (float) v;
        // app.drawn = false;
        }
    };
    fontSize.setPrefix("Font: ");
    fontSize.setPreferredSize(new Dimension(70, 25));
    menu.add(fontSize);
    return menu;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) NSlider(automenta.vivisect.swing.NSlider) Dimension(java.awt.Dimension)

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