diff --git a/CHANGELOG.md b/CHANGELOG.md index eab0cae0..52587209 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ FlatLaf Change Log - IntelliJ Themes: - Updated to latest versions and fixed various issues. - Support customizing through properties files. (issue #824) +- SwingX: Support `JXTipOfTheDay` component. (issue #980) #### Fixed bugs diff --git a/flatlaf-swingx/README.md b/flatlaf-swingx/README.md index 0951e3c1..073ea926 100644 --- a/flatlaf-swingx/README.md +++ b/flatlaf-swingx/README.md @@ -16,6 +16,7 @@ this addon: - `JXMonthView` - `JXTaskPaneContainer` - `JXTaskPane` +- `JXTipOfTheDay` - `JXTitledPanel` ![Flat Light SwingX Demo](../images/FlatLightSwingXTest.png) diff --git a/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/icons/FlatTipOfTheDayIcon.java b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/icons/FlatTipOfTheDayIcon.java new file mode 100644 index 00000000..0ab814e7 --- /dev/null +++ b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/icons/FlatTipOfTheDayIcon.java @@ -0,0 +1,81 @@ +/* + * Copyright 2025 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.swingx.icons; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics2D; +import java.awt.geom.Rectangle2D; +import javax.swing.UIManager; +import com.formdev.flatlaf.icons.FlatAbstractIcon; +import com.formdev.flatlaf.ui.FlatUIUtils; + +/** + * "light bulb" icon for {@link org.jdesktop.swingx.JXTipOfTheDay}. + * + * @uiDefault TipOfTheDay.icon.bulbColor Color + * @uiDefault TipOfTheDay.icon.socketColor Color + * + * @author Karl Tauber + * @since 3.6 + */ +public class FlatTipOfTheDayIcon + extends FlatAbstractIcon +{ + protected final Color bulbColor = UIManager.getColor( "TipOfTheDay.icon.bulbColor" ); + protected final Color socketColor = UIManager.getColor( "TipOfTheDay.icon.socketColor" ); + + public FlatTipOfTheDayIcon() { + super( 24, 24, null ); + } + + @Override + protected void paintIcon( Component c, Graphics2D g ) { + /* source: https://intellij-icons.jetbrains.design/#AllIcons-expui-codeInsight-intentionBulb + + + + + + + */ + + // scale because SVG coordinates are for 16x16 icon, but this icon is 24x24 + g.scale( 1.5, 1.5 ); + + g.setColor( socketColor ); + g.fill( new Rectangle2D.Double( 5.70142, 12, 4.6, 1 ) ); + + // M6 14H10C10 14.5523 9.55228 15 9 15H7C6.44772 15 6 14.5523 6 14Z + g.fill( FlatUIUtils.createPath( + 6,14, 10,14, + FlatUIUtils.CURVE_TO, 10,14.5523, 9.55228,15, 9,15, + 7,15, + FlatUIUtils.CURVE_TO, 6.44772,15, 6,14.5523, 6,14 ) ); + + g.setColor( bulbColor ); + + // M10.8704 9.14748C12.0417 8.27221 12.8 6.87465 12.8 5.3C12.8 2.64903 10.6509 0.5 7.99995 0.5C5.34898 0.5 3.19995 2.64903 3.19995 5.3C3.19995 6.87464 3.95817 8.27218 5.12943 9.14746L5.49994 11H10.4999L10.8704 9.14748Z + g.fill( FlatUIUtils.createPath( + 10.8704,9.14748, + FlatUIUtils.CURVE_TO, 12.0417,8.27221, 12.8,6.87465, 12.8,5.3, + FlatUIUtils.CURVE_TO, 12.8,2.64903, 10.6509,0.5, 7.99995,0.5, + FlatUIUtils.CURVE_TO, 5.34898,0.5, 3.19995,2.64903, 3.19995,5.3, + FlatUIUtils.CURVE_TO, 3.19995,6.87464, 3.95817,8.27218, 5.12943,9.14746, + 5.49994,11, 10.4999,11, 10.8704,9.14748 ) ); + } +} diff --git a/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatTipOfTheDayUI.java b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatTipOfTheDayUI.java new file mode 100644 index 00000000..da81bd70 --- /dev/null +++ b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatTipOfTheDayUI.java @@ -0,0 +1,105 @@ +/* + * Copyright 2025 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.swingx.ui; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Insets; +import java.beans.PropertyChangeListener; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JScrollPane; +import javax.swing.UIManager; +import javax.swing.plaf.ComponentUI; +import javax.swing.text.JTextComponent; +import org.jdesktop.swingx.JXTipOfTheDay; +import org.jdesktop.swingx.plaf.basic.BasicTipOfTheDayUI; +import com.formdev.flatlaf.ui.FlatEmptyBorder; +import com.formdev.flatlaf.ui.FlatUIUtils; +import com.formdev.flatlaf.util.UIScale; + +/** + * Provides the Flat LaF UI delegate for {@link org.jdesktop.swingx.JXTipOfTheDay}. + * + * @author Karl Tauber + * @since 3.6 + */ +public class FlatTipOfTheDayUI + extends BasicTipOfTheDayUI +{ + public static ComponentUI createUI( JComponent c ) { + return new FlatTipOfTheDayUI( (JXTipOfTheDay) c ); + } + + public FlatTipOfTheDayUI( JXTipOfTheDay tipPane ) { + super( tipPane ); + } + + @Override + protected void installComponents() { + // removing (no longer needed) children when switching from other Laf (e.g. Metal) + // BasicTipOfTheDayUI adds new components in installComponents(), but never + // removes them when switching theme, which results in duplicate children + tipPane.removeAll(); + + super.installComponents(); + + Insets tipAreaInsets = UIManager.getInsets( "TipOfTheDay.tipAreaInsets" ); + if( tipAreaInsets != null ) + tipArea.setBorder( FlatUIUtils.nonUIResource( new FlatEmptyBorder( tipAreaInsets ) ) ); + } + + @Override + protected void uninstallComponents() { + super.uninstallComponents(); + + // BasicTipOfTheDayUI adds new components in installComponents(), but never + // removes them when switching theme, which results in duplicate children + tipPane.removeAll(); + } + + @Override + protected PropertyChangeListener createChangeListener() { + PropertyChangeListener superListener = super.createChangeListener(); + return e -> { + superListener.propertyChange( e ); + + if( "model".equals( e.getPropertyName() ) ) + showCurrentTip(); + }; + } + + @Override + public Dimension getPreferredSize( JComponent c ) { + return UIScale.scale( super.getPreferredSize( c ) ); + } + + @Override + protected void showCurrentTip() { + super.showCurrentTip(); + + if( currentTipComponent instanceof JScrollPane ) { + JScrollPane scrollPane = (JScrollPane) currentTipComponent; + if( scrollPane.getBorder() == null ) + scrollPane.setBorder( BorderFactory.createEmptyBorder() ); + + Component view = scrollPane.getViewport().getView(); + if( view instanceof JTextComponent && ((JTextComponent)view).getBorder() == null ) + ((JTextComponent)view).setBorder( BorderFactory.createEmptyBorder() ); + } + } +} diff --git a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties index c4243b72..f956c44a 100644 --- a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties +++ b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties @@ -77,3 +77,9 @@ TaskPane.titleOver = #888 TaskPane.specialTitleBackground = #afafaf TaskPane.specialTitleForeground = #222 TaskPane.specialTitleOver = #666 + + +#---- TipOfTheDay ---- + +TipOfTheDay.icon.bulbColor = #F2C55C +TipOfTheDay.icon.socketColor = #CED0D6 diff --git a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLaf.properties b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLaf.properties index 1ea97f34..f5c784b4 100644 --- a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLaf.properties +++ b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLaf.properties @@ -22,6 +22,7 @@ HeaderUI = com.formdev.flatlaf.swingx.ui.FlatHeaderUI HyperlinkUI = com.formdev.flatlaf.swingx.ui.FlatHyperlinkUI MonthViewUI = com.formdev.flatlaf.swingx.ui.FlatMonthViewUI swingx/TaskPaneUI = com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI +swingx/TipOfTheDayUI = com.formdev.flatlaf.swingx.ui.FlatTipOfTheDayUI TitledPanelUI = com.formdev.flatlaf.swingx.ui.FlatTitledPanelUI @@ -76,3 +77,12 @@ SearchField.popupPressedIcon = lazy(SearchField.popupIcon) SearchField.clearIcon = com.formdev.flatlaf.icons.FlatClearIcon SearchField.clearRolloverIcon = lazy(SearchField.clearIcon) SearchField.clearPressedIcon = lazy(SearchField.clearIcon) + + +#---- TipOfTheDay ---- + +TipOfTheDay.background = @componentBackground +TipOfTheDay.border = 1,1,1,1,$Component.borderColor +TipOfTheDay.tipAreaInsets = 4,16,4,16 +TipOfTheDay.icon = com.formdev.flatlaf.swingx.icons.FlatTipOfTheDayIcon +TipOfTheDay.font = +0 diff --git a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties index b10ab028..d744e64c 100644 --- a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties +++ b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties @@ -77,3 +77,9 @@ TaskPane.titleOver = #666 TaskPane.specialTitleBackground = #afafaf TaskPane.specialTitleForeground = #222 TaskPane.specialTitleOver = #666 + + +#---- TipOfTheDay ---- + +TipOfTheDay.icon.bulbColor = #FFAF0F +TipOfTheDay.icon.socketColor = #6C707E diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt index 9a59f3b3..7ecb6604 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0.txt @@ -1239,6 +1239,17 @@ TextPane.selectionForeground #eeeeee HSL 0 0 93 javax.swing.plaf.Colo TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI +#---- TipOfTheDay ---- + +TipOfTheDay.background #46494b HSL 204 3 28 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#616365 HSL 210 2 39 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000 +TipOfTheDay.font [active] $defaultFont [UI] +TipOfTheDay.icon [lazy] 24,24 com.formdev.flatlaf.swingx.icons.FlatTipOfTheDayIcon [UI] +TipOfTheDay.icon.bulbColor #f2c55c HSL 42 85 65 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.icon.socketColor #ced0d6 HSL 225 9 82 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.tipAreaInsets 4,16,4,16 javax.swing.plaf.InsetsUIResource [UI] + + #---- TitlePane ---- TitlePane.background #303234 HSL 210 4 20 javax.swing.plaf.ColorUIResource [UI] @@ -1620,6 +1631,11 @@ small.font [active] Segoe UI plain 10 javax.swing.plaf.Fo swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI +#---- swingx/TipOfTheDay ---- + +swingx/TipOfTheDayUI com.formdev.flatlaf.swingx.ui.FlatTipOfTheDayUI + + #---- ---- text #46494b HSL 204 3 28 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt index 8aaca77d..b11db57d 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0.txt @@ -1244,6 +1244,17 @@ TextPane.selectionForeground #ffffff HSL 0 0 100 javax.swing.plaf.Colo TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI +#---- TipOfTheDay ---- + +TipOfTheDay.background #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#c2c2c2 HSL 0 0 76 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000 +TipOfTheDay.font [active] $defaultFont [UI] +TipOfTheDay.icon [lazy] 24,24 com.formdev.flatlaf.swingx.icons.FlatTipOfTheDayIcon [UI] +TipOfTheDay.icon.bulbColor #ffaf0f HSL 40 100 53 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.icon.socketColor #6c707e HSL 227 8 46 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.tipAreaInsets 4,16,4,16 javax.swing.plaf.InsetsUIResource [UI] + + #---- TitlePane ---- TitlePane.background #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] @@ -1625,6 +1636,11 @@ small.font [active] Segoe UI plain 10 javax.swing.plaf.Fo swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI +#---- swingx/TipOfTheDay ---- + +swingx/TipOfTheDayUI com.formdev.flatlaf.swingx.ui.FlatTipOfTheDayUI + + #---- ---- text #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatMacDarkLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatMacDarkLaf_1.8.0.txt index 2f2465b4..be41dff7 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatMacDarkLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatMacDarkLaf_1.8.0.txt @@ -1249,6 +1249,17 @@ TextPane.selectionForeground #ffffff HSL 0 0 100 javax.swing.plaf.Colo TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI +#---- TipOfTheDay ---- + +TipOfTheDay.background #282828 HSL 0 0 16 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#ffffff19 10% HSLA 0 0 100 10 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000 +TipOfTheDay.font [active] $defaultFont [UI] +TipOfTheDay.icon [lazy] 24,24 com.formdev.flatlaf.swingx.icons.FlatTipOfTheDayIcon [UI] +TipOfTheDay.icon.bulbColor #f2c55c HSL 42 85 65 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.icon.socketColor #ced0d6 HSL 225 9 82 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.tipAreaInsets 4,16,4,16 javax.swing.plaf.InsetsUIResource [UI] + + #---- TitlePane ---- TitlePane.background #323232 HSL 0 0 20 javax.swing.plaf.ColorUIResource [UI] @@ -1630,6 +1641,11 @@ small.font [active] Segoe UI plain 10 javax.swing.plaf.Fo swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI +#---- swingx/TipOfTheDay ---- + +swingx/TipOfTheDayUI com.formdev.flatlaf.swingx.ui.FlatTipOfTheDayUI + + #---- ---- text #282828 HSL 0 0 16 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatMacLightLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatMacLightLaf_1.8.0.txt index 822c7bff..e99b2145 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatMacLightLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatMacLightLaf_1.8.0.txt @@ -1253,6 +1253,17 @@ TextPane.selectionForeground #262626 HSL 0 0 15 javax.swing.plaf.Colo TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI +#---- TipOfTheDay ---- + +TipOfTheDay.background #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#00000026 15% HSLA 0 0 0 15 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000 +TipOfTheDay.font [active] $defaultFont [UI] +TipOfTheDay.icon [lazy] 24,24 com.formdev.flatlaf.swingx.icons.FlatTipOfTheDayIcon [UI] +TipOfTheDay.icon.bulbColor #ffaf0f HSL 40 100 53 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.icon.socketColor #6c707e HSL 227 8 46 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.tipAreaInsets 4,16,4,16 javax.swing.plaf.InsetsUIResource [UI] + + #---- TitlePane ---- TitlePane.background #ececec HSL 0 0 93 javax.swing.plaf.ColorUIResource [UI] @@ -1634,6 +1645,11 @@ small.font [active] Segoe UI plain 10 javax.swing.plaf.Fo swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI +#---- swingx/TipOfTheDay ---- + +swingx/TipOfTheDayUI com.formdev.flatlaf.swingx.ui.FlatTipOfTheDayUI + + #---- ---- text #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt index 02081b47..d08a43b5 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0.txt @@ -1289,6 +1289,15 @@ TextPane.selectionForeground #ffff00 HSL 60 100 50 javax.swing.plaf.Colo TextPaneUI com.formdev.flatlaf.ui.FlatTextPaneUI +#---- TipOfTheDay ---- + +TipOfTheDay.background #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] +TipOfTheDay.border [lazy] 1,1,1,1 false com.formdev.flatlaf.ui.FlatLineBorder [UI] lineColor=#ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] lineThickness=1.000000 +TipOfTheDay.font [active] $defaultFont [UI] +TipOfTheDay.icon [lazy] 24,24 com.formdev.flatlaf.swingx.icons.FlatTipOfTheDayIcon [UI] +TipOfTheDay.tipAreaInsets 4,16,4,16 javax.swing.plaf.InsetsUIResource [UI] + + #---- TitlePane ---- TitlePane.background #00ff00 HSL 120 100 50 javax.swing.plaf.ColorUIResource [UI] @@ -1679,6 +1688,11 @@ small.font [active] Segoe UI plain 10 javax.swing.plaf.Fo swingx/TaskPaneUI com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI +#---- swingx/TipOfTheDay ---- + +swingx/TipOfTheDayUI com.formdev.flatlaf.swingx.ui.FlatTipOfTheDayUI + + #---- ---- text #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXTest.java index aef4ce5d..3767beb8 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXTest.java @@ -24,6 +24,9 @@ import javax.swing.table.*; import net.miginfocom.swing.*; import org.jdesktop.swingx.*; import org.jdesktop.swingx.table.DatePickerCellEditor; +import org.jdesktop.swingx.tips.DefaultTip; +import org.jdesktop.swingx.tips.DefaultTipOfTheDayModel; +import org.jdesktop.swingx.tips.TipOfTheDayModel.Tip; import com.formdev.flatlaf.testing.FlatTestFrame; import com.formdev.flatlaf.testing.FlatTestPanel; @@ -69,6 +72,10 @@ public class FlatSwingXTest JProgressBar statusProgressBar = new JProgressBar(); statusProgressBar.setValue( 50 ); statusBar1.add( statusProgressBar, new JXStatusBar.Constraint( JXStatusBar.Constraint.ResizeBehavior.FILL ) ); + + xTipOfTheDay1.setModel( new DefaultTipOfTheDayModel( new Tip[] { + new DefaultTip( "testTip", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." ) + } ) ); } private void busyChanged() { @@ -77,6 +84,11 @@ public class FlatSwingXTest xBusyLabel2.setBusy( busy ); } + private void showTipOfTheDayDialog() { + JXTipOfTheDay tipOfTheDay = new JXTipOfTheDay( xTipOfTheDay1.getModel() ); + tipOfTheDay.showDialog( this ); + } + private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents JLabel label1 = new JLabel(); @@ -138,6 +150,9 @@ public class FlatSwingXTest JXSearchField xSearchField4 = new JXSearchField(); JLabel label12 = new JLabel(); statusBar1 = new JXStatusBar(); + JLabel label13 = new JLabel(); + xTipOfTheDay1 = new JXTipOfTheDay(); + JButton showTipOfTheDayDialogButton = new JButton(); JButton button1 = new JButton(); JButton button2 = new JButton(); @@ -163,6 +178,7 @@ public class FlatSwingXTest "[]" + "[]" + "[]" + + "[top]" + "[37]")); //---- label1 ---- @@ -471,6 +487,16 @@ public class FlatSwingXTest add(label12, "cell 0 11"); add(statusBar1, "cell 1 11 3 1,grow"); + //---- label13 ---- + label13.setText("JXTipOfTheDay:"); + add(label13, "cell 0 12"); + add(xTipOfTheDay1, "cell 1 12 3 1"); + + //---- showTipOfTheDayDialogButton ---- + showTipOfTheDayDialogButton.setText("Show Dialog..."); + showTipOfTheDayDialogButton.addActionListener(e -> showTipOfTheDayDialog()); + add(showTipOfTheDayDialogButton, "cell 1 12 3 1"); + //---- button1 ---- button1.setText("<"); @@ -492,5 +518,6 @@ public class FlatSwingXTest private JCheckBox busyCheckBox; private JTable table; private JXStatusBar statusBar1; + private JXTipOfTheDay xTipOfTheDay1; // JFormDesigner - End of variables declaration //GEN-END:variables } diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXTest.jfd index aacfbab7..f8b1ee36 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/swingx/FlatSwingXTest.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.5.0.404" Java: "17" encoding: "UTF-8" +JFDML JFormDesigner: "8.3" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -9,7 +9,7 @@ new FormModel { add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "ltr,insets dialog,hidemode 3" "$columnConstraints": "[left][][][][fill]" - "$rowConstraints": "[]0[][]0[top][][][][][][][][][37]" + "$rowConstraints": "[]0[][]0[top][][][][][][][][][top][37]" } ) { name: "this" add( new FormComponent( "javax.swing.JLabel" ) { @@ -402,9 +402,30 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 11 3 1,grow" } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label13" + "text": "JXTipOfTheDay:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 12" + } ) + add( new FormComponent( "org.jdesktop.swingx.JXTipOfTheDay" ) { + name: "xTipOfTheDay1" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 12 3 1" + } ) + add( new FormComponent( "javax.swing.JButton" ) { + name: "showTipOfTheDayDialogButton" + "text": "Show Dialog..." + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "showTipOfTheDayDialog", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 12 3 1" + } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) - "size": new java.awt.Dimension( 795, 600 ) + "size": new java.awt.Dimension( 900, 820 ) } ) add( new FormComponent( "javax.swing.JButton" ) { name: "button1" diff --git a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt index a4fbca03..6bdfa4d2 100644 --- a/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt +++ b/flatlaf-theme-editor/src/main/resources/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt @@ -1055,6 +1055,13 @@ TextPane.margin TextPane.selectionBackground TextPane.selectionForeground TextPaneUI +TipOfTheDay.background +TipOfTheDay.border +TipOfTheDay.font +TipOfTheDay.icon +TipOfTheDay.icon.bulbColor +TipOfTheDay.icon.socketColor +TipOfTheDay.tipAreaInsets TitlePane.background TitlePane.borderColor TitlePane.buttonHoverBackground @@ -1323,6 +1330,7 @@ scrollbar semibold.font small.font swingx/TaskPaneUI +swingx/TipOfTheDayUI text textHighlight textHighlightText