|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.jdesktop.swingx.JXPanel
public class JXPanel
A simple JPanel extension that adds translucency support. This component and all of its content will be displayed with the specified "alpha" transluscency property value. It also supports the Painters using the backgroundPainter property. For example, to change the background of the panel to a checkeboard do something like this:
JXPanel panel = new JXPanel();
panel.setBackgroundPainter(new CheckerboardPainter());
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JXPanel()
Creates a new instance of JXPanel |
|
JXPanel(boolean isDoubleBuffered)
|
|
JXPanel(LayoutManager layout)
|
|
JXPanel(LayoutManager layout,
boolean isDoubleBuffered)
|
Method Summary | |
---|---|
float |
getAlpha()
|
Painter |
getBackgroundPainter()
Returns the current background painter. |
float |
getEffectiveAlpha()
Unlike other properties, alpha can be set on a component, or on one of its parents. |
Dimension |
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for a view component. |
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation. |
boolean |
getScrollableTracksViewportHeight()
Return true if a viewport should always force the height of this Scrollable to match the height of the viewport. |
boolean |
getScrollableTracksViewportWidth()
Return true if a viewport should always force the width of this Scrollable to match the width of the viewport. |
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation. |
boolean |
isInheritAlpha()
|
boolean |
isPaintBorderInsets()
Returns true if the background painter should paint where the border is or false if it should only paint inside the border. |
void |
paint(Graphics g)
Overriden paint method to take into account the alpha setting |
protected void |
paintComponent(Graphics g)
Overridden to provide Painter support. |
void |
setAlpha(float alpha)
Set the alpha transparency level for this component. |
void |
setBackground(Color bg)
Sets the background color for this component by |
void |
setBackgroundPainter(Painter p)
Sets a Painter to use to paint the background of this JXPanel. |
void |
setInheritAlpha(boolean val)
|
void |
setPaintBorderInsets(boolean paintBorderInsets)
Sets the paintBorderInsets property. |
void |
setScrollableTracksViewportHeight(boolean scrollableTracksViewportHeight)
|
void |
setScrollableTracksViewportWidth(boolean scrollableTracksViewportWidth)
|
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JXPanel()
public JXPanel(boolean isDoubleBuffered)
isDoubleBuffered
- public JXPanel(LayoutManager layout)
layout
- public JXPanel(LayoutManager layout, boolean isDoubleBuffered)
layout
- isDoubleBuffered
- Method Detail |
---|
public void setAlpha(float alpha)
TODO add support for animated changes in translucency
alpha
- must be a value between 0 and 1 inclusive.public float getAlpha()
public float getEffectiveAlpha()
public boolean isInheritAlpha()
public void setInheritAlpha(boolean val)
public boolean getScrollableTracksViewportHeight()
javax.swing.Scrollable
Scrolling containers, like JViewport, will use this method each time they are validated.
getScrollableTracksViewportHeight
in interface Scrollable
public boolean getScrollableTracksViewportWidth()
javax.swing.Scrollable
Scrollable
to match the width of the viewport.
For example a normal
text view that supported line wrapping would return true here, since it
would be undesirable for wrapped lines to disappear beyond the right
edge of the viewport. Note that returning true for a Scrollable
whose ancestor is a JScrollPane effectively disables horizontal
scrolling.
Scrolling containers, like JViewport, will use this method each time they are validated.
getScrollableTracksViewportWidth
in interface Scrollable
public Dimension getPreferredScrollableViewportSize()
javax.swing.Scrollable
JList
component
is the size required to accommodate all of the cells in its list.
However, the value of preferredScrollableViewportSize
is the size required for JList.getVisibleRowCount
rows.
A component without any properties that would affect the viewport
size should just return getPreferredSize
here.
getPreferredScrollableViewportSize
in interface Scrollable
JViewport
whose view
is this Scrollable
JComponent.getPreferredSize()
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
javax.swing.Scrollable
Scrolling containers, like JScrollPane, will use this method each time the user requests a block scroll.
getScrollableBlockIncrement
in interface Scrollable
visibleRect
- The view area visible within the viewportorientation
- Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction
- Less than zero to scroll up/left, greater than zero for down/right.
JScrollBar.setBlockIncrement(int)
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
javax.swing.Scrollable
Scrolling containers, like JScrollPane, will use this method each time the user requests a unit scroll.
getScrollableUnitIncrement
in interface Scrollable
visibleRect
- The view area visible within the viewportorientation
- Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction
- Less than zero to scroll up/left, greater than zero for down/right.
JScrollBar.setUnitIncrement(int)
public void setScrollableTracksViewportHeight(boolean scrollableTracksViewportHeight)
scrollableTracksViewportHeight
- The scrollableTracksViewportHeight to set.public void setScrollableTracksViewportWidth(boolean scrollableTracksViewportWidth)
scrollableTracksViewportWidth
- The scrollableTracksViewportWidth to set.public void setBackground(Color bg)
setBackground
in class JComponent
bg
- the desired background Color
java.swing.JComponent#getBackground
,
JComponent.setOpaque(boolean)
public void setBackgroundPainter(Painter p)
p
- the new paintergetBackgroundPainter()
public Painter getBackgroundPainter()
setBackgroundPainter(Painter)
,
isPaintBorderInsets()
public boolean isPaintBorderInsets()
public void setPaintBorderInsets(boolean paintBorderInsets)
public void paint(Graphics g)
paint
in class JComponent
g
- JComponent.paintComponent(java.awt.Graphics)
,
JComponent.paintBorder(java.awt.Graphics)
,
JComponent.paintChildren(java.awt.Graphics)
,
JComponent.getComponentGraphics(java.awt.Graphics)
,
JComponent.repaint(long, int, int, int, int)
protected void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- the Graphics
object to protectJComponent.paint(java.awt.Graphics)
,
ComponentUI
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |