net.simplace.core.service.ComponentHelper
Helper for GUI components.
public final class ComponentHelper {
// Class Methods public static boolean
isAnchestor(Component aComponent, Component
aAnchestorComponent);
Returns true if the first component is an anchestor of the second component.
- aComponent
- aAnchestorComponent
returns success
public static JTextArea
findFirstJTextArea(JComponent aComponent);
Returns the first descendant component of type JTextArea.
returns the first descendant component of type JTextArea
public static TableColumn
getColumn(JTable aTable, int aModelIndex);
Returns the column at the given model-column. This will ignore the actual position of
the column.
returns the column at the given model-column
public static void
fitColumnWidth(JTable aTable, int aMaxWidth, boolean
aResizable);
Fits all columns in the table to perfect size.
- aTable
- aMaxWidth
- aResizable
public static int
fitColumnWidth(JTable aTable, int aColumnIndex, int
aMaxWidth, boolean aResizable);
Fits the column to perfect size.
- aTable
- aColumnIndex
- aMaxWidth
- aResizable
returns column width
public static int
fitColumnWidth(JTable aTable, int aColumnIndex, int
aMinWidth, int aMaxWidth, boolean aResizable);
Fits the column to perfect size.
- aTable
- aColumnIndex
- aMinWidth
- aMaxWidth
- aResizable
returns column width
public static Color
transformColor(Color aColor, int aAbsoluteChangeValue);
Returns a brighter/darker color based on absolute RGB transformation.
- aColor
- aAbsoluteChangeValue
returns a brighter/darker color based on absolute RGB transformation
public static Color
transformColor(Color aColor, double aRelativeChangeValue);
Returns a brighter/darker color based on relative RGB transformation.
value < 1.0 -> darker
value = 1.0 -> same
value > 1.0 -> brighter
- aColor
- aRelativeChangeValue
returns a brighter/darker color based on relative RGB transformation
public static boolean
isToolkitTrueColor(Component aComponent);
Checks if color depth is at least 24 bit.
returns true, if color depth is at least 24 bit
public static void
setDefaultWindowBounds(Window aWindow);
Sets the default size and location of the given window.
public static Component
getComponentByBounds(Container aParent, int aX, int
aY);
Returns the component given by the bounds.
returns the component given by the bounds
public static void
centerWindow(Window aWindow);
Centers the given window relative to its parent.
If no parent is available, the window is centered on the screen.
public static ImageIcon
combineIcons(ImageIcon aIcon, int aIconX, int aIconY,
ImageIcon aCoIcon, int aCoIconX, int aCoIconY);
Combines the given icons.
- aIcon
- aIconX
- aIconY
- aCoIcon
- aCoIconX
- aCoIconY
returns combined ImageIcon
public static ImageIcon
combineIcons(ImageIcon aIcon, int aIconX, int aIconY,
ImageIcon aCoIcon, int aCoIconX, int aCoIconY, boolean aFadeIcon);
Combines the given icons.
- aIcon
- aIconX
- aIconY
- aCoIcon
- aCoIconX
- aCoIconY
- aFadeIcon
returns combined ImageIcon
public static File
getRealFile(File aFile);
Returns the file itself or the link-file if it's a file.
returns the file itself or the link-file if it's a file
public static Color
combineColors(Color aColor1, Color aColor2);
Combines two different colors.
returns combined Color
public static Color
createColor(String aColorString);
Creates an RGB-Color from the given CSV-String e.g. "127,0,0"
returns an RGB-Color
public static void
setHeight(JComponent aComponent, int aHeight);
Sets the preferred height to a component.
public static ImageIcon
fadeIconColors(ImageIcon aImageIcon);
Brightens the given image
returns brightened ImageIcon
}