mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 07:17:13 -06:00
OptionPane: fixed rendering of longer HTML text (#12)
This commit is contained in:
@@ -5,6 +5,7 @@ FlatLaf Change Log
|
|||||||
|
|
||||||
- ComboBox: Use small border if used as table editor.
|
- ComboBox: Use small border if used as table editor.
|
||||||
- ToolBar: Disable focusability of buttons in toolbar.
|
- ToolBar: Disable focusability of buttons in toolbar.
|
||||||
|
- OptionPane: Fixed rendering of longer HTML text. (issue #12)
|
||||||
- SwingX: Support `JXBusyLabel`, `JXHeader`, `JXHyperlink`,
|
- SwingX: Support `JXBusyLabel`, `JXHeader`, `JXHyperlink`,
|
||||||
`JXTaskPaneContainer` and `JXTaskPane`. (issue #8)
|
`JXTaskPaneContainer` and `JXTaskPane`. (issue #8)
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.awt.GridBagConstraints;
|
|||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
|
import javax.swing.plaf.basic.BasicHTML;
|
||||||
import javax.swing.plaf.basic.BasicOptionPaneUI;
|
import javax.swing.plaf.basic.BasicOptionPaneUI;
|
||||||
import com.formdev.flatlaf.util.UIScale;
|
import com.formdev.flatlaf.util.UIScale;
|
||||||
|
|
||||||
@@ -122,6 +123,10 @@ public class FlatOptionPaneUI
|
|||||||
if( messagePadding > 0 )
|
if( messagePadding > 0 )
|
||||||
cons.insets.bottom = UIScale.scale( messagePadding );
|
cons.insets.bottom = UIScale.scale( messagePadding );
|
||||||
|
|
||||||
|
// disable line wrapping for HTML
|
||||||
|
if( msg instanceof String && BasicHTML.isHTMLString( (String) msg ) )
|
||||||
|
maxll = Integer.MAX_VALUE;
|
||||||
|
|
||||||
super.addMessageComponents( container, cons, msg, maxll, internallyCreated );
|
super.addMessageComponents( container, cons, msg, maxll, internallyCreated );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ public class FlatOptionPaneTest
|
|||||||
//---- warningOptionPane ----
|
//---- warningOptionPane ----
|
||||||
warningOptionPane.setMessageType(JOptionPane.WARNING_MESSAGE);
|
warningOptionPane.setMessageType(JOptionPane.WARNING_MESSAGE);
|
||||||
warningOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
|
warningOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
|
||||||
warningOptionPane.setMessage("Beware of the dog!");
|
warningOptionPane.setMessage("<html>I like <b>bold</b>,<br> and I like <i>italic</i>,<br> and I like to have<br> many lines.<br> Lots of lines.");
|
||||||
panel5.add(warningOptionPane, BorderLayout.CENTER);
|
panel5.add(warningOptionPane, BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
add(panel5, "cell 1 4");
|
add(panel5, "cell 1 4");
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ new FormModel {
|
|||||||
name: "warningOptionPane"
|
name: "warningOptionPane"
|
||||||
"messageType": 2
|
"messageType": 2
|
||||||
"optionType": 2
|
"optionType": 2
|
||||||
"message": "Beware of the dog!"
|
"message": "<html>I like <b>bold</b>,<br> and I like <i>italic</i>,<br> and I like to have<br> many lines.<br> Lots of lines."
|
||||||
}, new FormLayoutConstraints( class java.lang.String ) {
|
}, new FormLayoutConstraints( class java.lang.String ) {
|
||||||
"value": "Center"
|
"value": "Center"
|
||||||
} )
|
} )
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ class OptionPanePanel
|
|||||||
//---- warningOptionPane ----
|
//---- warningOptionPane ----
|
||||||
warningOptionPane.setMessageType(JOptionPane.WARNING_MESSAGE);
|
warningOptionPane.setMessageType(JOptionPane.WARNING_MESSAGE);
|
||||||
warningOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
|
warningOptionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
|
||||||
warningOptionPane.setMessage("Beware of the dog!");
|
warningOptionPane.setMessage("<html>I like <b>bold</b>,<br> and I like <i>italic</i>,<br> and I like to have<br> many lines.<br> Lots of lines.");
|
||||||
panel5.add(warningOptionPane, BorderLayout.CENTER);
|
panel5.add(warningOptionPane, BorderLayout.CENTER);
|
||||||
}
|
}
|
||||||
panel9.add(panel5, "cell 1 4");
|
panel9.add(panel5, "cell 1 4");
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ new FormModel {
|
|||||||
name: "warningOptionPane"
|
name: "warningOptionPane"
|
||||||
"messageType": 2
|
"messageType": 2
|
||||||
"optionType": 2
|
"optionType": 2
|
||||||
"message": "Beware of the dog!"
|
"message": "<html>I like <b>bold</b>,<br> and I like <i>italic</i>,<br> and I like to have<br> many lines.<br> Lots of lines."
|
||||||
}, new FormLayoutConstraints( class java.lang.String ) {
|
}, new FormLayoutConstraints( class java.lang.String ) {
|
||||||
"value": "Center"
|
"value": "Center"
|
||||||
} )
|
} )
|
||||||
|
|||||||
Reference in New Issue
Block a user