Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Darkstorm Sliders Not Working! Please help

Came to hack forums to look for a solution to my sliders being disabled. When I try to drag the slider it doesn't drag, and I dont know why. I've spent about an hour trying to figure it out with no luck. Please help.

Here's the source:

Code
public void createValueFrame() {
        Theme theme = getTheme();
        Frame valuesFrame = new BasicFrame("Values");
        valuesFrame.setTheme(theme);
        valuesFrame.setX(50);
        valuesFrame.setY(50);
        Dimension defaultDimension = theme.getUIForComponent(valuesFrame).getDefaultSize(valuesFrame);
        valuesFrame.setWidth(defaultDimension.width);
        valuesFrame.setHeight(defaultDimension.height);
        valuesFrame.layoutChildren();
        valuesFrame.setVisible(true);
        valuesFrame.setClosable(false);
        valuesFrame.setMinimized(true);
        
        for (final Value v: Value.getVals()) {
            if (v.getValueDisplay() == null) continue;
            
            Slider slider = new BasicSlider(v.getName());
            slider.update();
            slider.setValueDisplay(v.getValueDisplay());
            slider.setValue((double)v.getValue());
            slider.setMaximumValue((double)v.getMax());
            slider.setMinimumValue((double)v.getMin());
            slider.setIncrement(0.100F);
            slider.setEnabled(true);
            slider.setValueChanging(true);
            slider.addSliderListener(new SliderListener() {
                @Override
                public void onSliderValueChanged(Slider slider) {
                    v.setValue(slider.getValue());                    
                }
            });
            valuesFrame.add(slider);
        }
        addFrame(valuesFrame);
    }

and here is the Value class (which is in the for loop)
Code
public class Value {
    
    private double value, min, max;
    private String name;
    private ValueDisplay valueDisplay;
    private static ArrayList<Value> vals = new ArrayList<Value>();

    public Value(String name, double value, double min, double max, ValueDisplay valueDisplay) {
        this.setName(name);
        this.setValue(value);
        this.setMin(min);
        this.setMax(max);
        this.setValueDisplay(valueDisplay);
        this.getVals().add(this);
    }
    
    public static ArrayList<Value> getVals() {
        return vals;
    }
    
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public ValueDisplay getValueDisplay() {
        return valueDisplay;
    }

    public void setValueDisplay(ValueDisplay valueDisplay) {
        this.valueDisplay = valueDisplay;
    }

    public double getValue() {
        return value;
    }

    public void setValue(double value) {
        this.value = value;
    }

    public double getMin() {
        return min;
    }

    public void setMin(double min) {
        this.min = min;
    }

    public double getMax() {
        return max;
    }

    public void setMax(double max) {
        this.max = max;
    }
    
}

Please help!
Hey gamer, first off: maybe don't use darkstorm. Sure, it's a good reference for when you're starting off, but you'll find making your own GUI the way you want it will be better for you.

Second: You need to call the slider.update() method on every tick (unsure if you're doing it based on the code you supplied).

Third: remember to always dab bro dabbing helps the world go 'round you know?

have a good day this post is a bit too hq for me

Edit: I think theres a method in like GuiManager that calls the update method on the sliders, not sure though...


Possibly Related Threads...
Thread / Author Replies Views Last Post
by dootJun 20, 2019 10:00 PM 4 437 Jun 20, 2019 10:00 PM
Last Post: TeamOceanox
by DispatchMartyrApr 5, 2017 04:33 PM 13 878 Apr 5, 2017 04:33 PM
Last Post: HorribleCoder
by turk1234Nov 16, 2016 04:45 PM 2 266 Nov 16, 2016 04:45 PM
Last Post: foddermc