public class UiUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static javax.swing.border.Border |
DIALOG_BORDER
The border to use for dialogs.
|
static java.awt.Insets |
ZERO_INSETS |
Constructor and Description |
---|
UiUtilities() |
Modifier and Type | Method and Description |
---|---|
static void |
addSeparatorsAfterIndexes(javax.swing.JComboBox combo,
int[] indexes) |
static void |
addSeparatorsAfterIndexes(javax.swing.JComboBox combo,
java.lang.Integer[] indexes) |
static void |
centerAndShow(java.awt.Window win)
Centers a window to its parent frame and shows it.
|
static boolean |
colorsInEqualRange(java.awt.Color c1,
java.awt.Color c2,
int maxDiff)
Tests if the given colors are equal in the given maximum difference.
|
static boolean |
containsModalDialogChild(java.awt.Window parent)
Gets if a dialog child of the given window is modal.
|
static javax.swing.ImageIcon |
createChannelIcon(javax.swing.Icon ic)
Creates a scaled Version of the Icon.
|
static javax.swing.JDialog |
createDialog(java.awt.Component parent,
boolean modal) |
static javax.swing.JTextArea |
createHelpTextArea(java.lang.String msg)
Creates a text area that holds a help text.
|
static javax.swing.JEditorPane |
createHtmlHelpTextArea(java.lang.String html)
Creates a Html EditorPane that holds a HTML-Help Text
Links will be displayed and are clickable
|
static javax.swing.JEditorPane |
createHtmlHelpTextArea(java.lang.String html,
java.awt.Color background)
Creates a Html EditorPane that holds a HTML-Help Text
Links will be displayed and are clickable
|
static javax.swing.JEditorPane |
createHtmlHelpTextArea(java.lang.String html,
java.awt.Color foreground,
java.awt.Color background)
Creates a Html EditorPane that holds a HTML-Help Text
Links will be displayed and are clickable
|
static javax.swing.JEditorPane |
createHtmlHelpTextArea(java.lang.String html,
javax.swing.event.HyperlinkListener listener)
Creates a Html EditorPane that holds a HTML-Help Text.
|
static javax.swing.JEditorPane |
createHtmlHelpTextArea(java.lang.String html,
javax.swing.event.HyperlinkListener listener,
java.awt.Color background)
Creates a Html EditorPane that holds a HTML-Help Text.
|
static javax.swing.JEditorPane |
createHtmlHelpTextArea(java.lang.String html,
javax.swing.event.HyperlinkListener listener,
java.awt.Color foreground,
java.awt.Color background)
Creates a Html EditorPane that holds a HTML-Help Text.
|
static javax.swing.JFileChooser |
createNewFileChooser(javax.swing.filechooser.FileFilter fileFilter)
creates a new file chooser.
|
static javax.swing.JPanel |
createPersonaBackgroundPanel()
Creates a panel that has a semi-transparent background
created of Persona colors.
|
static javax.swing.JButton |
createToolBarButton(java.lang.String text,
javax.swing.Icon icon)
Gibt einen Button mit Icon und Schrift zur�ck, der so initialisiert ist,
da� man ihn gut f�r Symbolleisten nutzen kann (Rahmen nur bei Rollover
sichtbar usw.).
|
static java.awt.Window |
getBestDialogParent(java.awt.Component parent)
Gets the best dialog parent for a new JDialog.
|
static int |
getChannelIconHeight() |
static int |
getChannelIconWidth() |
static int |
getCharsWidth(java.awt.Font font,
char[] chars,
int offset,
int length)
Gets the width of the specified char array.
|
static java.lang.String |
getDefaultLookAndFeelClassName(boolean excludeGTK) |
static java.lang.String |
getHTMLColorCode(java.awt.Color color)
returns a color code as used in HTML, e.g.
|
static java.awt.Window |
getLastModalChildOf(java.awt.Window parent)
Gets the last visible modal child dialog of the specified window.
|
static int |
getStringWidth(java.awt.Font font,
java.lang.String str)
Gets the width of the specified String.
|
static boolean |
isGTKLookAndFeel() |
static boolean |
isNimbusLookAndFeel() |
static void |
moveSelectedItems(javax.swing.JList list,
int nrRows)
Move selected Items in the JList
|
static void |
moveSelectedItems(javax.swing.JList list,
int row,
boolean sort)
Move selected Items in the JList
|
static java.lang.Object[] |
moveSelectedItems(javax.swing.JList fromList,
javax.swing.JList toList)
Moves Selected Items from one List to another
|
static java.lang.Object[] |
moveSelectedItems(javax.swing.JList fromList,
javax.swing.JList toList,
java.lang.Class... typeRemoveOnly)
Moves Selected Items from one List to another
|
static java.lang.Object[] |
moveSelectedItems(javax.swing.JList fromList,
javax.swing.JList toList,
int row)
Moves Selected Items from one List to another
|
static void |
registerForClosing(WindowClosingIf component)
Registers the escape key as close key for a component.
|
static javax.swing.Icon |
scaleIcon(javax.swing.Icon icon,
int newWidth)
Scale Icons to a specific width.
|
static javax.swing.Icon |
scaleIcon(javax.swing.Icon icon,
int width,
int height)
Scales Icons to a specific size
|
static java.awt.image.BufferedImage |
scaleIconToBufferedImage(java.awt.image.BufferedImage img,
int width,
int height)
Scales an image to a specific size and returns an BufferedImage
|
static java.awt.image.BufferedImage |
scaleIconToBufferedImage(java.awt.image.BufferedImage img,
int width,
int height,
int type)
Scales an image to a specific size and returns an BufferedImage
|
static java.awt.image.BufferedImage |
scaleIconToBufferedImage(java.awt.image.BufferedImage img,
int targetWidth,
int targetHeight,
int type,
java.awt.Color backgroundColor)
Scales an image to a specific size and returns an BufferedImage
|
static void |
setSize(javax.swing.JDialog dialog,
int width,
int height)
set the size of a dialog, but never sizes it smaller than the preferred
size
|
static void |
updateHtmlHelpTextArea(javax.swing.JEditorPane helpTextArea,
java.lang.String description) |
static void |
updateHtmlHelpTextArea(javax.swing.JEditorPane helpTextArea,
java.lang.String html,
java.awt.Color background) |
static void |
updateHtmlHelpTextArea(javax.swing.JEditorPane helpTextArea,
java.lang.String html,
java.awt.Color foreground,
java.awt.Color background) |
public static final javax.swing.border.Border DIALOG_BORDER
public static final java.awt.Insets ZERO_INSETS
public static void centerAndShow(java.awt.Window win)
If the window has no parent frame it will be centered to the screen.
win
- The window to center and show.public static javax.swing.JDialog createDialog(java.awt.Component parent, boolean modal)
parent
- A component in the component tree where the dialog should be
created for.modal
- Should the new dialog be modal?public static java.awt.Window getBestDialogParent(java.awt.Component parent)
If there is no visible modal dialog the root frame will be returned.
parent
- One component of the component tree.public static java.awt.Window getLastModalChildOf(java.awt.Window parent)
If there is no visible modal child the window itself will be returned.
parent
- The window to get the child from.public static boolean containsModalDialogChild(java.awt.Window parent)
parent
- The window to check the children of.True
if a child is modal, false
otherwise.public static javax.swing.JButton createToolBarButton(java.lang.String text, javax.swing.Icon icon)
Wenn text und iconDateiname angegeben sind, dann wird text als TooltipText gesetzt.
text
- Der Text des Buttons (Kann null sein, wenn der Button keinen Text
enthalten soll)icon
- Das Icon des Buttons (Kann ebenfalls null sein, wenn der Button
kein Icon enthalten soll).public static int getStringWidth(java.awt.Font font, java.lang.String str)
str
- The String to get the width for.font
- The font being the base of the measure.public static int getCharsWidth(java.awt.Font font, char[] chars, int offset, int length)
chars
- The char array to get the width for.offset
- The offset where to start.length
- The length of the measure.font
- The font being the base of the measure.public static javax.swing.JTextArea createHelpTextArea(java.lang.String msg)
msg
- The help text.public static javax.swing.JEditorPane createHtmlHelpTextArea(java.lang.String html)
html
- HTML-Text to displaypublic static javax.swing.JEditorPane createHtmlHelpTextArea(java.lang.String html, java.awt.Color background)
html
- HTML-Text to displaybackground
- The color for the background.public static javax.swing.JEditorPane createHtmlHelpTextArea(java.lang.String html, java.awt.Color foreground, java.awt.Color background)
html
- HTML-Text to displayforeground
- The color of the text.background
- The color for the background.public static javax.swing.JEditorPane createHtmlHelpTextArea(java.lang.String html, javax.swing.event.HyperlinkListener listener)
html
- HTML-Text to displaylistener
- Link-Listener for this HelpTextpublic static javax.swing.JEditorPane createHtmlHelpTextArea(java.lang.String html, javax.swing.event.HyperlinkListener listener, java.awt.Color background)
html
- HTML-Text to displaylistener
- Link-Listener for this HelpTextbackground
- The color for the background.public static javax.swing.JEditorPane createHtmlHelpTextArea(java.lang.String html, javax.swing.event.HyperlinkListener listener, java.awt.Color foreground, java.awt.Color background)
html
- HTML-Text to displaylistener
- Link-Listener for this HelpTextforeground
- The color of the text.background
- The color for the background.public static void updateHtmlHelpTextArea(javax.swing.JEditorPane helpTextArea, java.lang.String html, java.awt.Color foreground, java.awt.Color background)
helpTextArea
- The editor pane to update.html
- The text for the editor pane.foreground
- The foreground color.background
- The background color.public static void updateHtmlHelpTextArea(javax.swing.JEditorPane helpTextArea, java.lang.String html, java.awt.Color background)
helpTextArea
- html
- background
- public static void updateHtmlHelpTextArea(javax.swing.JEditorPane helpTextArea, java.lang.String description)
public static java.lang.String getHTMLColorCode(java.awt.Color color)
color
- public static java.lang.Object[] moveSelectedItems(javax.swing.JList fromList, javax.swing.JList toList)
fromList
- Move from this ListtoList
- Move into this Listpublic static java.lang.Object[] moveSelectedItems(javax.swing.JList fromList, javax.swing.JList toList, java.lang.Class... typeRemoveOnly)
fromList
- Move from this ListtoList
- Move into this Listpublic static java.lang.Object[] moveSelectedItems(javax.swing.JList fromList, javax.swing.JList toList, int row)
fromList
- Move from this ListtoList
- Move into this Listrow
- The target row where to insertpublic static void moveSelectedItems(javax.swing.JList list, int row, boolean sort)
list
- Move Items in this Listrow
- The target row where to insertsort
- Dummy parameter, does nothingpublic static void moveSelectedItems(javax.swing.JList list, int nrRows)
list
- Move Items in this ListnrRows
- Move Items nrRows up/downpublic static javax.swing.Icon scaleIcon(javax.swing.Icon icon, int newWidth)
icon
- The icon to scale.newWidth
- The new width of the icon.public static javax.swing.Icon scaleIcon(javax.swing.Icon icon, int width, int height)
icon
- Icon that should be scaledwidth
- scaled widthheight
- scaled heightpublic static java.awt.image.BufferedImage scaleIconToBufferedImage(java.awt.image.BufferedImage img, int width, int height)
img
- Scale this IMagewidth
- new widthheight
- new heightpublic static java.awt.image.BufferedImage scaleIconToBufferedImage(java.awt.image.BufferedImage img, int width, int height, int type)
img
- Scale this imagewidth
- new widthheight
- new heighttype
- The type of the image.public static java.awt.image.BufferedImage scaleIconToBufferedImage(java.awt.image.BufferedImage img, int targetWidth, int targetHeight, int type, java.awt.Color backgroundColor)
img
- Scale this imagetargetWidth
- new widthtargetHeight
- new heighttype
- The type of the image.public static javax.swing.ImageIcon createChannelIcon(javax.swing.Icon ic)
ic
- public static int getChannelIconHeight()
public static int getChannelIconWidth()
public static void registerForClosing(WindowClosingIf component)
component
- The component to close on pressing escape key.public static void setSize(javax.swing.JDialog dialog, int width, int height)
dialog
- dialog to be sizedwidth
- wanted widthheight
- wanted heightpublic static void addSeparatorsAfterIndexes(javax.swing.JComboBox combo, int[] indexes)
public static void addSeparatorsAfterIndexes(javax.swing.JComboBox combo, java.lang.Integer[] indexes)
public static javax.swing.JFileChooser createNewFileChooser(javax.swing.filechooser.FileFilter fileFilter)
fileFilter
- file filter or null
public static boolean colorsInEqualRange(java.awt.Color c1, java.awt.Color c2, int maxDiff)
c1
- The first color.c2
- The second color.maxDiff
- The maximum difference that counts as equal range.true
if both colors are in the equal range.public static javax.swing.JPanel createPersonaBackgroundPanel()
public static boolean isNimbusLookAndFeel()
public static boolean isGTKLookAndFeel()
public static java.lang.String getDefaultLookAndFeelClassName(boolean excludeGTK)
excludeGTK
- true
if the GTK+ look and feel should not
be considered to be the default look and feel.TV-Browser 3.4.4, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)