mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6438e890bb | ||
|
|
7d72b13ac9 | ||
|
|
a2e21cb07b | ||
|
|
06766cb4db | ||
|
|
72e8ab70a3 | ||
|
|
0f38af5922 | ||
|
|
4181759008 | ||
|
|
fff0e5e946 | ||
|
|
be88eeb343 | ||
|
|
342b932f9e | ||
|
|
964dc14a8a | ||
|
|
b56f462626 |
17
CHANGELOG.md
17
CHANGELOG.md
@@ -1,6 +1,23 @@
|
|||||||
FlatLaf Change Log
|
FlatLaf Change Log
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
## 0.16
|
||||||
|
|
||||||
|
- Made some fixes for right-to-left support in ComboBox, Slider and ToolTip.
|
||||||
|
(issue #18)
|
||||||
|
- Fixed Java 9 module descriptor (broken since 0.14).
|
||||||
|
- Made `JButton`, `JCheckBox`, `JRadioButton`, `JToggleButton` and `JSlider`
|
||||||
|
non-opaque. (issue #20)
|
||||||
|
|
||||||
|
|
||||||
|
## 0.15
|
||||||
|
|
||||||
|
- ToolTip: Improved styling of dark tooltips (darker background, no border).
|
||||||
|
- ToolTip: Fixed colors in tooltips of disabled components. (issue #15)
|
||||||
|
- ComboBox: Fixed NPE in combobox with custom renderer after switching to
|
||||||
|
FlatLaf. (issue #16; regression in 0.14)
|
||||||
|
|
||||||
|
|
||||||
## 0.14
|
## 0.14
|
||||||
|
|
||||||
- ComboBox: Use small border if used as table editor.
|
- ComboBox: Use small border if used as table editor.
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ build script:
|
|||||||
|
|
||||||
groupId: com.formdev
|
groupId: com.formdev
|
||||||
artifactId: flatlaf
|
artifactId: flatlaf
|
||||||
version: 0.14
|
version: 0.16
|
||||||
|
|
||||||
Otherwise download `flatlaf-<version>.jar` here:
|
Otherwise download `flatlaf-<version>.jar` here:
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
version = "0.14"
|
version = "0.16"
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ public class FlatButtonUI
|
|||||||
defaults_initialized = true;
|
defaults_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LookAndFeel.installProperty( b, "opaque", false );
|
||||||
LookAndFeel.installProperty( b, "iconTextGap", scale( iconTextGap ) );
|
LookAndFeel.installProperty( b, "iconTextGap", scale( iconTextGap ) );
|
||||||
|
|
||||||
MigLayoutVisualPadding.install( b, focusWidth );
|
MigLayoutVisualPadding.install( b, focusWidth );
|
||||||
@@ -169,15 +170,16 @@ public class FlatButtonUI
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update( Graphics g, JComponent c ) {
|
public void update( Graphics g, JComponent c ) {
|
||||||
if( isHelpButton( c ) ) {
|
// fill background if opaque to avoid garbage if user sets opaque to true
|
||||||
|
if( c.isOpaque() )
|
||||||
FlatUIUtils.paintParentBackground( g, c );
|
FlatUIUtils.paintParentBackground( g, c );
|
||||||
|
|
||||||
|
if( isHelpButton( c ) ) {
|
||||||
helpButtonIcon.paintIcon( c, g, 0, 0 );
|
helpButtonIcon.paintIcon( c, g, 0, 0 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( c.isOpaque() && isContentAreaFilled( c ) ) {
|
if( isContentAreaFilled( c ) ) {
|
||||||
FlatUIUtils.paintParentBackground( g, c );
|
|
||||||
|
|
||||||
Color background = getBackground( c );
|
Color background = getBackground( c );
|
||||||
if( background != null ) {
|
if( background != null ) {
|
||||||
Graphics2D g2 = (Graphics2D) g.create();
|
Graphics2D g2 = (Graphics2D) g.create();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package com.formdev.flatlaf.ui;
|
|||||||
import static com.formdev.flatlaf.util.UIScale.scale;
|
import static com.formdev.flatlaf.util.UIScale.scale;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
import java.awt.ComponentOrientation;
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
@@ -213,6 +214,9 @@ public class FlatComboBoxUI
|
|||||||
{
|
{
|
||||||
// fix editor component colors
|
// fix editor component colors
|
||||||
updateEditorColors();
|
updateEditorColors();
|
||||||
|
} else if( editor != null && source == comboBox && propertyName == "componentOrientation" ) {
|
||||||
|
ComponentOrientation o = (ComponentOrientation) e.getNewValue();
|
||||||
|
editor.applyComponentOrientation( o );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -235,6 +239,8 @@ public class FlatComboBoxUI
|
|||||||
if( editor instanceof JTextComponent )
|
if( editor instanceof JTextComponent )
|
||||||
((JTextComponent)editor).setBorder( BorderFactory.createEmptyBorder() );
|
((JTextComponent)editor).setBorder( BorderFactory.createEmptyBorder() );
|
||||||
|
|
||||||
|
editor.applyComponentOrientation( comboBox.getComponentOrientation() );
|
||||||
|
|
||||||
updateEditorColors();
|
updateEditorColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,6 +321,7 @@ public class FlatComboBoxUI
|
|||||||
CellPaddingBorder.uninstall( renderer );
|
CellPaddingBorder.uninstall( renderer );
|
||||||
Component c = renderer.getListCellRendererComponent( listBox, comboBox.getSelectedItem(), -1, false, false );
|
Component c = renderer.getListCellRendererComponent( listBox, comboBox.getSelectedItem(), -1, false, false );
|
||||||
c.setFont( comboBox.getFont() );
|
c.setFont( comboBox.getFont() );
|
||||||
|
c.applyComponentOrientation( comboBox.getComponentOrientation() );
|
||||||
CellPaddingBorder.uninstall( c );
|
CellPaddingBorder.uninstall( c );
|
||||||
|
|
||||||
boolean enabled = comboBox.isEnabled();
|
boolean enabled = comboBox.isEnabled();
|
||||||
@@ -370,10 +377,18 @@ public class FlatComboBoxUI
|
|||||||
extends BasicComboPopup
|
extends BasicComboPopup
|
||||||
{
|
{
|
||||||
private CellPaddingBorder paddingBorder;
|
private CellPaddingBorder paddingBorder;
|
||||||
private final ListCellRenderer renderer = new PopupListCellRenderer();
|
|
||||||
|
|
||||||
FlatComboPopup( JComboBox combo ) {
|
FlatComboPopup( JComboBox combo ) {
|
||||||
super( combo );
|
super( combo );
|
||||||
|
|
||||||
|
// BasicComboPopup listens to JComboBox.componentOrientation and updates
|
||||||
|
// the component orientation of the list, scroller and popup, but when
|
||||||
|
// switching the LaF and a new combo popup is created, the component
|
||||||
|
// orientation is not applied.
|
||||||
|
ComponentOrientation o = comboBox.getComponentOrientation();
|
||||||
|
list.setComponentOrientation( o );
|
||||||
|
scroller.setComponentOrientation( o );
|
||||||
|
setComponentOrientation( o );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -387,7 +402,13 @@ public class FlatComboBoxUI
|
|||||||
comboBox.setPrototypeDisplayValue( prototype );
|
comboBox.setPrototypeDisplayValue( prototype );
|
||||||
|
|
||||||
// make popup wider if necessary
|
// make popup wider if necessary
|
||||||
pw = Math.max( pw, displaySize.width );
|
if( displaySize.width > pw ) {
|
||||||
|
int diff = displaySize.width - pw;
|
||||||
|
pw = displaySize.width;
|
||||||
|
|
||||||
|
if( !comboBox.getComponentOrientation().isLeftToRight() )
|
||||||
|
px -= diff;
|
||||||
|
}
|
||||||
|
|
||||||
return super.computePopupBounds( px, py, pw, ph );
|
return super.computePopupBounds( px, py, pw, ph );
|
||||||
}
|
}
|
||||||
@@ -405,7 +426,7 @@ public class FlatComboBoxUI
|
|||||||
protected void configureList() {
|
protected void configureList() {
|
||||||
super.configureList();
|
super.configureList();
|
||||||
|
|
||||||
list.setCellRenderer( renderer );
|
list.setCellRenderer( new PopupListCellRenderer() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -416,7 +437,7 @@ public class FlatComboBoxUI
|
|||||||
super.propertyChange( e );
|
super.propertyChange( e );
|
||||||
|
|
||||||
if( e.getPropertyName() == "renderer" )
|
if( e.getPropertyName() == "renderer" )
|
||||||
list.setCellRenderer( renderer );
|
list.setCellRenderer( new PopupListCellRenderer() );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -434,6 +455,7 @@ public class FlatComboBoxUI
|
|||||||
CellPaddingBorder.uninstall( renderer );
|
CellPaddingBorder.uninstall( renderer );
|
||||||
|
|
||||||
Component c = renderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
|
Component c = renderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
|
||||||
|
c.applyComponentOrientation( comboBox.getComponentOrientation() );
|
||||||
|
|
||||||
if( c instanceof JComponent ) {
|
if( c instanceof JComponent ) {
|
||||||
if( paddingBorder == null )
|
if( paddingBorder == null )
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ public class FlatRadioButtonUI
|
|||||||
defaults_initialized = true;
|
defaults_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LookAndFeel.installProperty( b, "opaque", false );
|
||||||
LookAndFeel.installProperty( b, "iconTextGap", scale( iconTextGap ) );
|
LookAndFeel.installProperty( b, "iconTextGap", scale( iconTextGap ) );
|
||||||
|
|
||||||
MigLayoutVisualPadding.install( b, null );
|
MigLayoutVisualPadding.install( b, null );
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import java.awt.geom.Path2D;
|
|||||||
import java.awt.geom.RoundRectangle2D;
|
import java.awt.geom.RoundRectangle2D;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JSlider;
|
import javax.swing.JSlider;
|
||||||
|
import javax.swing.LookAndFeel;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import javax.swing.plaf.ComponentUI;
|
import javax.swing.plaf.ComponentUI;
|
||||||
import javax.swing.plaf.basic.BasicSliderUI;
|
import javax.swing.plaf.basic.BasicSliderUI;
|
||||||
@@ -96,6 +97,8 @@ public class FlatSliderUI
|
|||||||
protected void installDefaults( JSlider slider ) {
|
protected void installDefaults( JSlider slider ) {
|
||||||
super.installDefaults( slider );
|
super.installDefaults( slider );
|
||||||
|
|
||||||
|
LookAndFeel.installProperty( slider, "opaque", false );
|
||||||
|
|
||||||
trackWidth = UIManager.getInt( "Slider.trackWidth" );
|
trackWidth = UIManager.getInt( "Slider.trackWidth" );
|
||||||
thumbWidth = UIManager.getInt( "Slider.thumbWidth" );
|
thumbWidth = UIManager.getInt( "Slider.thumbWidth" );
|
||||||
|
|
||||||
@@ -170,9 +173,15 @@ public class FlatSliderUI
|
|||||||
if( slider.getOrientation() == JSlider.HORIZONTAL ) {
|
if( slider.getOrientation() == JSlider.HORIZONTAL ) {
|
||||||
float y = trackRect.y + (trackRect.height - tw) / 2f;
|
float y = trackRect.y + (trackRect.height - tw) / 2f;
|
||||||
if( enabled && isRoundThumb() ) {
|
if( enabled && isRoundThumb() ) {
|
||||||
|
if( slider.getComponentOrientation().isLeftToRight() ) {
|
||||||
int cw = thumbRect.x + (thumbRect.width / 2) - trackRect.x;
|
int cw = thumbRect.x + (thumbRect.width / 2) - trackRect.x;
|
||||||
coloredTrack = new RoundRectangle2D.Float( trackRect.x, y, cw, tw, arc, arc );
|
coloredTrack = new RoundRectangle2D.Float( trackRect.x, y, cw, tw, arc, arc );
|
||||||
track = new RoundRectangle2D.Float( trackRect.x + cw, y, trackRect.width - cw, tw, arc, arc );
|
track = new RoundRectangle2D.Float( trackRect.x + cw, y, trackRect.width - cw, tw, arc, arc );
|
||||||
|
} else {
|
||||||
|
int cw = trackRect.x + trackRect.width - thumbRect.x - (thumbRect.width / 2);
|
||||||
|
coloredTrack = new RoundRectangle2D.Float( trackRect.x + trackRect.width - cw, y, cw, tw, arc, arc );
|
||||||
|
track = new RoundRectangle2D.Float( trackRect.x, y, trackRect.width - cw, tw, arc, arc );
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
track = new RoundRectangle2D.Float( trackRect.x, y, trackRect.width, tw, arc, arc );
|
track = new RoundRectangle2D.Float( trackRect.x, y, trackRect.width, tw, arc, arc );
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -74,11 +74,14 @@ public class FlatToolTipUI
|
|||||||
List<String> lines = FlatLaf.split( ((JToolTip)c).getTipText(), '\n' );
|
List<String> lines = FlatLaf.split( ((JToolTip)c).getTipText(), '\n' );
|
||||||
|
|
||||||
int x = insets.left;
|
int x = insets.left;
|
||||||
|
int x2 = c.getWidth() - insets.right;
|
||||||
int y = insets.top - fm.getDescent();
|
int y = insets.top - fm.getDescent();
|
||||||
int lineHeight = fm.getHeight();
|
int lineHeight = fm.getHeight();
|
||||||
|
JComponent comp = ((JToolTip)c).getComponent();
|
||||||
|
boolean leftToRight = (comp != null ? comp : c).getComponentOrientation().isLeftToRight();
|
||||||
for( String line : lines ) {
|
for( String line : lines ) {
|
||||||
y += lineHeight;
|
y += lineHeight;
|
||||||
g.drawString( line, x, y );
|
g.drawString( line, leftToRight ? x : x2 - SwingUtilities.computeStringWidth( fm, line ), y );
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
super.paint( g, c );
|
super.paint( g, c );
|
||||||
|
|||||||
@@ -24,4 +24,6 @@ module com.formdev.flatlaf {
|
|||||||
exports com.formdev.flatlaf.icons;
|
exports com.formdev.flatlaf.icons;
|
||||||
exports com.formdev.flatlaf.ui;
|
exports com.formdev.flatlaf.ui;
|
||||||
exports com.formdev.flatlaf.util;
|
exports com.formdev.flatlaf.util;
|
||||||
|
|
||||||
|
uses com.formdev.flatlaf.FlatDefaultsAddon;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,7 +227,8 @@ ToggleButton.toolbar.selectedBackground=5c6164
|
|||||||
|
|
||||||
#---- ToolTip ----
|
#---- ToolTip ----
|
||||||
|
|
||||||
ToolTip.background=4b4d4d
|
ToolTip.border=4,6,4,6
|
||||||
|
ToolTip.background=1e2123
|
||||||
|
|
||||||
|
|
||||||
#---- Tree ----
|
#---- Tree ----
|
||||||
|
|||||||
@@ -409,7 +409,10 @@ ToolBar.separatorColor=@@Separator.foreground
|
|||||||
|
|
||||||
#---- ToolTip ----
|
#---- ToolTip ----
|
||||||
|
|
||||||
ToolTip.border=2,6,2,6,@@Component.borderColor
|
ToolTip.border=4,6,4,6,@@Component.borderColor
|
||||||
|
ToolTip.borderInactive=null
|
||||||
|
ToolTip.backgroundInactive=@@ToolTip.background
|
||||||
|
ToolTip.foregroundInactive=@disabledText
|
||||||
|
|
||||||
|
|
||||||
#---- Tree ----
|
#---- Tree ----
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ ToggleButton.toolbar.selectedBackground=cfcfcf
|
|||||||
|
|
||||||
#---- ToolTip ----
|
#---- ToolTip ----
|
||||||
|
|
||||||
ToolTip.background=f7f7f7
|
ToolTip.background=fafafa
|
||||||
|
|
||||||
|
|
||||||
#---- Tree ----
|
#---- Tree ----
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ public class FlatChooserTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
|
SwingUtilities.invokeLater( () -> {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatChooserTest" );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatChooserTest" );
|
||||||
frame.showFrame( new FlatChooserTest() );
|
frame.showFrame( new FlatChooserTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatChooserTest() {
|
FlatChooserTest() {
|
||||||
|
|||||||
@@ -27,8 +27,10 @@ public class FlatComponents2Test
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
|
SwingUtilities.invokeLater( () -> {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponents2Test" );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponents2Test" );
|
||||||
frame.showFrame( new FlatComponents2Test() );
|
frame.showFrame( new FlatComponents2Test() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatComponents2Test() {
|
FlatComponents2Test() {
|
||||||
|
|||||||
@@ -28,8 +28,10 @@ public class FlatComponentsTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
|
SwingUtilities.invokeLater( () -> {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponentsTest" );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatComponentsTest" );
|
||||||
frame.showFrame( new FlatComponentsTest() );
|
frame.showFrame( new FlatComponentsTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatComponentsTest() {
|
FlatComponentsTest() {
|
||||||
@@ -230,17 +232,20 @@ public class FlatComponentsTest
|
|||||||
//---- button1 ----
|
//---- button1 ----
|
||||||
button1.setText("enabled");
|
button1.setText("enabled");
|
||||||
button1.setDisplayedMnemonicIndex(0);
|
button1.setDisplayedMnemonicIndex(0);
|
||||||
|
button1.setToolTipText("This button is enabled.");
|
||||||
add(button1, "cell 1 1");
|
add(button1, "cell 1 1");
|
||||||
|
|
||||||
//---- button2 ----
|
//---- button2 ----
|
||||||
button2.setText("disabled");
|
button2.setText("disabled");
|
||||||
button2.setDisplayedMnemonicIndex(0);
|
button2.setDisplayedMnemonicIndex(0);
|
||||||
button2.setEnabled(false);
|
button2.setEnabled(false);
|
||||||
|
button2.setToolTipText("This button is disabled.");
|
||||||
add(button2, "cell 2 1");
|
add(button2, "cell 2 1");
|
||||||
|
|
||||||
//---- button5 ----
|
//---- button5 ----
|
||||||
button5.setText("default");
|
button5.setText("default");
|
||||||
button5.setDisplayedMnemonicIndex(0);
|
button5.setDisplayedMnemonicIndex(0);
|
||||||
|
button5.setToolTipText("Tool tip with\nmultiple\nlines.");
|
||||||
add(button5, "cell 3 1");
|
add(button5, "cell 3 1");
|
||||||
|
|
||||||
//---- button3 ----
|
//---- button3 ----
|
||||||
@@ -344,7 +349,15 @@ public class FlatComponentsTest
|
|||||||
"editable",
|
"editable",
|
||||||
"a",
|
"a",
|
||||||
"bb",
|
"bb",
|
||||||
"ccc"
|
"ccc",
|
||||||
|
"dd",
|
||||||
|
"e",
|
||||||
|
"ff",
|
||||||
|
"ggg",
|
||||||
|
"hh",
|
||||||
|
"i",
|
||||||
|
"jj",
|
||||||
|
"kkk"
|
||||||
}));
|
}));
|
||||||
add(comboBox1, "cell 1 5,growx");
|
add(comboBox1, "cell 1 5,growx");
|
||||||
|
|
||||||
@@ -364,7 +377,15 @@ public class FlatComponentsTest
|
|||||||
"not editable",
|
"not editable",
|
||||||
"a",
|
"a",
|
||||||
"bb",
|
"bb",
|
||||||
"ccc"
|
"ccc",
|
||||||
|
"dd",
|
||||||
|
"e",
|
||||||
|
"ff",
|
||||||
|
"ggg",
|
||||||
|
"hh",
|
||||||
|
"i",
|
||||||
|
"jj",
|
||||||
|
"kkk"
|
||||||
}));
|
}));
|
||||||
add(comboBox3, "cell 3 5,growx");
|
add(comboBox3, "cell 3 5,growx");
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ new FormModel {
|
|||||||
name: "button1"
|
name: "button1"
|
||||||
"text": "enabled"
|
"text": "enabled"
|
||||||
"displayedMnemonicIndex": 0
|
"displayedMnemonicIndex": 0
|
||||||
|
"toolTipText": "This button is enabled."
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 1"
|
"value": "cell 1 1"
|
||||||
} )
|
} )
|
||||||
@@ -51,6 +52,7 @@ new FormModel {
|
|||||||
"text": "disabled"
|
"text": "disabled"
|
||||||
"displayedMnemonicIndex": 0
|
"displayedMnemonicIndex": 0
|
||||||
"enabled": false
|
"enabled": false
|
||||||
|
"toolTipText": "This button is disabled."
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 2 1"
|
"value": "cell 2 1"
|
||||||
} )
|
} )
|
||||||
@@ -58,6 +60,7 @@ new FormModel {
|
|||||||
name: "button5"
|
name: "button5"
|
||||||
"text": "default"
|
"text": "default"
|
||||||
"displayedMnemonicIndex": 0
|
"displayedMnemonicIndex": 0
|
||||||
|
"toolTipText": "Tool tip with\nmultiple\nlines."
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 3 1"
|
"value": "cell 3 1"
|
||||||
} )
|
} )
|
||||||
@@ -203,6 +206,14 @@ new FormModel {
|
|||||||
addElement( "a" )
|
addElement( "a" )
|
||||||
addElement( "bb" )
|
addElement( "bb" )
|
||||||
addElement( "ccc" )
|
addElement( "ccc" )
|
||||||
|
addElement( "dd" )
|
||||||
|
addElement( "e" )
|
||||||
|
addElement( "ff" )
|
||||||
|
addElement( "ggg" )
|
||||||
|
addElement( "hh" )
|
||||||
|
addElement( "i" )
|
||||||
|
addElement( "jj" )
|
||||||
|
addElement( "kkk" )
|
||||||
}
|
}
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 5,growx"
|
"value": "cell 1 5,growx"
|
||||||
@@ -229,6 +240,14 @@ new FormModel {
|
|||||||
addElement( "a" )
|
addElement( "a" )
|
||||||
addElement( "bb" )
|
addElement( "bb" )
|
||||||
addElement( "ccc" )
|
addElement( "ccc" )
|
||||||
|
addElement( "dd" )
|
||||||
|
addElement( "e" )
|
||||||
|
addElement( "ff" )
|
||||||
|
addElement( "ggg" )
|
||||||
|
addElement( "hh" )
|
||||||
|
addElement( "i" )
|
||||||
|
addElement( "jj" )
|
||||||
|
addElement( "kkk" )
|
||||||
}
|
}
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 3 5,growx"
|
"value": "cell 3 5,growx"
|
||||||
|
|||||||
@@ -17,8 +17,10 @@ public class FlatContainerTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
|
SwingUtilities.invokeLater( () -> {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatContainerTest" );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatContainerTest" );
|
||||||
frame.showFrame( new FlatContainerTest() );
|
frame.showFrame( new FlatContainerTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlatContainerTest() {
|
public FlatContainerTest() {
|
||||||
|
|||||||
@@ -239,6 +239,7 @@ public class FlatInspector
|
|||||||
text += "Enabled: " + c.isEnabled() + '\n';
|
text += "Enabled: " + c.isEnabled() + '\n';
|
||||||
text += "Opaque: " + c.isOpaque() + '\n';
|
text += "Opaque: " + c.isOpaque() + '\n';
|
||||||
text += "Focusable: " + c.isFocusable() + '\n';
|
text += "Focusable: " + c.isFocusable() + '\n';
|
||||||
|
text += "Left-to-right: " + c.getComponentOrientation().isLeftToRight() + '\n';
|
||||||
text += "Parent: " + c.getParent().getClass().getName();
|
text += "Parent: " + c.getParent().getClass().getName();
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
|
|||||||
@@ -29,8 +29,10 @@ public class FlatMenusTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
|
SwingUtilities.invokeLater( () -> {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatMenusTest" );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatMenusTest" );
|
||||||
frame.showFrame( new FlatMenusTest() );
|
frame.showFrame( new FlatMenusTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatMenusTest() {
|
FlatMenusTest() {
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ public class FlatOptionPaneTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
|
SwingUtilities.invokeLater( () -> {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatOptionPaneTest" );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatOptionPaneTest" );
|
||||||
frame.showFrame( new FlatOptionPaneTest() );
|
frame.showFrame( new FlatOptionPaneTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatOptionPaneTest() {
|
FlatOptionPaneTest() {
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ public class FlatTestFrame
|
|||||||
private JComponent content;
|
private JComponent content;
|
||||||
private FlatInspector inspector;
|
private FlatInspector inspector;
|
||||||
|
|
||||||
|
public boolean useApplyComponentOrientation;
|
||||||
|
|
||||||
public static FlatTestFrame create( String[] args, String title ) {
|
public static FlatTestFrame create( String[] args, String title ) {
|
||||||
Preferences prefs = Preferences.userRoot().node( PREFS_ROOT_PATH );
|
Preferences prefs = Preferences.userRoot().node( PREFS_ROOT_PATH );
|
||||||
|
|
||||||
@@ -307,9 +309,17 @@ public class FlatTestFrame
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void rightToLeftChanged() {
|
private void rightToLeftChanged() {
|
||||||
contentPanel.applyComponentOrientation( rightToLeftCheckBox.isSelected()
|
ComponentOrientation orientation = rightToLeftCheckBox.isSelected()
|
||||||
? ComponentOrientation.RIGHT_TO_LEFT
|
? ComponentOrientation.RIGHT_TO_LEFT
|
||||||
: ComponentOrientation.LEFT_TO_RIGHT );
|
: ComponentOrientation.LEFT_TO_RIGHT;
|
||||||
|
|
||||||
|
if( useApplyComponentOrientation )
|
||||||
|
content.applyComponentOrientation( orientation );
|
||||||
|
else {
|
||||||
|
updateComponentsRecur( content, (c, type) -> {
|
||||||
|
c.setComponentOrientation( orientation );
|
||||||
|
} );
|
||||||
|
}
|
||||||
contentPanel.revalidate();
|
contentPanel.revalidate();
|
||||||
contentPanel.repaint();
|
contentPanel.repaint();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
@selectionBackground=00aa00
|
@selectionBackground=00aa00
|
||||||
@selectionInactiveBackground=888888
|
@selectionInactiveBackground=888888
|
||||||
@selectionInactiveForeground=ffffff
|
@selectionInactiveForeground=ffffff
|
||||||
|
@disabledText=000088
|
||||||
@textComponentBackground=ffffff
|
@textComponentBackground=ffffff
|
||||||
@cellFocusColor=ff0000
|
@cellFocusColor=ff0000
|
||||||
@icon=afafaf
|
@icon=afafaf
|
||||||
@@ -37,8 +38,8 @@
|
|||||||
*.selectionBackground=@selectionBackground
|
*.selectionBackground=@selectionBackground
|
||||||
*.selectionForeground=ffff00
|
*.selectionForeground=ffff00
|
||||||
*.disabledBackground=e0e0e0
|
*.disabledBackground=e0e0e0
|
||||||
*.disabledForeground=000088
|
*.disabledForeground=@disabledText
|
||||||
*.disabledText=000088
|
*.disabledText=@disabledText
|
||||||
*.acceleratorForeground=ff8888
|
*.acceleratorForeground=ff8888
|
||||||
*.acceleratorSelectionForeground=ffffff
|
*.acceleratorSelectionForeground=ffffff
|
||||||
|
|
||||||
|
|||||||
@@ -205,18 +205,37 @@ class DemoFrame
|
|||||||
//======== toolBar1 ========
|
//======== toolBar1 ========
|
||||||
{
|
{
|
||||||
toolBar1.setMargin(new Insets(3, 3, 3, 3));
|
toolBar1.setMargin(new Insets(3, 3, 3, 3));
|
||||||
|
|
||||||
|
//---- backButton ----
|
||||||
|
backButton.setToolTipText("Back");
|
||||||
toolBar1.add(backButton);
|
toolBar1.add(backButton);
|
||||||
|
|
||||||
|
//---- forwardButton ----
|
||||||
|
forwardButton.setToolTipText("Forward");
|
||||||
toolBar1.add(forwardButton);
|
toolBar1.add(forwardButton);
|
||||||
toolBar1.addSeparator();
|
toolBar1.addSeparator();
|
||||||
|
|
||||||
|
//---- cutButton ----
|
||||||
|
cutButton.setToolTipText("Cut");
|
||||||
toolBar1.add(cutButton);
|
toolBar1.add(cutButton);
|
||||||
|
|
||||||
|
//---- copyButton ----
|
||||||
|
copyButton.setToolTipText("Copy");
|
||||||
toolBar1.add(copyButton);
|
toolBar1.add(copyButton);
|
||||||
|
|
||||||
|
//---- pasteButton ----
|
||||||
|
pasteButton.setToolTipText("Paste");
|
||||||
toolBar1.add(pasteButton);
|
toolBar1.add(pasteButton);
|
||||||
toolBar1.addSeparator();
|
toolBar1.addSeparator();
|
||||||
|
|
||||||
|
//---- refreshButton ----
|
||||||
|
refreshButton.setToolTipText("Refresh");
|
||||||
toolBar1.add(refreshButton);
|
toolBar1.add(refreshButton);
|
||||||
toolBar1.addSeparator();
|
toolBar1.addSeparator();
|
||||||
|
|
||||||
//---- showToggleButton ----
|
//---- showToggleButton ----
|
||||||
showToggleButton.setSelected(true);
|
showToggleButton.setSelected(true);
|
||||||
|
showToggleButton.setToolTipText("Show Details");
|
||||||
toolBar1.add(showToggleButton);
|
toolBar1.add(showToggleButton);
|
||||||
}
|
}
|
||||||
contentPane.add(toolBar1, BorderLayout.NORTH);
|
contentPane.add(toolBar1, BorderLayout.NORTH);
|
||||||
|
|||||||
@@ -17,27 +17,33 @@ new FormModel {
|
|||||||
"margin": new java.awt.Insets( 3, 3, 3, 3 )
|
"margin": new java.awt.Insets( 3, 3, 3, 3 )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "backButton"
|
name: "backButton"
|
||||||
|
"toolTipText": "Back"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "forwardButton"
|
name: "forwardButton"
|
||||||
|
"toolTipText": "Forward"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JToolBar$Separator" ) {
|
add( new FormComponent( "javax.swing.JToolBar$Separator" ) {
|
||||||
name: "separator5"
|
name: "separator5"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "cutButton"
|
name: "cutButton"
|
||||||
|
"toolTipText": "Cut"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "copyButton"
|
name: "copyButton"
|
||||||
|
"toolTipText": "Copy"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "pasteButton"
|
name: "pasteButton"
|
||||||
|
"toolTipText": "Paste"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JToolBar$Separator" ) {
|
add( new FormComponent( "javax.swing.JToolBar$Separator" ) {
|
||||||
name: "separator6"
|
name: "separator6"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "refreshButton"
|
name: "refreshButton"
|
||||||
|
"toolTipText": "Refresh"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JToolBar$Separator" ) {
|
add( new FormComponent( "javax.swing.JToolBar$Separator" ) {
|
||||||
name: "separator7"
|
name: "separator7"
|
||||||
@@ -45,6 +51,7 @@ new FormModel {
|
|||||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||||
name: "showToggleButton"
|
name: "showToggleButton"
|
||||||
"selected": true
|
"selected": true
|
||||||
|
"toolTipText": "Show Details"
|
||||||
} )
|
} )
|
||||||
}, new FormLayoutConstraints( class java.lang.String ) {
|
}, new FormLayoutConstraints( class java.lang.String ) {
|
||||||
"value": "North"
|
"value": "North"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.formdev.flatlaf.demo;
|
package com.formdev.flatlaf.demo;
|
||||||
|
|
||||||
import java.util.prefs.Preferences;
|
import java.util.prefs.Preferences;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import com.formdev.flatlaf.FlatLightLaf;
|
import com.formdev.flatlaf.FlatLightLaf;
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ public class FlatLafDemo
|
|||||||
static Preferences prefs;
|
static Preferences prefs;
|
||||||
|
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
|
SwingUtilities.invokeLater( () -> {
|
||||||
prefs = Preferences.userRoot().node( PREFS_ROOT_PATH );
|
prefs = Preferences.userRoot().node( PREFS_ROOT_PATH );
|
||||||
|
|
||||||
// set look and feel
|
// set look and feel
|
||||||
@@ -56,5 +58,6 @@ public class FlatLafDemo
|
|||||||
frame.pack();
|
frame.pack();
|
||||||
frame.setLocationRelativeTo( null );
|
frame.setLocationRelativeTo( null );
|
||||||
frame.setVisible( true );
|
frame.setVisible( true );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ addon:
|
|||||||
- `JXTaskPaneContainer`
|
- `JXTaskPaneContainer`
|
||||||
- `JXTaskPane`
|
- `JXTaskPane`
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
Download
|
Download
|
||||||
--------
|
--------
|
||||||
@@ -28,7 +32,7 @@ build script:
|
|||||||
|
|
||||||
groupId: com.formdev
|
groupId: com.formdev
|
||||||
artifactId: flatlaf-swingx
|
artifactId: flatlaf-swingx
|
||||||
version: 0.14
|
version: 0.16
|
||||||
|
|
||||||
Otherwise download `flatlaf-swingx-<version>.jar` here:
|
Otherwise download `flatlaf-swingx-<version>.jar` here:
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,11 @@ public class FlatSwingXTest
|
|||||||
extends JPanel
|
extends JPanel
|
||||||
{
|
{
|
||||||
public static void main( String[] args ) {
|
public static void main( String[] args ) {
|
||||||
|
SwingUtilities.invokeLater( () -> {
|
||||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatSwingXTest" );
|
FlatTestFrame frame = FlatTestFrame.create( args, "FlatSwingXTest" );
|
||||||
|
frame.useApplyComponentOrientation = true;
|
||||||
frame.showFrame( new FlatSwingXTest() );
|
frame.showFrame( new FlatSwingXTest() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
FlatSwingXTest() {
|
FlatSwingXTest() {
|
||||||
|
|||||||
BIN
images/FlatDarkSwingXTest.png
Normal file
BIN
images/FlatDarkSwingXTest.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
images/FlatLightSwingXTest.png
Normal file
BIN
images/FlatLightSwingXTest.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
Reference in New Issue
Block a user