mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 15:27:16 -06:00
Label: scale iconTextGap
This commit is contained in:
@@ -17,12 +17,17 @@
|
|||||||
package com.formdev.flatlaf.ui;
|
package com.formdev.flatlaf.ui;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.FontMetrics;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import javax.swing.Icon;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
import javax.swing.plaf.basic.BasicLabelUI;
|
import javax.swing.plaf.basic.BasicLabelUI;
|
||||||
|
import com.formdev.flatlaf.util.UIScale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the Flat LaF UI delegate for {@link javax.swing.JLabel}.
|
* Provides the Flat LaF UI delegate for {@link javax.swing.JLabel}.
|
||||||
@@ -72,4 +77,18 @@ public class FlatLabelUI
|
|||||||
g.setColor( disabledForeground );
|
g.setColor( disabledForeground );
|
||||||
FlatUIUtils.drawStringUnderlineCharAt( l, g, s, mnemIndex, textX, textY );
|
FlatUIUtils.drawStringUnderlineCharAt( l, g, s, mnemIndex, textX, textY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overridden to scale iconTextGap.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String layoutCL( JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR,
|
||||||
|
Rectangle iconR, Rectangle textR )
|
||||||
|
{
|
||||||
|
return SwingUtilities.layoutCompoundLabel( label, fontMetrics, text, icon,
|
||||||
|
label.getVerticalAlignment(), label.getHorizontalAlignment(),
|
||||||
|
label.getVerticalTextPosition(), label.getHorizontalTextPosition(),
|
||||||
|
viewR, iconR, textR,
|
||||||
|
UIScale.scale( label.getIconTextGap() ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user