Class JXPanel

    • Constructor Detail

      • JXPanel

        public JXPanel()
        Creates a new JXPanel with a double buffer and a flow layout.
      • JXPanel

        public JXPanel​(boolean isDoubleBuffered)
        Creates a new JXPanel with FlowLayout and the specified buffering strategy. If isDoubleBuffered is true, the JXPanel will use a double buffer.
        Parameters:
        isDoubleBuffered - a boolean, true for double-buffering, which uses additional memory space to achieve fast, flicker-free updates
      • JXPanel

        public JXPanel​(LayoutManager layout)
        Create a new buffered JXPanel with the specified layout manager
        Parameters:
        layout - the LayoutManager to use
      • JXPanel

        public JXPanel​(LayoutManager layout,
                       boolean isDoubleBuffered)
        Creates a new JXPanel with the specified layout manager and buffering strategy.
        Parameters:
        layout - the LayoutManager to use
        isDoubleBuffered - a boolean, true for double-buffering, which uses additional memory space to achieve fast, flicker-free updates
    • Method Detail

      • setAlpha

        public void setAlpha​(float alpha)
        Set the alpha transparency level for this component. This automatically causes a repaint of the component.

        TODO add support for animated changes in translucency

        Parameters:
        alpha - must be a value between 0 and 1 inclusive.
      • getAlpha

        public float getAlpha()
        Returns:
        the alpha translucency level for this component. This will be a value between 0 and 1, inclusive.
      • getEffectiveAlpha

        public float getEffectiveAlpha()
        Unlike other properties, alpha can be set on a component, or on one of its parents. If the alpha of a parent component is .4, and the alpha on this component is .5, effectively the alpha for this component is .4 because the lowest alpha in the heirarchy "wins"
      • isInheritAlpha

        public boolean isInheritAlpha()
        Returns the state of the panel with respect to inheriting alpha values.
        Returns:
        true if this panel inherits alpha values; false otherwise
        See Also:
        setInheritAlpha(boolean)
      • setInheritAlpha

        public void setInheritAlpha​(boolean val)
        Determines if the effective alpha of this component should include the alpha of ancestors.
        Parameters:
        val - true to include ancestral alpha data; false otherwise
        See Also:
        isInheritAlpha(), getEffectiveAlpha()
      • setScrollableTracksViewportHeight

        public void setScrollableTracksViewportHeight​(boolean scrollableTracksViewportHeight)
        Sets the vertical size tracking to either ScrollableSizeTrack.FIT or NONE, if the boolean parameter is true or false, respectively.

        NOTE: this method is kept for backward compatibility only, for full control use setScrollableHeightHint.

        Parameters:
        scrollableTracksViewportHeight - The scrollableTracksViewportHeight to set.
        See Also:
        setScrollableHeightHint(ScrollableSizeHint)
      • setScrollableTracksViewportWidth

        public void setScrollableTracksViewportWidth​(boolean scrollableTracksViewportWidth)
        Sets the horizontal size tracking to either ScrollableSizeTrack.FIT or NONE, if the boolean parameter is true or false, respectively.

        NOTE: this method is kept for backward compatibility only, for full control use setScrollableWidthHint.

        Parameters:
        scrollableTracksViewportWidth - The scrollableTracksViewportWidth to set.
        See Also:
        setScrollableWidthHint(ScrollableSizeHint)
      • setBackgroundPainter

        public void setBackgroundPainter​(Painter p)
        Sets a Painter to use to paint the background of this JXPanel.
        Parameters:
        p - the new painter
        See Also:
        getBackgroundPainter()
      • getBackgroundPainter

        public Painter getBackgroundPainter()
        Returns the current background painter. The default value of this property is a painter which draws the normal JPanel background according to the current look and feel.
        Returns:
        the current painter
        See Also:
        setBackgroundPainter(Painter), isPaintBorderInsets()
      • isPaintBorderInsets

        public boolean isPaintBorderInsets()
        Returns true if the background painter should paint where the border is or false if it should only paint inside the border. This property is true by default. This property affects the width, height, and initial transform passed to the background painter.
      • setPaintBorderInsets

        public void setPaintBorderInsets​(boolean paintBorderInsets)
        Sets the paintBorderInsets property. Set to true if the background painter should paint where the border is or false if it should only paint inside the border. This property is true by default. This property affects the width, height, and initial transform passed to the background painter. This is a bound property.
      • paint

        public void paint​(Graphics g)
        Overridden paint method to take into account the alpha setting
        Overrides:
        paint in class JComponent
        Parameters:
        g -
      • paintComponent

        protected void paintComponent​(Graphics g)
        Overridden to provide Painter support. It will call backgroundPainter.paint() if it is not null, else it will call super.paintComponent().
        Overrides:
        paintComponent in class JComponent