|
||||||||||
| 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
jmri.util.ResizableImagePanel
public class ResizableImagePanel
A class extending JPanels to have a image display in a panel, supports: + drag'n drop of image file + can resize container + can scale content to size + respect aspect ratio by default (when resizing content) (overrides paintComponent for performances)
| 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.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected JLabel |
bgImg
|
| 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 | |
|---|---|
ResizableImagePanel()
Default constructor. |
|
ResizableImagePanel(String imagePath)
Constructor with initial image file path as parameter. |
|
ResizableImagePanel(String imagePath,
int w,
int h)
Constructor for DnDImagePanel with forced initial size |
|
| Method Summary | |
|---|---|
void |
componentHidden(ComponentEvent e)
|
void |
componentMoved(ComponentEvent e)
|
void |
componentResized(ComponentEvent e)
|
void |
componentShown(ComponentEvent e)
|
void |
filesDropped(File[] files)
Callback for the dnd listener |
String |
getDropFolder()
|
String |
getImagePath()
Return curent image file path |
BufferedImage |
getScaledImage()
Get curent scaled Image |
boolean |
isResizingContainer()
Can this DnDImagePanel resize its container? |
boolean |
isRespectingAspectRatio()
Is this DnDImagePanel respecting aspect ratio when resizing content? |
void |
paintComponent(Graphics g)
|
void |
setBackground(Color bckCol)
|
void |
setDnd(boolean dnd)
Enable or disable drag'n drop, dropped files will be copied in latest used image path top folder when dnd enabled, also enable contextual menu with remove entry |
void |
setDropFolder(String s)
|
void |
setImagePath(String s)
Set image file path, display will be updated If passed value is null, blank image |
void |
setResizingContainer(boolean b)
Allows this DnDImagePanel to force resize of its container |
void |
setRespectAspectRatio(boolean b)
Allow this DnDImagePanel to respect aspect ratio when resizing content |
| 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 |
| Field Detail |
|---|
protected JLabel bgImg
| Constructor Detail |
|---|
public ResizableImagePanel()
public ResizableImagePanel(String imagePath)
imagePath - Path to image to display
public ResizableImagePanel(String imagePath,
int w,
int h)
imagePath - Path to image to displayw - Panel widthh - Panel height| Method Detail |
|---|
public void setBackground(Color bckCol)
setBackground in class JComponentpublic void setDnd(boolean dnd)
dnd - public void setResizingContainer(boolean b)
b - public boolean isResizingContainer()
public boolean isRespectingAspectRatio()
public void setRespectAspectRatio(boolean b)
b - public String getImagePath()
public void setImagePath(String s)
public void componentResized(ComponentEvent e)
componentResized in interface ComponentListenerpublic void componentMoved(ComponentEvent e)
componentMoved in interface ComponentListenerpublic void componentShown(ComponentEvent e)
componentShown in interface ComponentListenerpublic void componentHidden(ComponentEvent e)
componentHidden in interface ComponentListenerpublic void paintComponent(Graphics g)
paintComponent in class JComponentpublic BufferedImage getScaledImage()
public void setDropFolder(String s)
public String getDropFolder()
public void filesDropped(File[] files)
filesDropped in interface FileDrop.Listenerfiles - An array of Files that were dropped.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||