Compare commits

...

5 Commits
0.23 ... 0.23.1

Author SHA1 Message Date
Karl Tauber
d990ccc4ab release 0.23.1 2020-01-02 22:39:34 +01:00
Karl Tauber
9f16249898 IntelliJ Themes: fixed checkbox colors in Material UI Lite dark themes 2020-01-02 21:09:11 +01:00
Karl Tauber
62fc3139cf ComboBox: fixed NPE in Oracle SQL Developer settings 2020-01-02 18:45:32 +01:00
Karl Tauber
452452dcc9 Tree: fixed wide selection if scrolled horizontally 2019-12-31 09:49:56 +01:00
Karl Tauber
b6fb06bc65 CHANGELOG.md: added some missing changes form 0.23 2019-12-30 18:10:33 +01:00
10 changed files with 137 additions and 33 deletions

View File

@@ -1,6 +1,13 @@
FlatLaf Change Log FlatLaf Change Log
================== ==================
## 0.23.1
- Tree: Fixed wide selection if scrolled horizontally.
- ComboBox: Fixed NPE in Oracle SQL Developer settings.
- IntelliJ Themes: Fixed checkbox colors in Material UI Lite dark themes.
## 0.23 ## 0.23
- Updated colors in "Flat Light" and "Flat IntelliJ" themes with colors from - Updated colors in "Flat Light" and "Flat IntelliJ" themes with colors from
@@ -8,6 +15,8 @@ FlatLaf Change Log
platform colors. platform colors.
- Tree: Support wide selection (enabled by default). - Tree: Support wide selection (enabled by default).
- Table: Hide grid and changed intercell spacing to zero. - Table: Hide grid and changed intercell spacing to zero.
- List, Table and Tree: Added colors for drag-and-drop. Added "enable drag and
drop" checkbox to Demo on "Data Components" tab.
- List and Tree: Hide cell focus indicator (black rectangle) by default. Can be - List and Tree: Hide cell focus indicator (black rectangle) by default. Can be
enabled with `List.showCellFocusIndicator=true` / enabled with `List.showCellFocusIndicator=true` /
`Tree.showCellFocusIndicator=true`, but then the cell focus indicator is shown `Tree.showCellFocusIndicator=true`, but then the cell focus indicator is shown
@@ -23,6 +32,8 @@ FlatLaf Change Log
- Fixed link color (in HTML text) and separator color in IntelliJ platform - Fixed link color (in HTML text) and separator color in IntelliJ platform
themes. themes.
- Use logging instead of printing errors to `System.err`. - Use logging instead of printing errors to `System.err`.
- Updated IntelliJ Themes in demo to the latest versions.
- IntelliJ Themes: Fixed link and separator colors.
## 0.22 ## 0.22

View File

@@ -45,7 +45,7 @@ build script:
groupId: com.formdev groupId: com.formdev
artifactId: flatlaf artifactId: flatlaf
version: 0.23 version: 0.23.1
Otherwise download `flatlaf-<version>.jar` here: Otherwise download `flatlaf-<version>.jar` here:

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
version = "0.23" version = "0.23.1"
allprojects { allprojects {
repositories { repositories {

View File

@@ -355,33 +355,43 @@ public class IntelliJTheme
value = "#ffffff"; value = "#ffffff";
} }
String key2 = checkboxDuplicateColors.get( key );
if( dark ) if( dark )
key = StringUtils.removeTrailing( key, ".Dark" ); key = StringUtils.removeTrailing( key, ".Dark" );
String newKey = checkboxKeyMapping.get( key ); String newKey = checkboxKeyMapping.get( key );
if( newKey != null ) { if( newKey != null ) {
ColorUIResource color = toColor( (String) value ); ColorUIResource color = toColor( (String) value );
if( color != null ) if( color != null ) {
defaults.put( newKey, color ); defaults.put( newKey, color );
if( key2 != null ) {
// When IDEA replaces colors in SVGs it uses color values and not the keys
// from com.intellij.ide.ui.UITheme.colorPalette, but there are some keys that
// have same color value:
// - Checkbox.Background.Default.Dark has same color as Checkbox.Background.Selected.Dark
// - Checkbox.Border.Default.Dark has same color as Checkbox.Border.Selected.Dark
// - Checkbox.Focus.Thin.Default.Dark has same color as Checkbox.Focus.Thin.Selected.Dark
//
// So if only e.g. Checkbox.Background.Default.Dark is specified in .theme.json,
// then this color is also used for Checkbox.Background.Selected.Dark.
//
// If Checkbox.Background.Default.Dark and Checkbox.Background.Selected.Dark
// are specified in .theme.json, then the later specified is used for both.
if( dark )
key2 = StringUtils.removeTrailing( key2, ".Dark" );
String newKey2 = checkboxKeyMapping.get( key2 );
if( newKey2 != null )
defaults.put( newKey2, color );
}
}
checkboxModified = true; checkboxModified = true;
} }
} }
// When IDEA replaces colors in SVGs it uses color values and not the keys
// from com.intellij.ide.ui.UITheme.colorPalette, but there are some keys that
// have same color value:
// - Checkbox.Background.Default.Dark has same color as Checkbox.Background.Selected.Dark
// - Checkbox.Border.Default.Dark has same color as Checkbox.Border.Selected.Dark
// - Checkbox.Focus.Thin.Default.Dark has same color as Checkbox.Focus.Thin.Selected.Dark
//
// So if only e.g. Checkbox.Background.Default.Dark is specified in .theme.json,
// then this color is also used for Checkbox.Background.Selected.Dark.
// Occurs e.g. in "Dark purple" theme.
fixCheckBoxColor( defaults, colorPalette, "Checkbox.Background.Default.Dark", "Checkbox.Background.Selected.Dark" );
fixCheckBoxColor( defaults, colorPalette, "Checkbox.Border.Default.Dark", "Checkbox.Border.Selected.Dark" );
fixCheckBoxColor( defaults, colorPalette, "Checkbox.Focus.Thin.Default.Dark", "Checkbox.Focus.Thin.Selected.Dark" );
// remove hover and pressed colors // remove hover and pressed colors
if( checkboxModified ) { if( checkboxModified ) {
defaults.remove( "CheckBox.icon.hoverBorderColor" ); defaults.remove( "CheckBox.icon.hoverBorderColor" );
@@ -393,21 +403,10 @@ public class IntelliJTheme
} }
} }
private void fixCheckBoxColor( UIDefaults defaults, Map<String, Object> colorPalette, String key1, String key2 ) {
if( colorPalette.containsKey( key1 ) == colorPalette.containsKey( key2 ) )
return;
String newKey1 = checkboxKeyMapping.get( StringUtils.removeTrailing( key1, ".Dark" ) );
String newKey2 = checkboxKeyMapping.get( StringUtils.removeTrailing( key2, ".Dark" ) );
if( colorPalette.containsKey( key1 ) )
defaults.put( newKey2, defaults.get( newKey1 ) );
else
defaults.put( newKey1, defaults.get( newKey2 ) );
}
private static Map<String, String> uiKeyMapping = new HashMap<>(); private static Map<String, String> uiKeyMapping = new HashMap<>();
private static Map<String, String> uiKeyInverseMapping = new HashMap<>(); private static Map<String, String> uiKeyInverseMapping = new HashMap<>();
private static Map<String, String> checkboxKeyMapping = new HashMap<>(); private static Map<String, String> checkboxKeyMapping = new HashMap<>();
private static Map<String, String> checkboxDuplicateColors = new HashMap<>();
private static Set<String> noWildcardReplace = new HashSet<>(); private static Set<String> noWildcardReplace = new HashSet<>();
static { static {
@@ -453,6 +452,14 @@ public class IntelliJTheme
checkboxKeyMapping.put( "Checkbox.Foreground.Selected", "CheckBox.icon.checkmarkColor" ); checkboxKeyMapping.put( "Checkbox.Foreground.Selected", "CheckBox.icon.checkmarkColor" );
checkboxKeyMapping.put( "Checkbox.Focus.Thin.Selected", "CheckBox.icon.selectedFocusedBorderColor" ); checkboxKeyMapping.put( "Checkbox.Focus.Thin.Selected", "CheckBox.icon.selectedFocusedBorderColor" );
checkboxDuplicateColors.put( "Checkbox.Background.Default.Dark", "Checkbox.Background.Selected.Dark" );
checkboxDuplicateColors.put( "Checkbox.Border.Default.Dark", "Checkbox.Border.Selected.Dark" );
checkboxDuplicateColors.put( "Checkbox.Focus.Thin.Default.Dark", "Checkbox.Focus.Thin.Selected.Dark" );
@SuppressWarnings( "unchecked" )
Map.Entry<String, String>[] entries = checkboxDuplicateColors.entrySet().toArray( new Map.Entry[checkboxDuplicateColors.size()] );
for( Map.Entry<String, String> e : entries )
checkboxDuplicateColors.put( e.getValue(), e.getKey() );
// because FlatLaf uses Button.background and Button.borderColor, // because FlatLaf uses Button.background and Button.borderColor,
// but IDEA uses Button.startBackground and Button.startBorderColor, // but IDEA uses Button.startBackground and Button.startBorderColor,
// our default button background and border colors may be replaced by // our default button background and border colors may be replaced by

View File

@@ -36,6 +36,7 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JComboBox; import javax.swing.JComboBox;
import javax.swing.JComponent; import javax.swing.JComponent;
@@ -348,6 +349,8 @@ public class FlatComboBoxUI
public void paintCurrentValue( Graphics g, Rectangle bounds, boolean hasFocus ) { public void paintCurrentValue( Graphics g, Rectangle bounds, boolean hasFocus ) {
ListCellRenderer<Object> renderer = comboBox.getRenderer(); ListCellRenderer<Object> renderer = comboBox.getRenderer();
uninstallCellPaddingBorder( renderer ); uninstallCellPaddingBorder( renderer );
if( renderer == null )
renderer = new DefaultListCellRenderer();
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() ); c.applyComponentOrientation( comboBox.getComponentOrientation() );
@@ -520,6 +523,8 @@ public class FlatComboBoxUI
CellPaddingBorder.uninstall( renderer ); CellPaddingBorder.uninstall( renderer );
CellPaddingBorder.uninstall( lastRendererComponent ); CellPaddingBorder.uninstall( lastRendererComponent );
if( renderer == null )
renderer = new DefaultListCellRenderer();
Component c = renderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus ); Component c = renderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
c.applyComponentOrientation( comboBox.getComponentOrientation() ); c.applyComponentOrientation( comboBox.getComponentOrientation() );

View File

@@ -232,7 +232,7 @@ public class FlatTreeUI
g.setColor( isDropRow g.setColor( isDropRow
? UIManager.getColor( "Tree.dropCellBackground" ) ? UIManager.getColor( "Tree.dropCellBackground" )
: (hasFocus ? selectionBackground : selectionInactiveBackground) ); : (hasFocus ? selectionBackground : selectionInactiveBackground) );
g.fillRect( 0, bounds.y, clipBounds.width, bounds.height ); g.fillRect( 0, bounds.y, tree.getWidth(), bounds.height );
// paint expand/collapse icon // paint expand/collapse icon
if( shouldPaintExpandControl( path, row, isExpanded, hasBeenExpanded, isLeaf ) ) { if( shouldPaintExpandControl( path, row, isExpanded, hasBeenExpanded, isLeaf ) ) {

View File

@@ -21,6 +21,7 @@ import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import javax.swing.*; import javax.swing.*;
import javax.swing.table.*; import javax.swing.table.*;
import javax.swing.tree.*;
import net.miginfocom.swing.*; import net.miginfocom.swing.*;
/** /**
@@ -171,6 +172,32 @@ class DataComponentsPanel
//---- tree1 ---- //---- tree1 ----
tree1.setShowsRootHandles(true); tree1.setShowsRootHandles(true);
tree1.setEditable(true); tree1.setEditable(true);
tree1.setModel(new DefaultTreeModel(
new DefaultMutableTreeNode("JTree") {
{
DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("colors");
node1.add(new DefaultMutableTreeNode("blue"));
node1.add(new DefaultMutableTreeNode("violet"));
node1.add(new DefaultMutableTreeNode("red"));
node1.add(new DefaultMutableTreeNode("yellow"));
add(node1);
node1 = new DefaultMutableTreeNode("sports");
node1.add(new DefaultMutableTreeNode("basketball"));
node1.add(new DefaultMutableTreeNode("soccer"));
node1.add(new DefaultMutableTreeNode("football"));
node1.add(new DefaultMutableTreeNode("hockey"));
add(node1);
node1 = new DefaultMutableTreeNode("food");
node1.add(new DefaultMutableTreeNode("hot dogs"));
DefaultMutableTreeNode node2 = new DefaultMutableTreeNode("pizza");
node2.add(new DefaultMutableTreeNode("pizza aglio e olio"));
node2.add(new DefaultMutableTreeNode("pizza margherita bianca"));
node1.add(node2);
node1.add(new DefaultMutableTreeNode("ravioli"));
node1.add(new DefaultMutableTreeNode("bananas"));
add(node1);
}
}));
scrollPane3.setViewportView(tree1); scrollPane3.setViewportView(tree1);
} }
add(scrollPane3, "cell 1 1,growx"); add(scrollPane3, "cell 1 1,growx");

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8" JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
new FormModel { new FormModel {
contentType: "form/swing" contentType: "form/swing"
@@ -89,6 +89,60 @@ new FormModel {
name: "tree1" name: "tree1"
"showsRootHandles": true "showsRootHandles": true
"editable": true "editable": true
"model": new javax.swing.tree.DefaultTreeModel( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "JTree"
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "colors"
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "blue"
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "violet"
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "red"
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "yellow"
} )
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "sports"
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "basketball"
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "soccer"
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "football"
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "hockey"
} )
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "food"
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "hot dogs"
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "pizza"
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "pizza aglio e olio"
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "pizza margherita bianca"
} )
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "ravioli"
} )
add( new javax.swing.tree.DefaultMutableTreeNode {
userObject: "bananas"
} )
} )
} )
auxiliary() { auxiliary() {
"JavaCodeGenerator.variableLocal": false "JavaCodeGenerator.variableLocal": false
} }

View File

@@ -26,7 +26,7 @@ build script:
groupId: com.formdev groupId: com.formdev
artifactId: flatlaf-jide-oss artifactId: flatlaf-jide-oss
version: 0.23 version: 0.23.1
Otherwise download `flatlaf-jide-oss-<version>.jar` here: Otherwise download `flatlaf-jide-oss-<version>.jar` here:

View File

@@ -33,7 +33,7 @@ build script:
groupId: com.formdev groupId: com.formdev
artifactId: flatlaf-swingx artifactId: flatlaf-swingx
version: 0.23 version: 0.23.1
Otherwise download `flatlaf-swingx-<version>.jar` here: Otherwise download `flatlaf-swingx-<version>.jar` here: