|
swingx Version 2009-07-31 |
|||||||||
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
An extended JPanel
that provides additional features. First, the
component is Scrollable
, using reasonable defaults. Second, the
component is alpha-channel enabled. This means that the JXPanel
can
be made fully or partially transparent. Finally, JXPanel
has support
for painters.
A transparency example, this following code will show the black background of the parent:
JXPanel panel = new JXPanel(); panel.add(new JButton("Push Me")); panel.setAlpha(.5f); container.setBackground(Color.BLACK); container.add(panel);
A painter example, this following code will show how to add a simple painter:
JXPanel panel = new JXPanel(); panel.setBackgroundPainter(new PinstripePainter());
Scrollable
,
Painter
,
Serialized FormNested 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.BaselineResizeBehavior, 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 JXPanel with a double buffer
and a flow layout. |
|
JXPanel(boolean isDoubleBuffered)
Creates a new JXPanel with FlowLayout
and the specified buffering strategy. |
|
JXPanel(LayoutManager layout)
Create a new buffered JXPanel with the specified layout manager |
|
JXPanel(LayoutManager layout,
boolean isDoubleBuffered)
Creates a new JXPanel with the specified layout manager and buffering strategy. |
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()
|
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
boolean |
isInheritAlpha()
Returns the state of the panel with respect to inheriting alpha values. |
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)
Determines if the effective alpha of this component should include the alpha of ancestors. |
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()
JXPanel
with a double buffer
and a flow layout.
public JXPanel(boolean isDoubleBuffered)
JXPanel
with FlowLayout
and the specified buffering strategy.
If isDoubleBuffered
is true, the JXPanel
will use a double buffer.
isDoubleBuffered
- a boolean, true for double-buffering, which
uses additional memory space to achieve fast, flicker-free
updatespublic JXPanel(LayoutManager layout)
layout
- the LayoutManager to usepublic JXPanel(LayoutManager layout, boolean isDoubleBuffered)
layout
- the LayoutManager to useisDoubleBuffered
- a boolean, true for double-buffering, which
uses additional memory space to achieve fast, flicker-free
updatesMethod 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()
true
if this panel inherits alpha values; false
otherwisesetInheritAlpha(boolean)
public void setInheritAlpha(boolean val)
val
- true
to include ancestral alpha data; false
otherwiseisInheritAlpha()
,
getEffectiveAlpha()
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface Scrollable
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface Scrollable
public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface Scrollable
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface Scrollable
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
- protected void paintComponent(Graphics g)
paintComponent
in class JComponent
|
swingx Version 2009-07-31 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |