|
Groovy Documentation | |||||||
| 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
griffon.coverflow.ui.GradientPanel
com.blogofbug.swing.components.JCarosel
public class JCarosel extends GradientPanel
A carousel component which lays out components around a carousel, moving each to the front as it is clicked on. Double clicking will fire the action associated with the compnent if it has one, or give it the focus if it does not. Note this will be changed to only allow RichComponents in the future.
| Field Summary | |
|---|---|
protected int |
DEFAULT_CONTENT_WIDTH
The prefered width of the components in the container, everything will be scaled to this width for neutral scaling (1.0) |
static String |
FRONT_COMPONENT_CHANGE
The property that is set when a new component comes to the front. |
private static boolean |
MEASURE_PERFORMANCE
Set to true if the performance should be measured. |
protected Component |
lastWheeledTo
The last component the wheel selected. |
protected CaroselLayout |
layout
The layout being used for the carousel |
protected int |
spinStartDelay
Delay in milliseconds from the first click to the start of the spin, this gives implementors using a double click anywhere to fire an event a chance for their users to get the double click message before the component spins around. |
| Fields inherited from class GradientPanel | |
|---|---|
| GRADIENT_END, GRADIENT_START, gradientEnd, gradientImage, gradientStart |
| Fields inherited from class JPanel | |
|---|---|
| WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT |
| Constructor Summary | |
JCarosel()
Creates a new instance of JCarosel |
|
JCarosel(int contentWidth)
Creates a new Carousel specifying the prefered width up front |
|
| Method Summary | |
|---|---|
Component
|
add(Component component)
Adds a component to the carousel |
Component
|
add(Image image, String text)
Adds an image to the carousel |
Component
|
add(String imageURL, int width, int height)
The image to add and it's width and height |
Component
|
add(String imageURL, String text, int width, int height)
Add the image, and it's label to the carousel |
Component
|
add(String imageURL)
Adds a new image to the carousel |
Component
|
add(String imageURL, String textLabel)
Adds a new image to the carousel |
void
|
bringToFront(Component component)
Brings the specified component to the front of the carousel |
void
|
finalizeLayoutImmediately()
Moves everything to their final positions |
Component
|
getFrontmost()
Which component is at the front |
int
|
getSpinStartDelay()
Returns the spin start delay |
Component
|
insertAt(int i, String imageURL, int width, int height)
Inserts a new object at a specific location |
Component
|
insertAt(int i, String imageURL, String text, int width, int height)
Inserts a new object at a specific location |
void
|
insertComponentAt(int i, Component comp)
Inserts a component at the specified index |
void
|
mouseClicked(MouseEvent mouseEvent)
Bring the "clicked" component to the front. |
void
|
mouseEntered(MouseEvent mouseEvent)
Not interested |
void
|
mouseExited(MouseEvent mouseEvent)
Not interested |
void
|
mousePressed(MouseEvent mouseEvent)
Not interested |
void
|
mouseReleased(MouseEvent mouseEvent)
Not interested |
void
|
mouseWheelMoved(MouseWheelEvent mouseWheelEvent)
When event received will spin the carousel to select the next object. |
void
|
remove(Component component)
Removes the component from the carousel |
void
|
setContentWidth(int contentWidth)
Sets the prefered width of the components inside the carousel, this is the neutral width that will change as the component is scaled, but at 9 and 6 o'clock where the scale is one they will be this width. |
void
|
setDepthBasedAlpha(boolean useDepthBased)
If set to true the carousel will fade out components as they move away from the front of the carousel (6 o'clock) |
void
|
setLayout(CaroselLayout layout)
Specifies which type of CarouselLayout to be used to lay the component out around the carousel Any looping layout can be used. |
void
|
setSpinStartDelay(int spinStartDelay)
Sets the delay between clicking on a component in the carousel, and the spin starting to move that component to the front. |
| Methods inherited from class GradientPanel | |
|---|---|
| createImageCache, disposeImageCache, getGradientEnd, getGradientStart, paintComponent, setGradientEnd, setGradientStart |
| Field Detail |
|---|
protected int DEFAULT_CONTENT_WIDTH
public static final String FRONT_COMPONENT_CHANGE
private static final boolean MEASURE_PERFORMANCE
protected Component lastWheeledTo
protected CaroselLayout layout
protected int spinStartDelay
| Constructor Detail |
|---|
public JCarosel()
public JCarosel(int contentWidth)
contentWidth
- The prefered width of component at neutral scale (3 or 9
o'clock)
| Method Detail |
|---|
public Component add(Component component)
component
- The component to add to the carousel
public Component add(Image image, String text)
image
- The image to addtext
- The text label
public Component add(String imageURL, int width, int height)
imageURL
- The URLwidth
- The desired rendering widthheight
- The desired rendering height
public Component add(String imageURL, String text, int width, int height)
imageURL
- The image URLtext
- The text labelwidth
- The widthheight
- The height
public Component add(String imageURL)
imageURL
- The image
public Component add(String imageURL, String textLabel)
imageURL
- The imagetextLabel
- The label
public void bringToFront(Component component)
component
- The component to bring to the front
public void finalizeLayoutImmediately()
public Component getFrontmost()
public int getSpinStartDelay()
public Component insertAt(int i, String imageURL, int width, int height)
i
- The position on the carouselimageURL
- The URL of the imagewidth
- The width of the imageheight
- The height of the image
public Component insertAt(int i, String imageURL, String text, int width, int height)
i
- The position on the carouselimageURL
- The URL of the imagetext
- The text labelwidth
- The prefered width of the imageheight
- The prefered height of the image
public void insertComponentAt(int i, Component comp)
i
- The indexcomp
- The component
public void mouseClicked(MouseEvent mouseEvent)
mouseEvent
- Brings the component clicked on by the mouse to the front
public void mouseEntered(MouseEvent mouseEvent)
mouseEvent
- Ignored
public void mouseExited(MouseEvent mouseEvent)
mouseEvent
- Ignored
public void mousePressed(MouseEvent mouseEvent)
mouseEvent
- Ignored
public void mouseReleased(MouseEvent mouseEvent)
mouseEvent
- Ignored
public void mouseWheelMoved(MouseWheelEvent mouseWheelEvent)
mouseWheelEvent
- The event object
public void remove(Component component)
component
- The component to remove
public void setContentWidth(int contentWidth)
contentWidth
- The prefered width.
public void setDepthBasedAlpha(boolean useDepthBased)
useDepthBased
- True to fade components as they move to the back, false to not
do it
public void setLayout(CaroselLayout layout)
layout
- The carousel layout to use
public void setSpinStartDelay(int spinStartDelay)
Groovy Documentation