Skip to content

Commit

Permalink
ToolTip: fixed drop shadow for wide tooltips (issue #224; regression …
Browse files Browse the repository at this point in the history
…since fixed issue #142)
  • Loading branch information
DevCharly committed Dec 15, 2020
1 parent 8bb8883 commit 5155ec9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ FlatLaf Change Log
as row header in scroll pane. (issues #152 and #46)
- TableHeader: Fixed position of column separators in right-to-left component
orientation.
- ToolTip: Fixed drop shadow for wide tooltips on Windows and Java 9+. (issue
#224)
- SwingX: Fixed striping background highlighting color (e.g. alternating table
rows) in dark themes.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,17 @@ public void show() {

// increase tooltip size if necessary because it may be too small on HiDPI screens
// https://bugs.openjdk.java.net/browse/JDK-8213535
if( contents instanceof JToolTip ) {
if( contents instanceof JToolTip && popupWindow == null ) {
Container parent = contents.getParent();
if( parent instanceof JPanel ) {
Dimension prefSize = parent.getPreferredSize();
if( !prefSize.equals( parent.getSize() ) ) {
Container panel = SwingUtilities.getAncestorOfClass( Panel.class, parent );
if( panel != null )
panel.setSize( prefSize ); // for medium weight popup
else
parent.setSize( prefSize ); // for light weight popup
Container mediumWeightPanel = SwingUtilities.getAncestorOfClass( Panel.class, parent );
Container c = (mediumWeightPanel != null)
? mediumWeightPanel // medium weight popup
: parent; // light weight popup
c.setSize( prefSize );
c.validate();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ private void initComponents() {

//---- toggleButton1 ----
toggleButton1.setText("Enabled");
toggleButton1.setToolTipText("LOOOOOOOOOOOOOONG TEXT");
add(toggleButton1, "cell 1 2");

//---- toggleButton9 ----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ new FormModel {
add( new FormComponent( "javax.swing.JToggleButton" ) {
name: "toggleButton1"
"text": "Enabled"
"toolTipText": "LOOOOOOOOOOOOOONG TEXT"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
Expand Down

0 comments on commit 5155ec9

Please sign in to comment.