public class StaticSwingTools extends Object
| Constructor and Description |
|---|
StaticSwingTools() |
| Modifier and Type | Method and Description |
|---|---|
static void |
centerWindowOnScreen(Window w)
Centers a Window instance on the screen on which the mouse pointer is located.
|
static File |
chooseFile(String currentDirectoryPath,
boolean isSaveDialog,
String[] allowedFileExtension,
String fileExtensionDescription,
Component parent)
Opens a JFileChooser with a filter for the given file extensions and checks if the chosen file has the right
extension.
|
static File |
chooseFileWithMultipleFilters(String currentDirectoryPath,
boolean isSaveDialog,
String[] allowedFileExtension,
String[] fileExtensionDescription,
Component parent)
Opens a JFileChooser with a filter for the given file extensions and checks if the chosen file has the right
extension.
|
static void |
decorateWithFixedAutoCompleteDecorator(JComboBox cbo)
DOCUMENT ME!
|
static void |
doClickButtonOnKeyStroke(JButton button,
KeyStroke keyStroke,
JRootPane rootPane)
DOCUMENT ME!
|
static void |
enableSliderToolTips(JSlider slider,
MessageFormat format,
double factor)
Adds a change listener to the given slider which ensures that the current value of the slider is permanently
shown in the tooltip.
|
static <T extends Component> |
findSpecificParentComponent(Container c,
Class<T> clazz)
DOCUMENT ME!
|
static Rectangle |
getCenterBoundsForComponent(Component c)
Determines the bounds of a component to centers it on the screen on which the mouse pointer is located.
|
static Rectangle |
getComponentsExtent(Component... components)
DOCUMENT ME!
|
static Frame |
getFirstParentFrame(Component c)
DOCUMENT ME!
|
static String |
getLinkFromDropEvent(DropTargetDropEvent dtde)
DOCUMENT ME!
|
static Frame |
getParentFrame(Component c)
DOCUMENT ME!
|
static Frame |
getParentFrame(Component c,
boolean first)
DOCUMENT ME!
|
static Component |
getParentFrameIfNotNull(Component c)
Returns the parent frame of the given component or the given component if there is no parent frame.
|
static void |
hideToolTip(JComponent comp)
Hides a component's tooltip.
|
static void |
jTabbedPaneWithVerticalTextAddTab(JTabbedPane tabPane,
String text,
Icon icon,
JComponent comp)
DOCUMENT ME!
|
static void |
jTabbedPaneWithVerticalTextAddTab(JTabbedPane tabPane,
String text,
JComponent comp)
DOCUMENT ME!
|
static JTabbedPane |
jTabbedPaneWithVerticalTextCreator(int tabPlacement)
DOCUMENT ME!
|
static JTabbedPane |
jTabbedPaneWithVerticalTextCreator(int tabPlacement,
int tabLayoutPolicy)
DOCUMENT ME!
|
static void |
jTabbedPaneWithVerticalTextSetNewText(JTabbedPane tabPane,
String text,
Icon icon,
Color textColor,
JComponent comp)
DOCUMENT ME!
|
static void |
jTabbedPaneWithVerticalTextSetNewText(JTabbedPane tabPane,
String text,
Icon icon,
JComponent comp)
DOCUMENT ME!
|
static void |
jTabbedPaneWithVerticalTextSetNewText(JTabbedPane tabPane,
String text,
JComponent comp)
DOCUMENT ME!
|
static void |
jTableScrollToVisible(JTable table,
int rowIndex,
int vColIndex)
From The Java Developers Almanac.
|
static void |
jTreeCollapseAllNodes(JTree tree)
DOCUMENT ME!
|
static void |
jTreeExpandAllNodes(JTree tree)
DOCUMENT ME!
|
static void |
jTreeExpandAllNodesAndScroll2Last(JTree tree)
DOCUMENT ME!
|
static void |
postToolTip(JComponent comp)
Shows a component's tooltip.
|
static void |
setNiftyScrollBars(JScrollPane sPane)
DOCUMENT ME!
|
static void |
showDialog(Component parent,
JDialog dialog,
boolean isRelativeToParentFrame)
Shows given dialog centered relative to the given parent.
|
static void |
showDialog(JDialog dialog)
Shows given dialog centered relative to its parent frame.
|
static void |
showDialog(JDialog dialog,
boolean isRelativeToParentFrame)
Shows given dialog centered relative to its parent frame.
|
static void |
tryPackingMyParentDialog(Component component)
Calls pack() on a parent JDialog if available.
|
static void |
tweakUI()
A Method to make UIManger.put comands configurable via a json file.
|
public static void jTreeExpandAllNodes(JTree tree)
tree - DOCUMENT ME!public static void jTreeExpandAllNodesAndScroll2Last(JTree tree)
tree - DOCUMENT ME!public static void jTreeCollapseAllNodes(JTree tree)
tree - DOCUMENT ME!public static void doClickButtonOnKeyStroke(JButton button, KeyStroke keyStroke, JRootPane rootPane)
button - DOCUMENT ME!keyStroke - DOCUMENT ME!rootPane - DOCUMENT ME!public static <T extends Component> T findSpecificParentComponent(Container c, Class<T> clazz)
T - DOCUMENT ME!c - DOCUMENT ME!clazz - DOCUMENT ME!public static void jTableScrollToVisible(JTable table, int rowIndex, int vColIndex)
table - DOCUMENT ME!rowIndex - DOCUMENT ME!vColIndex - DOCUMENT ME!public static String getLinkFromDropEvent(DropTargetDropEvent dtde)
dtde - DOCUMENT ME!public static void jTabbedPaneWithVerticalTextAddTab(JTabbedPane tabPane, String text, JComponent comp)
tabPane - DOCUMENT ME!text - DOCUMENT ME!comp - DOCUMENT ME!public static void jTabbedPaneWithVerticalTextAddTab(JTabbedPane tabPane, String text, Icon icon, JComponent comp)
tabPane - DOCUMENT ME!text - DOCUMENT ME!icon - DOCUMENT ME!comp - DOCUMENT ME!public static void jTabbedPaneWithVerticalTextSetNewText(JTabbedPane tabPane, String text, JComponent comp)
tabPane - DOCUMENT ME!text - DOCUMENT ME!comp - DOCUMENT ME!public static void jTabbedPaneWithVerticalTextSetNewText(JTabbedPane tabPane, String text, Icon icon, JComponent comp)
tabPane - DOCUMENT ME!text - DOCUMENT ME!icon - DOCUMENT ME!comp - DOCUMENT ME!public static void jTabbedPaneWithVerticalTextSetNewText(JTabbedPane tabPane, String text, Icon icon, Color textColor, JComponent comp)
tabPane - DOCUMENT ME!text - DOCUMENT ME!icon - DOCUMENT ME!textColor - DOCUMENT ME!comp - DOCUMENT ME!public static JTabbedPane jTabbedPaneWithVerticalTextCreator(int tabPlacement)
tabPlacement - DOCUMENT ME!public static JTabbedPane jTabbedPaneWithVerticalTextCreator(int tabPlacement, int tabLayoutPolicy)
tabPlacement - DOCUMENT ME!tabLayoutPolicy - DOCUMENT ME!public static void setNiftyScrollBars(JScrollPane sPane)
sPane - DOCUMENT ME!public static Frame getFirstParentFrame(Component c)
c - DOCUMENT ME!public static Frame getParentFrame(Component c)
c - DOCUMENT ME!public static Frame getParentFrame(Component c, boolean first)
c - DOCUMENT ME!first - DOCUMENT ME!public static Component getParentFrameIfNotNull(Component c)
c - component whose parent frame shall be determinedpublic static Rectangle getComponentsExtent(Component... components)
components - DOCUMENT ME!public static void showDialog(Component parent, JDialog dialog, boolean isRelativeToParentFrame)
parent - dialog parentdialog - dialogisRelativeToParentFrame - true if the dialog shall be centered relative to the parent frame (determined by
the given parent), false otherwisepublic static void centerWindowOnScreen(Window w)
w - window instance to be centeredpublic static Rectangle getCenterBoundsForComponent(Component c)
c - Component instance to be centeredpublic static void showDialog(JDialog dialog)
dialog - dialogpublic static void showDialog(JDialog dialog, boolean isRelativeToParentFrame)
dialog - dialogisRelativeToParentFrame - true if the dialog shall be centered relative to the parent frame (determined by
the given parent), false if it shall be centered relative to its parentpublic static void tryPackingMyParentDialog(Component component)
component - The component from which a parent JDialog is searched.public static void enableSliderToolTips(JSlider slider, MessageFormat format, double factor)
slider - The slider to modify.format - The format to be used to print the value (e. g. "Percentage: {0,number,#0.0}%").factor - A factor for the value. E. g. if the slider allows sliding between 0 and 1000 but we want to show
the percentage, we have to multiply the value by 0.1D. Set to Double.NaN if it shouldn't be used.public static void postToolTip(JComponent comp)
comp - The component whose tooltip shall appear.public static void hideToolTip(JComponent comp)
comp - The component whose tooltip shall disappear.public static void decorateWithFixedAutoCompleteDecorator(JComboBox cbo)
cbo - DOCUMENT ME!public static void tweakUI()
The json File has to placed to /de/cismet/tools/gui/uitweaks.json.
An example json file can be found on GitHub.
public static File chooseFile(String currentDirectoryPath, boolean isSaveDialog, String[] allowedFileExtension, String fileExtensionDescription, Component parent)
currentDirectoryPath - The currebnt path that should be shown in the dialogisSaveDialog - True, if a save dialog should be shown. Otherwise a open dialog will be shownallowedFileExtension - all allowed file extensions or null, if every extension should be allowedfileExtensionDescription - The description of the file extension.parent - the parent component of the dialogpublic static File chooseFileWithMultipleFilters(String currentDirectoryPath, boolean isSaveDialog, String[] allowedFileExtension, String[] fileExtensionDescription, Component parent)
currentDirectoryPath - The currebnt path that should be shown in the dialogisSaveDialog - True, if a save dialog should be shown. Otherwise a open dialog will be shownallowedFileExtension - all allowed file extensions or null, if every extension should be allowedfileExtensionDescription - The descriptions for the allowed file extensions.parent - the parent component of the dialogCopyright © 2012–2026 cismet GmbH. All rights reserved.