@Override
    public void update() {
        if(Mouse.getX()>getX() && Mouse.getX()<getX()+getWidth()){
            int mousey = Display.getHeight() - Mouse.getY();

            if(mousey>getY() && mousey<getY()+getHeight()){
                if(Mouse.isButtonDown(0)){
                    activate=true;
                }
            }
        }

        if(activate){
            if(!Mouse.isButtonDown(0)){
                activate=false;
                setChanged();
                notifyObservers(getPercentage());
            }
            else{
                sliderPosition = (Mouse.getX()-getX()) <= getWidth() ? (Mouse.getX()-getX()) : getWidth();
                sliderPosition = sliderPosition>=0? sliderPosition:0;
            }

        }
    }