mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 07:17:13 -06:00
ToolTip: use anti-aliasing to render multi-line tooltips
This commit is contained in:
@@ -9,6 +9,7 @@ FlatLaf Change Log
|
|||||||
and is no longer interrupted by the scroll buttons.
|
and is no longer interrupted by the scroll buttons.
|
||||||
- TabbedPane: Content pane is no longer opaque. Use antialiasing for painting
|
- TabbedPane: Content pane is no longer opaque. Use antialiasing for painting
|
||||||
separator and content border.
|
separator and content border.
|
||||||
|
- ToolTip: Use anti-aliasing to render multi-line tooltips.
|
||||||
- JIDE Common Layer: Support `JideTabbedPane`.
|
- JIDE Common Layer: Support `JideTabbedPane`.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class FlatToolTipUI
|
|||||||
boolean leftToRight = (comp != null ? comp : c).getComponentOrientation().isLeftToRight();
|
boolean leftToRight = (comp != null ? comp : c).getComponentOrientation().isLeftToRight();
|
||||||
for( String line : lines ) {
|
for( String line : lines ) {
|
||||||
y += lineHeight;
|
y += lineHeight;
|
||||||
g.drawString( line, leftToRight ? x : x2 - SwingUtilities.computeStringWidth( fm, line ), y );
|
FlatUIUtils.drawString( c, g, line, leftToRight ? x : x2 - SwingUtilities.computeStringWidth( fm, line ), y );
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
super.paint( g, c );
|
super.paint( g, c );
|
||||||
|
|||||||
@@ -256,6 +256,22 @@ public class FlatUIUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Draws the given string at the specified location using text properties
|
||||||
|
* and anti-aliasing hints from the provided component.
|
||||||
|
*
|
||||||
|
* Use this method instead of Graphics.drawString() for correct anti-aliasing.
|
||||||
|
*
|
||||||
|
* Replacement for SwingUtilities2.drawString()
|
||||||
|
*/
|
||||||
|
public static void drawString( JComponent c, Graphics g, String text, int x, int y ) {
|
||||||
|
JavaCompatibility.drawStringUnderlineCharAt( c, g, text, -1, x, y );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws the given string at the specified location underlining the specified
|
||||||
|
* character. The provided component is used to query text properties and
|
||||||
|
* anti-aliasing hints.
|
||||||
|
*
|
||||||
* Replacement for SwingUtilities2.drawStringUnderlineCharAt()
|
* Replacement for SwingUtilities2.drawStringUnderlineCharAt()
|
||||||
*/
|
*/
|
||||||
public static void drawStringUnderlineCharAt( JComponent c, Graphics g,
|
public static void drawStringUnderlineCharAt( JComponent c, Graphics g,
|
||||||
|
|||||||
Reference in New Issue
Block a user