public class UiUtilities extends Object
Modifier and Type | Field and Description |
---|---|
static Border |
DIALOG_BORDER
The border to use for dialogs.
|
static Insets |
ZERO_INSETS |
Constructor and Description |
---|
UiUtilities() |
Modifier and Type | Method and Description |
---|---|
static void |
centerAndShow(Window win)
Centers a window to its parent frame and shows it.
|
static ImageIcon |
createChannelIcon(Icon ic)
Creates a scaled Version of the Icon.
|
static JDialog |
createDialog(Component parent,
boolean modal)
Der
JDialog hat einen Riesennachteil: er hat zwei verschiedenen
Konstrukturen: einer f�r einen Frame als Besitzer und einer f�r einen
Dialog als Besitzer. |
static JTextArea |
createHelpTextArea(String msg)
Creates a text area that holds a help text.
|
static JEditorPane |
createHtmlHelpTextArea(String html)
Creates a Html EditorPane that holds a HTML-Help Text
Links will be displayed and are clickable
|
static JEditorPane |
createHtmlHelpTextArea(String html,
HyperlinkListener listener)
Creates a Html EditorPane that holds a HTML-Help Text.
|
static JButton |
createToolBarButton(String text,
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 Window |
getBestDialogParent(Component parent)
Gets the best dialog parent for a new JDialog.
|
static int |
getCharsWidth(Font font,
char[] chars,
int offset,
int length)
Gets the width of the specified char array.
|
static Window |
getLastModalChildOf(Window parent)
Gets the last visible modal child dialog of the specified window.
|
static int |
getStringWidth(Font font,
String str)
Gets the width of the specified String.
|
static void |
moveSelectedItems(JList list,
int nrRows)
Move selected Items in the JList
|
static void |
moveSelectedItems(JList list,
int row,
boolean sort)
Move selected Items in the JList
|
static Object[] |
moveSelectedItems(JList fromList,
JList toList)
Moves Selected Items from one List to another
|
static Object[] |
moveSelectedItems(JList fromList,
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 Icon |
scaleIcon(Icon icon,
int newWidth)
Scale Icons to a specific width.
|
static Icon |
scaleIcon(Icon icon,
int x,
int y)
Scales Icons to s specific size
|
public static final Border DIALOG_BORDER
public static final Insets ZERO_INSETS
public static void centerAndShow(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 JDialog createDialog(Component parent, boolean modal)
JDialog
hat einen Riesennachteil: er hat zwei verschiedenen
Konstrukturen: einer f�r einen Frame als Besitzer und einer f�r einen
Dialog als Besitzer. Wenn man nun das �berliegende Fenster gar nicht kennt,
dann hat man ein Problem (Z.B. Wenn man einen Button schreibt, der
manchmal eine Fehlermeldung zeigt). Bisher habe ich einfach den
Component-Pfad bis zum obersten Frame verfolgt
(@link UiToolkit#getFrameFor(Component)). Das ganze wird dann zum Problem,
wenn man in einem modalen Dialog einen nicht-modalen Dialog zeigt.
Denn dann kann man den nicht-modalen Dialog n�mlich erst dann wieder
bedienen, wenn der modale zu ist.parent
- A component in the component tree where the dialog should be created for.modal
- Should the new dialog be modal?public static Window getBestDialogParent(Component parent)
If there is no visible modal dialog the root frame will be returned.
parent
- One component of the component tree.public static Window getLastModalChildOf(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 JButton createToolBarButton(String text, 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(Font font, String str)
str
- The String to get the width for.font
- The font being the base of the measure.public static int getCharsWidth(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 JTextArea createHelpTextArea(String msg)
msg
- The help text.public static JEditorPane createHtmlHelpTextArea(String html)
html
- HTML-Text to displaypublic static JEditorPane createHtmlHelpTextArea(String html, HyperlinkListener listener)
html
- HTML-Text to displaylistener
- Link-Listener for this HelpTextpublic static Object[] moveSelectedItems(JList fromList, JList toList)
fromList
- Move from this ListtoList
- Move into this Listpublic static Object[] moveSelectedItems(JList fromList, JList toList, int row)
fromList
- Move from this ListtoList
- Move into this Listrow
- The target row where to insertpublic static void moveSelectedItems(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(JList list, int nrRows)
list
- Move Items in this ListnrRows
- Move Items nrRows up/downpublic static Icon scaleIcon(Icon icon, int newWidth)
icon
- The icon to scale.newWidth
- The new width of the icon.public static Icon scaleIcon(Icon icon, int x, int y)
icon
- Icon that should be scaledx
- new X-Valuey
- new Y-Valuepublic static ImageIcon createChannelIcon(Icon ic)
ic
- public static void registerForClosing(WindowClosingIf component)
component
- The component to close on pressing escape key.TV-Browser 2.2.6, Copyright (C) 04-2003 Martin Oberhauser (martin@tvbrowser.org)