public class GUIUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
GUIUtil.FileChooserWithOverwritePrompting |
static class |
GUIUtil.Location |
| Modifier and Type | Field and Description |
|---|---|
static FileFilter |
ALL_FILES_FILTER |
static String |
dbf |
static String |
dbfDesc |
static String |
fme |
static String |
fmeDesc |
static String |
gml |
static String |
gmlDesc |
static String |
jml |
static String |
jmlDesc |
static String |
shp |
static String |
shpDesc |
static String |
shx |
static String |
shxDesc |
static String |
wkt |
static String |
wktaDesc |
static String |
wktDesc |
static String |
xml |
static String |
xmlDesc |
| Constructor and Description |
|---|
GUIUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Point2D |
add(Point2D a,
Point2D b) |
static void |
addInternalFrameListener(JDesktopPane pane,
InternalFrameListener listener)
Listens to all internal frames (current and future) in a JDesktopPane.
|
static Color |
alphaColor(Color color,
int alpha) |
static void |
centre(Component componentToMove,
Component componentToCentreOn)
Centres the first component on the second
|
static void |
centreOnScreen(Component componentToMove)
Centres the component on the screen
|
static void |
centreOnWindow(Component componentToMove)
Centres the component on its window
|
static void |
chooseGoodColumnWidths(JTable table)
Sets the column widths based on the first row.
|
static Cursor |
createCursor(Image image,
Point hotSpot) |
static Cursor |
createCursorFromIcon(Image iconImage) |
static FileFilter |
createFileFilter(String description,
String[] extensions) |
static JFileChooser |
createJFileChooserWithExistenceChecking() |
static JFileChooser |
createJFileChooserWithOverwritePrompting() |
static Timer |
createRestartableSingleEventTimer(int delay,
ActionListener listener)
Returns a Timer that fires once, after the delay.
|
static ValidatingTextField |
createSyncdTextField(JSlider s) |
static ValidatingTextField |
createSyncdTextField(JSlider s,
int columns) |
static void |
dispose(JInternalFrame internalFrame,
JDesktopPane desktopPane)
Ensures that the next frame is activated when #dispose is called
explicitly, in JDK 1.4.
|
static void |
doNotRoundDoubles(JTable table) |
static String |
escapeHTML(String value,
boolean escapeSpaces,
boolean escapeNewlines)
Returns a string suitable for embeddind as HTML.
|
static void |
fixClicks(Component c)
Fix for Sun Java Bug 4398733: if you click in an inactive
JInternalFrame, the mousePressed and mouseReleased events will be fired,
but not the mouseClicked event.
|
static void |
fixEditableComboBox(JComboBox cb)
Workaround for Java Bug 4648654 "REGRESSION: Editable JComboBox focus
misbehaves under Windows look and feel, proposed by Kleopatra
(fastegal@addcom.de).
|
static Transferable |
getContents(Clipboard clipboard)
The JVM's clipboard implementation is buggy (see bugs 4644554 and
4522198 in Sun's Java bug database).
|
static Component |
getDescendantOfClass(Class c,
Container container) |
static String |
getExtension(File f) |
static void |
handleThrowable(Throwable t,
Component parent) |
static void |
highlightForDebugging(JComponent component,
Color color)
Highlights a given component with a given color.
|
static void |
invokeOnEventThread(Runnable r)
GUI operations should be performed only on the AWT event dispatching
thread.
|
static List |
items(JComboBox comboBox) |
static JTextArea |
makeTabMoveFocus(JTextArea textArea)
Based on Green, Roedy.
|
static Point2D |
multiply(Point2D v,
double x) |
static String |
nameWithoutExtension(File file) |
static void |
removeChoosableFileFilters(JFileChooser fc) |
static ImageIcon |
resize(ImageIcon icon,
int extent) |
static File[] |
selectedFiles(JFileChooser chooser)
Work around Java Bug 4437688 "JFileChooser.getSelectedFile() returns
nothing when a file is selected" [Jon Aquino]
|
static void |
setLocation(Component componentToMove,
GUIUtil.Location location,
Component other) |
static void |
setSelectedWithClick(JCheckBox checkBox,
boolean selected)
Calls #doClick so that events are fired.
|
static Point2D |
subtract(Point2D a,
Point2D b) |
static int |
swingThreadPriority() |
static void |
sync(JCheckBox c1,
JCheckBox c2) |
static void |
sync(JSlider s1,
JSlider s2) |
static void |
sync(JSlider s,
ValidatingTextField t) |
static void |
syncEnabledStates(JComponent c1,
JComponent c2) |
static ImageIcon |
toDisabledIcon(ImageIcon icon) |
static DocumentListener |
toDocumentListener(ActionListener listener) |
static InternalFrameListener |
toInternalFrameListener(ActionListener listener) |
static ListDataListener |
toListDataListener(ActionListener listener) |
static Component |
topCard(Container c) |
static Color |
toSimulatedTransparency(Color color) |
static ImageIcon |
toSmallIcon(ImageIcon icon)
Resizes icon to 16 x 16.
|
static double |
trueAscent(TextLayout layout)
Returns the distance from the baseline to the top of the text's bounding
box.
|
static String |
truncateString(String s,
int maxLength) |
public static final String dbf
public static final String dbfDesc
public static final String fme
public static final String fmeDesc
public static final String gml
public static final String gmlDesc
public static final String jml
public static final String jmlDesc
public static final String shp
public static final String shpDesc
public static final String shx
public static final String shxDesc
public static final String wkt
public static final String wktDesc
public static final String wktaDesc
public static final String xml
public static final String xmlDesc
public static final FileFilter ALL_FILES_FILTER
public static final String escapeHTML(String value, boolean escapeSpaces, boolean escapeNewlines)
Based on code from Jason Sherman. See http://www.w3schools.com/html/html_asciiref.asp
public static void centre(Component componentToMove, Component componentToCentreOn)
componentToMove - Description of the ParametercomponentToCentreOn - Description of the Parameterpublic static void centreOnScreen(Component componentToMove)
componentToMove - Description of the Parameterpublic static void centreOnWindow(Component componentToMove)
componentToMove - Description of the Parameterpublic static void chooseGoodColumnWidths(JTable table)
table - Description of the Parameterpublic static JFileChooser createJFileChooserWithExistenceChecking()
public static JFileChooser createJFileChooserWithOverwritePrompting()
public static void doNotRoundDoubles(JTable table)
public static void fixEditableComboBox(JComboBox cb)
cb - Description of the Parameterpublic static void invokeOnEventThread(Runnable r) throws InterruptedException, InvocationTargetException
public static void removeChoosableFileFilters(JFileChooser fc)
public static FileFilter createFileFilter(String description, String[] extensions)
extensions - e.g. txtpublic static Color toSimulatedTransparency(Color color)
color - a Color with possibly an alpha less than 255public static Transferable getContents(Clipboard clipboard)
public static double trueAscent(TextLayout layout)
public static int swingThreadPriority()
public static void fixClicks(Component c)
public static void addInternalFrameListener(JDesktopPane pane, InternalFrameListener listener)
public static DocumentListener toDocumentListener(ActionListener listener)
public static ListDataListener toListDataListener(ActionListener listener)
public static InternalFrameListener toInternalFrameListener(ActionListener listener)
public static Timer createRestartableSingleEventTimer(int delay, ActionListener listener)
public static ValidatingTextField createSyncdTextField(JSlider s)
public static ValidatingTextField createSyncdTextField(JSlider s, int columns)
public static void sync(JSlider s, ValidatingTextField t)
public static void syncEnabledStates(JComponent c1, JComponent c2)
public static void setSelectedWithClick(JCheckBox checkBox, boolean selected)
public static void setLocation(Component componentToMove, GUIUtil.Location location, Component other)
public static void highlightForDebugging(JComponent component, Color color)
public static File[] selectedFiles(JFileChooser chooser)
public static void dispose(JInternalFrame internalFrame, JDesktopPane desktopPane)
Copyright © 2015. All rights reserved.