Class JSAbstractColorFormatPanel

    • Field Detail

      • ctxSquare

        protected final simulation.dom.$CanvasRenderingContext2D ctxSquare
        The rendering context of the square
      • ctxRect

        protected final simulation.dom.$CanvasRenderingContext2D ctxRect
        The rendering context of the rect
    • Constructor Detail

      • JSAbstractColorFormatPanel

        protected JSAbstractColorFormatPanel()
        Creates the object
    • Method Detail

      • addRadio

        protected void addRadio​(JSRadioButton radio,
                                java.lang.String text,
                                boolean selected,
                                int gridx,
                                int gridy)
        Adds a radio button
        Parameters:
        radio - The radio button
        text - The text
        selected - true to select the radio button, false otherwise
        gridx - The grid x
        gridy - The grid y
      • addSlider

        protected void addSlider​(JSSlider slider,
                                 JSSpinner spinner,
                                 int value,
                                 int max,
                                 int gridx,
                                 int gridy)
        Adds a slider
        Parameters:
        slider - The slider
        spinner - The connected spinner
        value - The value
        max - The max value
        gridx - The grid x
        gridy - The grid y
      • addSpinner

        protected void addSpinner​(JSSpinner spinner,
                                  JSSlider slider,
                                  int value,
                                  int max,
                                  int gridx,
                                  int gridy)
        Adds a spinner
        Parameters:
        spinner - The spinner
        slider - The connected slider
        value - The value
        max - The max value
        gridx - The grid x
        gridy - The grid y
      • drawAll

        protected void drawAll()
        Draws all objects
      • drawSquare

        protected abstract void drawSquare()
        Draws the square
      • drawSquareSelector

        protected abstract void drawSquareSelector()
        Draws the square selector
      • drawCircle

        protected void drawCircle​(double x,
                                  double y)
        Draws the circle selector
        Parameters:
        x - The x-axis coordinate
        y - The y-axis coordinate
      • drawRect

        protected abstract void drawRect()
        Draws the rect
      • drawRectSelector

        protected abstract void drawRectSelector()
        Draws the rect selector
      • drawLine

        protected void drawLine​(double y)
        Draws the line
        Parameters:
        y - The y-axis coordinate
      • squareEvent

        protected abstract void squareEvent​(def.dom.MouseEvent event,
                                            java.lang.String type)
        Manages a mouse event on the square
        Parameters:
        event - The mouse event
        type - The event type
      • canDoItSquare

        protected boolean canDoItSquare​(def.dom.MouseEvent event,
                                        java.lang.String type)
        Checks if a mouse event can be managed on the square
        Parameters:
        event - The mouse event
        type - The event type
        Returns:
        true if the mouse event can be managed on the square, false otherwise
      • rectEvent

        protected abstract void rectEvent​(def.dom.MouseEvent event,
                                          java.lang.String type)
        Manages a mouse event on the rect
        Parameters:
        event - The mouse event
        type - The event type
      • canDoItRect

        protected boolean canDoItRect​(def.dom.MouseEvent event,
                                      java.lang.String type)
        Checks if a mouse event can be managed on the rect
        Parameters:
        event - The mouse event
        type - The event type
        Returns:
        true if the mouse event can be managed on the square, false otherwise
      • getValueIsAdjusting

        public boolean getValueIsAdjusting()
        Returns if the selected color is "adjusting"
        Returns:
        true if the selected color is adjusting, false otherwise
      • addChangeListener

        public void addChangeListener​(ChangeListener listener)
        Adds a change listener
        Parameters:
        listener - The listener
      • onchange

        protected void onchange​(boolean b)
        To call to invoke a change event
        Parameters:
        b - true if the value is adjusting, false otherwise
      • getSelectedColor

        public abstract Color getSelectedColor()
        Returns the selected color
        Returns:
        The selected color
      • setSelectedColor

        public abstract void setSelectedColor​(Color color)
        Sets the selected color
        Parameters:
        color - The selected color