Package net.simplace.core.service
Klasse ComponentHelper
java.lang.Object
net.simplace.core.service.ComponentHelper
Helper for GUI components.
- Autor:
- Andreas Enders
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic voidcenterWindow(Window aWindow) Centers the given window relative to its parent.static ColorcombineColors(Color aColor1, Color aColor2) Combines two different colors.static ImageIconcombineIcons(ImageIcon aIcon, int aIconX, int aIconY, ImageIcon aCoIcon, int aCoIconX, int aCoIconY) Combines the given icons.static ImageIconcombineIcons(ImageIcon aIcon, int aIconX, int aIconY, ImageIcon aCoIcon, int aCoIconX, int aCoIconY, boolean aFadeIcon) Combines the given icons.static ColorcreateColor(String aColorString) Creates an RGB-Color from the given CSV-String e.g. "127,0,0"static ImageIconfadeIconColors(ImageIcon aImageIcon) Brightens the given imagestatic JTextAreafindFirstJTextArea(JComponent aComponent) Returns the first descendant component of type JTextArea.static voidfitColumnWidth(JTable aTable, int aMaxWidth, boolean aResizable) Fits all columns in the table to perfect size.static intfitColumnWidth(JTable aTable, int aColumnIndex, int aMaxWidth, boolean aResizable) Fits the column to perfect size.static intfitColumnWidth(JTable aTable, int aColumnIndex, int aMinWidth, int aMaxWidth, boolean aResizable) Fits the column to perfect size.static TableColumnReturns the column at the given model-column.static ComponentgetComponentByBounds(Container aParent, int aX, int aY) Returns the component given by the bounds.static booleanisAnchestor(Component aComponent, Component aAnchestorComponent) Returns true if the first component is an anchestor of the second component.static booleanisToolkitTrueColor(Component aComponent) Checks if color depth is at least 24 bit.static voidsetDefaultWindowBounds(Window aWindow) Sets the default size and location of the given window.static voidsetHeight(JComponent aComponent, int aHeight) Sets the preferred height to a component.static ColortransformColor(Color aColor, double aRelativeChangeValue) Returns a brighter/darker color based on relative RGB transformation.static ColortransformColor(Color aColor, int aAbsoluteChangeValue) Returns a brighter/darker color based on absolute RGB transformation.
-
Methodendetails
-
isAnchestor
Returns true if the first component is an anchestor of the second component.- Parameter:
aComponent-aAnchestorComponent-- Gibt zurück:
- success
-
findFirstJTextArea
Returns the first descendant component of type JTextArea.- Parameter:
aComponent-- Gibt zurück:
- the first descendant component of type JTextArea
-
getColumn
Returns the column at the given model-column. This will ignore the actual position of the column.- Parameter:
aTable-aModelIndex-- Gibt zurück:
- the column at the given model-column
-
fitColumnWidth
Fits all columns in the table to perfect size.- Parameter:
aTable-aMaxWidth-aResizable-
-
fitColumnWidth
public static int fitColumnWidth(JTable aTable, int aColumnIndex, int aMaxWidth, boolean aResizable) Fits the column to perfect size.- Parameter:
aTable-aColumnIndex-aMaxWidth-aResizable-- Gibt zurück:
- column width
-
fitColumnWidth
public static int fitColumnWidth(JTable aTable, int aColumnIndex, int aMinWidth, int aMaxWidth, boolean aResizable) Fits the column to perfect size.- Parameter:
aTable-aColumnIndex-aMinWidth-aMaxWidth-aResizable-- Gibt zurück:
- column width
-
transformColor
Returns a brighter/darker color based on absolute RGB transformation.- Parameter:
aColor-aAbsoluteChangeValue-- Gibt zurück:
- a brighter/darker color based on absolute RGB transformation
-
transformColor
Returns a brighter/darker color based on relative RGB transformation. value Ungültige Eingabe: "<" 1.0 -> darker value = 1.0 -> same value > 1.0 -> brighter- Parameter:
aColor-aRelativeChangeValue-- Gibt zurück:
- a brighter/darker color based on relative RGB transformation
-
isToolkitTrueColor
Checks if color depth is at least 24 bit.- Parameter:
aComponent-- Gibt zurück:
- true, if color depth is at least 24 bit
-
setDefaultWindowBounds
Sets the default size and location of the given window.- Parameter:
aWindow-
-
getComponentByBounds
Returns the component given by the bounds.- Parameter:
aParent-aX-aY-- Gibt zurück:
- the component given by the bounds
-
centerWindow
Centers the given window relative to its parent. If no parent is available, the window is centered on the screen.- Parameter:
aWindow-
-
combineIcons
public static ImageIcon combineIcons(ImageIcon aIcon, int aIconX, int aIconY, ImageIcon aCoIcon, int aCoIconX, int aCoIconY) Combines the given icons.- Parameter:
aIcon-aIconX-aIconY-aCoIcon-aCoIconX-aCoIconY-- Gibt zurück:
- combined ImageIcon
-
combineIcons
public static ImageIcon combineIcons(ImageIcon aIcon, int aIconX, int aIconY, ImageIcon aCoIcon, int aCoIconX, int aCoIconY, boolean aFadeIcon) Combines the given icons.- Parameter:
aIcon-aIconX-aIconY-aCoIcon-aCoIconX-aCoIconY-aFadeIcon-- Gibt zurück:
- combined ImageIcon
-
combineColors
Combines two different colors.- Parameter:
aColor1-aColor2-- Gibt zurück:
- combined Color
-
createColor
Creates an RGB-Color from the given CSV-String e.g. "127,0,0"- Parameter:
aColorString-- Gibt zurück:
- an RGB-Color
-
setHeight
Sets the preferred height to a component.- Parameter:
aComponent-aHeight-
-
fadeIconColors
Brightens the given image- Parameter:
aImageIcon-- Gibt zurück:
- brightened ImageIcon
-