public class GUIHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
EMPTY_ICON
the empty icon name.
|
static String |
FILENAME
the name of the props file.
|
static String |
IMAGE_DIR
the directory with the images.
|
protected static Properties |
m_Properties
the properties.
|
static char |
MNEMONIC_INDICATOR
the mnemonic character indicator.
|
Constructor and Description |
---|
GUIHelper() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canPasteFromClipboard(DataFlavor flavor)
Checks whether the specified "flavor" can be obtained from the clipboard.
|
static boolean |
canPasteStringFromClipboard()
Checks whether a string can be obtained from the clipboard.
|
static void |
copyToClipboard(BufferedImage img)
Copies the given image to the system's clipboard.
|
static void |
copyToClipboard(String s)
Copies the given string to the system's clipboard.
|
static void |
copyToClipboard(Transferable t)
Copies the given transferable to the system's clipboard.
|
static Dimension |
getDefaultDimensions(String prefix,
int defaultWidth,
int defaultHeight)
Returns the default dimensions for this prefix.
|
static Dimension |
getDefaultFrameDimensions()
Returns the default frame dimensions.
|
static Dimension |
getDefaultFrameDimensions(Class cls)
Returns the default frame dimensions for this class.
|
static String |
getDefaultFrameIcon(Class cls)
Returns the default icon name for this frame class.
|
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 ImageIcon |
getLogoIcon()
Returns an ImageIcon of the logo (icon sized image).
|
static ImageIcon |
getLogoImage()
Returns an ImageIcon of the logo (large image).
|
static char |
getMnemonic(String caption)
Returns the mnemonic for this caption, preceded by an underscore "_".
|
static Font |
getMonospacedFont()
Returns the system wide Monospaced font.
|
static boolean |
getPackFrame(Class cls)
Returns whether this application needs to be packed, rather than use a specific window size.
|
static Object |
getParent(Container cont,
Class parentClass)
Tries to determine the parent this panel is part of.
|
static Dialog |
getParentDialog(Container cont)
Tries to determine the dialog this panel is part of.
|
static Frame |
getParentFrame(Container cont)
Tries to determine the frame the container is part of.
|
static Properties |
getProperties()
Initializes the properties if necessary.
|
static boolean |
hasImageFile(String name)
Checks whether the image is available.
|
static boolean |
hasMnemonic(String caption)
Checks the caption whether an underscore "_" is present to indicate
that the following character is to act as mnemonic.
|
static weka.gui.ConverterFileChooser |
newConverterFileChooser()
Returns a new instance of a filechooser for datasets including the bookmarks panel.
|
static MekaFileChooser |
newFileChooser()
Returns a new instance of a filechooser including the bookmarks panel.
|
static Object |
pasteFromClipboard(DataFlavor flavor)
Obtains an object from the clipboard.
|
static String |
pasteStringFromClipboard()
Obtains a string from the clipboard.
|
static String |
stripMnemonic(String caption)
Removes the mnemonic indicator in this caption.
|
public static final String FILENAME
public static final String IMAGE_DIR
public static final String EMPTY_ICON
public static final char MNEMONIC_INDICATOR
protected static Properties m_Properties
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 ImageIcon getLogoImage()
public static ImageIcon getLogoIcon()
public static Font getMonospacedFont()
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 Dialog getParentDialog(Container cont)
cont
- the container to get the dialog forpublic static boolean hasMnemonic(String caption)
caption
- the caption to analyzeMNEMONIC_INDICATOR
public static char getMnemonic(String caption)
caption
- the caption to extractMNEMONIC_INDICATOR
public static String stripMnemonic(String caption)
caption
- the caption to processMNEMONIC_INDICATOR
public static Properties getProperties()
public static void copyToClipboard(Transferable t)
t
- the transferable to copypublic static void copyToClipboard(String s)
s
- the string to copypublic static void copyToClipboard(BufferedImage img)
img
- the image to copypublic static boolean canPasteFromClipboard(DataFlavor flavor)
flavor
- the type of data to look forpublic static boolean canPasteStringFromClipboard()
public static Object pasteFromClipboard(DataFlavor flavor)
flavor
- the type of object to obtainpublic static String pasteStringFromClipboard()
public static Dimension getDefaultFrameDimensions()
public static Dimension getDefaultFrameDimensions(Class cls)
cls
- the class to get the default dimensions forgetDefaultFrameDimensions()
public static String getDefaultFrameIcon(Class cls)
cls
- the class to get the default icon name forpublic static Dimension getDefaultDimensions(String prefix, int defaultWidth, int defaultHeight)
prefix
- the prefix (+ .Height, .Width) to get the dimensions fordefaultWidth
- the default widthdefaultHeight
- the default heightpublic static boolean getPackFrame(Class cls)
public static weka.gui.ConverterFileChooser newConverterFileChooser()
public static MekaFileChooser newFileChooser()
Copyright © 2017. All Rights Reserved.