java.lang.Object
org.gjt.sp.util.GenericGUIUtilities
Various GUI utility functions not depending on jEdit, for use in StandaloneTextArea.
- Version:
- $Id: GenericGUIUtilities.java 25107 2020-03-31 22:37:06Z kpouer $
- Author:
- Slava Pestov, Eric Le Lay
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
adjustForScreenBounds
(Rectangle desired) Gives a rectangle the specified bounds, ensuring it is within the screen bounds.static int
Column width for JTable, based on global defaults.static int
Row height for JTable, based on global defaults.static Dimension
JTable cell size, based on global defaults.static JDialog
Traverses the given component's parent tree looking for an instance of JDialog, and return it.static Rectangle
Returns the screen bounds, taking into account multi-screen environments.static boolean
isAncestorOf
(Component comp1, Component comp2) Returns if the first component is an ancestor of the second by traversing up the component hierarchy.static boolean
isLeftButton
(MouseEvent evt) static boolean
isMiddleButton
(int modifiers) Deprecated.static boolean
isMiddleButton
(MouseEvent evt) static boolean
isPopupTrigger
(MouseEvent evt) Returns if the specified event is the popup trigger event.static boolean
isRightButton
(int modifiers) Deprecated.static boolean
isRightButton
(MouseEvent evt) static void
makeSameSize
(Component... components) Makes components the same size by finding the largest width and height of the given components then setting all components to that width and height.static String
prettifyMenuLabel
(String label) `Prettifies' a menu item label by removing the `$' sign.static void
requestFocus
(Window win, Component comp) Focuses on the specified component as soon as the window becomes active.static void
setAutoMnemonic
(AbstractButton button) Sets the mnemonic for the given button using jEdit convention, taking the letter after the dollar.static void
setButtonContentMargin
(AbstractButton button, Insets margin) Sets the content margin of a button (for Nimbus L&F).static void
setEnabledRecursively
(Container c, boolean enabled) Call setEnabled() recursively on the container and its descendants.static void
showPopupMenu
(JPopupMenu popup, Component comp, int x, int y) Shows the specified popup menu, ensuring it is displayed within the bounds of the screen.static void
showPopupMenu
(JPopupMenu popup, Component comp, int x, int y, boolean point) Shows the specified popup menu, ensuring it is displayed within the bounds of the screen.
-
Constructor Details
-
GenericGUIUtilities
public GenericGUIUtilities()
-
-
Method Details
-
prettifyMenuLabel
`Prettifies' a menu item label by removing the `$' sign. This can be used to process the contents of an action.label property.- Parameters:
label
- the label- Returns:
- a pretty label
- Since:
- jEdit 5.3.1
-
setAutoMnemonic
Sets the mnemonic for the given button using jEdit convention, taking the letter after the dollar.- Parameters:
button
- The button to set the mnemonic for.- Since:
- jEdit 5.3.1
-
adjustForScreenBounds
Gives a rectangle the specified bounds, ensuring it is within the screen bounds.- Since:
- jEdit 5.3.1
-
requestFocus
Focuses on the specified component as soon as the window becomes active.- Parameters:
win
- The windowcomp
- The component- Since:
- jEdit 5.3.1
-
isPopupTrigger
Returns if the specified event is the popup trigger event. This implements precisely defined behavior, as opposed to MouseEvent.isPopupTrigger().- Parameters:
evt
- The event- Since:
- jEdit 5.3.1
-
isLeftButton
- Parameters:
evt
- A mouse event- Since:
- jEdit 5.6
-
isMiddleButton
Deprecated.- Parameters:
modifiers
- The modifiers flag from a mouse event- Since:
- jEdit 5.3.1
-
isMiddleButton
- Parameters:
evt
- A mouse event- Since:
- jEdit 5.6
-
isRightButton
Deprecated.- Parameters:
modifiers
- The modifiers flag from a mouse event- Since:
- jEdit 5.3.1
-
isRightButton
- Parameters:
evt
- A mouse event- Since:
- jEdit 5.6
-
getScreenBounds
Returns the screen bounds, taking into account multi-screen environments.- Since:
- jEdit 5.3.1
-
showPopupMenu
Shows the specified popup menu, ensuring it is displayed within the bounds of the screen.- Parameters:
popup
- The popup menucomp
- The component to show it forx
- The x co-ordinatey
- The y co-ordinate- Since:
- jEdit 4.0pre1, jEdit 5.3.1
- See Also:
-
showPopupMenu
Shows the specified popup menu, ensuring it is displayed within the bounds of the screen.- Parameters:
popup
- The popup menucomp
- The component to show it forx
- The x co-ordinatey
- The y co-ordinatepoint
- If true, then the popup originates from a single point; otherwise it will originate from the component itself. This affects positioning in the case where the popup does not fit onscreen.- Since:
- jEdit 5.3.1
-
isAncestorOf
Returns if the first component is an ancestor of the second by traversing up the component hierarchy.- Parameters:
comp1
- The ancestorcomp2
- The component to check- Since:
- jEdit 5.3.1
-
getParentDialog
Traverses the given component's parent tree looking for an instance of JDialog, and return it. If not found, return null.- Parameters:
c
- The component- Since:
- jEdit 5.3.1
-
setEnabledRecursively
Call setEnabled() recursively on the container and its descendants.- Parameters:
c
- The containerenabled
- The enabled state to set- Since:
- jEdit 5.3.1
-
setButtonContentMargin
Sets the content margin of a button (for Nimbus L&F).- Parameters:
button
- the button to modifymargin
- the new margin- Since:
- jEdit 5.3.1
-
makeSameSize
Makes components the same size by finding the largest width and height of the given components then setting all components to that width and height. This is especially useful for making JButtons the same size.- Parameters:
components
- The components to make the same size.- Since:
- jEdit 5.3.1
-
defaultTableCellSize
JTable cell size, based on global defaults.- Since:
- jEdit 5.3.1
-
defaultColumnWidth
public static int defaultColumnWidth()Column width for JTable, based on global defaults.- Since:
- jEdit 5.3.1
-
defaultRowHeight
public static int defaultRowHeight()Row height for JTable, based on global defaults.- Since:
- jEdit 5.3.1
-
isMiddleButton(MouseEvent)