public class GUIHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
EMPTY_ICON
the empty icon name.
|
| Constructor and Description |
|---|
GUIHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeParent(Container cont)
Closes the parent dialog/frame of this container.
|
static ImageIcon |
getEmptyIcon()
Returns the ImageIcon for the empty icon.
|
static ImageIcon |
getExternalIcon(String filename)
Returns an ImageIcon from the given name.
|
static ImageIcon |
getIcon(Class cls)
Returns an ImageIcon for the given class.
|
static ImageIcon |
getIcon(String name)
Returns an ImageIcon from the given name.
|
static String |
getImageFilename(String name)
Adds the path of the images directory to the name of the image.
|
static Object |
getParent(Container cont,
Class parentClass)
Tries to determine the parent this panel is part of.
|
static Component |
getParentComponent(Component comp)
Tries to determine the component this panel is part of in this order:
1.
|
static Dialog |
getParentDialog(Component comp)
Tries to determine the dialog this component is part of.
|
static Dialog |
getParentDialog(Container cont)
Tries to determine the dialog this container is part of.
|
static Frame |
getParentFrame(Component comp)
Tries to determine the frame the component is part of.
|
static Frame |
getParentFrame(Container cont)
Tries to determine the frame the container is part of.
|
static JInternalFrame |
getParentInternalFrame(Component comp)
Tries to determine the internal frame this component is part of.
|
static JInternalFrame |
getParentInternalFrame(Container cont)
Tries to determine the internal frame this container is part of.
|
static boolean |
hasImageFile(String name)
Checks whether the image is available.
|
public static final String EMPTY_ICON
public static boolean hasImageFile(String name)
name - the name of the image (filename without path but with
extension)public static String getImageFilename(String name)
name - the name of the image to add the path topublic static ImageIcon getIcon(Class cls)
cls - the class to get the icon for (gif, png or jpg)public static ImageIcon getIcon(String name)
name - the filename without pathpublic static ImageIcon getExternalIcon(String filename)
filename - the filenamepublic static ImageIcon getEmptyIcon()
public static Object getParent(Container cont, Class parentClass)
cont - the container to get the parent forparentClass - the class of the parent to obtainpublic static Frame getParentFrame(Container cont)
cont - the container to get the frame forpublic static Frame getParentFrame(Component comp)
comp - the component to get the frame forpublic static Dialog getParentDialog(Container cont)
cont - the container to get the dialog forpublic static Dialog getParentDialog(Component comp)
comp - the component to get the dialog forpublic static JInternalFrame getParentInternalFrame(Container cont)
cont - the container to start withpublic static JInternalFrame getParentInternalFrame(Component comp)
comp - the component to start withpublic static Component getParentComponent(Component comp)
comp - the component to get the parent component for, must
be a container actuallygetParentDialog(Container),
getParentFrame(Container)public static void closeParent(Container cont)
cont - the container to close the parent forCopyright © 2022. All rights reserved.