Class QuaquaUtilities

    • Method Detail

      • isLeftToRight

        public static boolean isLeftToRight​(Component c)
      • drawStringUnderlineCharAt

        public static void drawStringUnderlineCharAt​(Graphics g,
                                                     String text,
                                                     int underlinedIndex,
                                                     int x,
                                                     int y)
        Draw a string with the graphics g at location (x, y) just like g.drawString would. The character at index underlinedIndex in text will be underlined. If index is beyond the bounds of text (including < 0), nothing will be underlined.
        Parameters:
        g - Graphics to draw with
        text - String to draw
        underlinedIndex - Index of character in text to underline
        x - x coordinate to draw at
        y - y coordinate to draw at
        Since:
        1.4
      • isOnActiveWindow

        public static boolean isOnActiveWindow​(Component c)
        Returns true if the component is on a Dialog or a Frame, which is active, or if it is on a Window, which is focused. Always returns true, if the component has no parent window.
      • getKeyModifiersText

        public static String getKeyModifiersText​(int modifiers,
                                                 boolean leftToRight)
        Returns a Mac OS X specific String describing the modifier key(s), such as "Shift", or "Ctrl+Shift".
        Returns:
        string a text description of the combination of modifier keys that were held down during the event
      • repaintBorder

        public static void repaintBorder​(JComponent component)
      • beginGraphics

        public static final Object beginGraphics​(Graphics2D graphics2d)
      • endGraphics

        public static final void endGraphics​(Graphics2D graphics2d,
                                             Object oldHints)
      • isFocused

        public static final boolean isFocused​(Component component)
      • getLeftSideBearing

        public static int getLeftSideBearing​(Font f,
                                             String string)
      • createBufferedImage

        public static BufferedImage createBufferedImage​(URL location)
      • createTexturePaint

        public static TexturePaint createTexturePaint​(URL location)
      • layoutCompoundLabel

        public static String layoutCompoundLabel​(JComponent c,
                                                 FontMetrics fm,
                                                 String text,
                                                 Icon icon,
                                                 int verticalAlignment,
                                                 int horizontalAlignment,
                                                 int verticalTextPosition,
                                                 int horizontalTextPosition,
                                                 Rectangle viewR,
                                                 Rectangle iconR,
                                                 Rectangle textR,
                                                 int textIconGap)
        Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string. Locations are computed relative to the viewR rectangle. The JComponents orientation (LEADING/TRAILING) will also be taken into account and translated into LEFT/RIGHT values accordingly.
      • layoutCompoundLabel

        public static String layoutCompoundLabel​(FontMetrics fm,
                                                 String text,
                                                 Icon icon,
                                                 int verticalAlignment,
                                                 int horizontalAlignment,
                                                 int verticalTextPosition,
                                                 int horizontalTextPosition,
                                                 Rectangle viewR,
                                                 Rectangle iconR,
                                                 Rectangle textR,
                                                 int textIconGap)
        Compute and return the location of the icons origin, the location of origin of the text baseline, and a possibly clipped version of the compound labels string. Locations are computed relative to the viewR rectangle. This layoutCompoundLabel() does not know how to handle LEADING/TRAILING values in horizontalTextPosition (they will default to RIGHT) and in horizontalAlignment (they will default to CENTER). Use the other version of layoutCompoundLabel() instead.
      • configureGraphics

        public static void configureGraphics​(Graphics gr)
      • compositeRequestFocus

        public static Component compositeRequestFocus​(Component component)
        Copied from BasicLookAndFeel.