mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-09 16:25:10 +03:00
OptionPane: fixed rendering of longer HTML text if it is passed as StringBuilder, StringBuffer, or any other object that returns HTML text in method toString() (similar to issue #12)
This commit is contained in:
@@ -17,6 +17,9 @@ FlatLaf Change Log
|
|||||||
since FlatLaf 1.3)
|
since FlatLaf 1.3)
|
||||||
- OptionPane: Fixed `OptionPane.sameSizeButtons`, which did not work as expected
|
- OptionPane: Fixed `OptionPane.sameSizeButtons`, which did not work as expected
|
||||||
when setting to `false`.
|
when setting to `false`.
|
||||||
|
- OptionPane: Fixed rendering of longer HTML text if it is passed as
|
||||||
|
`StringBuilder`, `StringBuffer`, or any other object that returns HTML text in
|
||||||
|
method `toString()`. (similar to issue #12)
|
||||||
- TextField, FormattedTextField, PasswordField and ComboBox: Fixed alignment of
|
- TextField, FormattedTextField, PasswordField and ComboBox: Fixed alignment of
|
||||||
placeholder text in right-to-left component orientation.
|
placeholder text in right-to-left component orientation.
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import java.awt.GridBagConstraints;
|
|||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.Icon;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
@@ -162,8 +163,15 @@ public class FlatOptionPaneUI
|
|||||||
cons.insets.bottom = UIScale.scale( messagePadding );
|
cons.insets.bottom = UIScale.scale( messagePadding );
|
||||||
|
|
||||||
// disable line wrapping for HTML
|
// disable line wrapping for HTML
|
||||||
if( msg instanceof String && BasicHTML.isHTMLString( (String) msg ) )
|
if( msg != null &&
|
||||||
maxll = Integer.MAX_VALUE;
|
!(msg instanceof Component) &&
|
||||||
|
!(msg instanceof Object[]) &&
|
||||||
|
!(msg instanceof Icon) )
|
||||||
|
{
|
||||||
|
msg = msg.toString();
|
||||||
|
if( BasicHTML.isHTMLString( (String) msg ) )
|
||||||
|
maxll = Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
// fix right-to-left alignment if super.addMessageComponents() breaks longer lines
|
// fix right-to-left alignment if super.addMessageComponents() breaks longer lines
|
||||||
// into multiple labels and puts them into a box that aligns them to the left
|
// into multiple labels and puts them into a box that aligns them to the left
|
||||||
|
|||||||
Reference in New Issue
Block a user