diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserDetailsViewIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserDetailsViewIcon.java
new file mode 100644
index 00000000..9293124a
--- /dev/null
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserDetailsViewIcon.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2019 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
+ *
+ * http://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.icons;
+
+import java.awt.Component;
+import java.awt.Graphics2D;
+import javax.swing.UIManager;
+
+/**
+ * "details view" icon for {@link javax.swing.JFileChooser}.
+ *
+ * @uiDefault FileChooser.icon.detailsViewColor Color
+ *
+ * @author Karl Tauber
+ */
+public class FlatFileChooserDetailsViewIcon
+ extends FlatAbstractIcon
+{
+ public FlatFileChooserDetailsViewIcon() {
+ super( 16, 16, UIManager.getColor( "FileChooser.icon.detailsViewColor" ) );
+ }
+
+ @Override
+ protected void paintIcon( Component c, Graphics2D g ) {
+ /*
+
+ */
+
+ g.fillRect( 3, 3, 4, 4 );
+ g.fillRect( 3, 9, 4, 4 );
+ g.fillRect( 9, 9, 4, 4 );
+ g.fillRect( 9, 3, 4, 4 );
+ }
+}
diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserHomeFolderIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserHomeFolderIcon.java
new file mode 100644
index 00000000..281870c7
--- /dev/null
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserHomeFolderIcon.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2019 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
+ *
+ * http://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.icons;
+
+import java.awt.Component;
+import java.awt.Graphics2D;
+import javax.swing.UIManager;
+import com.formdev.flatlaf.ui.FlatUIUtils;
+
+/**
+ * "home folder" icon for {@link javax.swing.JFileChooser}.
+ *
+ * @uiDefault FileChooser.icon.homeFolderColor Color
+ *
+ * @author Karl Tauber
+ */
+public class FlatFileChooserHomeFolderIcon
+ extends FlatAbstractIcon
+{
+ public FlatFileChooserHomeFolderIcon() {
+ super( 16, 16, UIManager.getColor( "FileChooser.icon.homeFolderColor" ) );
+ }
+
+ @Override
+ protected void paintIcon( Component c, Graphics2D g ) {
+ /*
+
+ */
+
+ g.fill( FlatUIUtils.createPath( 2,8, 8,2, 14,8, 12,8, 12,13, 9,13, 9,10, 7,10, 7,13, 4,13, 4,8 ) );
+ }
+}
diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserListViewIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserListViewIcon.java
new file mode 100644
index 00000000..cc744b7d
--- /dev/null
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserListViewIcon.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2019 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
+ *
+ * http://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.icons;
+
+import java.awt.Component;
+import java.awt.Graphics2D;
+import javax.swing.UIManager;
+
+/**
+ * "list view" icon for {@link javax.swing.JFileChooser}.
+ *
+ * @uiDefault FileChooser.icon.listViewColor Color
+ *
+ * @author Karl Tauber
+ */
+public class FlatFileChooserListViewIcon
+ extends FlatAbstractIcon
+{
+ public FlatFileChooserListViewIcon() {
+ super( 16, 16, UIManager.getColor( "FileChooser.icon.listViewColor" ) );
+ }
+
+ @Override
+ protected void paintIcon( Component c, Graphics2D g ) {
+ /*
+
+ */
+
+ g.fillRect( 2, 3, 2, 2 );
+ g.fillRect( 2, 7, 2, 2 );
+ g.fillRect( 2, 11, 2, 2 );
+ g.fillRect( 6, 3, 8, 2 );
+ g.fillRect( 6, 7, 8, 2 );
+ g.fillRect( 6, 11, 8, 2 );
+ }
+}
diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserNewFolderIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserNewFolderIcon.java
new file mode 100644
index 00000000..efcfaa61
--- /dev/null
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserNewFolderIcon.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2019 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
+ *
+ * http://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.icons;
+
+import java.awt.Component;
+import java.awt.Graphics2D;
+import javax.swing.UIManager;
+import com.formdev.flatlaf.ui.FlatUIUtils;
+
+/**
+ * "new folder" icon for {@link javax.swing.JFileChooser}.
+ *
+ * @uiDefault FileChooser.icon.newFolderColor Color
+ *
+ * @author Karl Tauber
+ */
+public class FlatFileChooserNewFolderIcon
+ extends FlatAbstractIcon
+{
+ public FlatFileChooserNewFolderIcon() {
+ super( 16, 16, UIManager.getColor( "FileChooser.icon.newFolderColor" ) );
+ }
+
+ @Override
+ protected void paintIcon( Component c, Graphics2D g ) {
+ /*
+
+ */
+
+ g.fill( FlatUIUtils.createPath( 2,3, 5.5,3, 7,5, 14,5, 14,8, 11,8, 11,10, 9,10, 9,13, 2,13 ) );
+ g.fill( FlatUIUtils.createPath( 14,11, 16,11, 16,13, 14,13, 14,15, 12,15, 12,13, 10,13, 10,11, 12,11, 12,9, 14,9, 14,11 ) );
+ }
+}
diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserUpFolderIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserUpFolderIcon.java
new file mode 100644
index 00000000..ecbfc647
--- /dev/null
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatFileChooserUpFolderIcon.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2019 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
+ *
+ * http://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.icons;
+
+import java.awt.Component;
+import java.awt.Graphics2D;
+import javax.swing.UIManager;
+import com.formdev.flatlaf.ui.FlatUIUtils;
+
+/**
+ * "up folder" icon for {@link javax.swing.JFileChooser}.
+ *
+ * @uiDefault FileChooser.icon.upFolderColor Color
+ *
+ * @author Karl Tauber
+ */
+public class FlatFileChooserUpFolderIcon
+ extends FlatAbstractIcon
+{
+ public FlatFileChooserUpFolderIcon() {
+ super( 16, 16, UIManager.getColor( "FileChooser.icon.upFolderColor" ) );
+ }
+
+ @Override
+ protected void paintIcon( Component c, Graphics2D g ) {
+ /*
+
+ */
+
+ g.fill( FlatUIUtils.createPath( 2,3, 5.5,3, 7,5, 9,5, 9,9, 13,9, 13,5, 14,5, 14,13, 2,13 ) );
+ g.fill( FlatUIUtils.createPath( 12,4, 12,8, 10,8, 10,4, 8,4, 11,1, 14,4, 12,4 ) );
+ }
+}
diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java
index 5fae4ccb..ef15be0c 100644
--- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java
+++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java
@@ -168,6 +168,15 @@ public class FlatUIUtils
return rect;
}
+ public static Path2D createPath( double... points ) {
+ Path2D path = new Path2D.Float();
+ path.moveTo( points[0], points[1] );
+ for( int i = 2; i < points.length; i += 2 )
+ path.lineTo( points[i], points[i + 1] );
+ path.closePath();
+ return path;
+ }
+
/**
* Replacement for SwingUtilities2.drawStringUnderlineCharAt()
*/
diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties
index 0e7352b8..f9a11c90 100644
--- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties
+++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties
@@ -104,6 +104,21 @@ EditorPane.background=@textComponentBackground
EditorPane.margin=@textComponentMargin
+#---- FileChooser ----
+
+FileChooser.newFolderIcon=com.formdev.flatlaf.icons.FlatFileChooserNewFolderIcon
+FileChooser.upFolderIcon=com.formdev.flatlaf.icons.FlatFileChooserUpFolderIcon
+FileChooser.homeFolderIcon=com.formdev.flatlaf.icons.FlatFileChooserHomeFolderIcon
+FileChooser.detailsViewIcon=com.formdev.flatlaf.icons.FlatFileChooserDetailsViewIcon
+FileChooser.listViewIcon=com.formdev.flatlaf.icons.FlatFileChooserListViewIcon
+
+FileChooser.icon.newFolderColor=@icon
+FileChooser.icon.upFolderColor=@icon
+FileChooser.icon.homeFolderColor=@icon
+FileChooser.icon.detailsViewColor=@icon
+FileChooser.icon.listViewColor=@icon
+
+
#---- FormattedTextField ----
FormattedTextField.border=com.formdev.flatlaf.ui.FlatBorder
diff --git a/flatlaf-core/src/test/java/com/formdev/flatlaf/FlatChooserTest.java b/flatlaf-core/src/test/java/com/formdev/flatlaf/FlatChooserTest.java
index 1083a768..c3570cf0 100644
--- a/flatlaf-core/src/test/java/com/formdev/flatlaf/FlatChooserTest.java
+++ b/flatlaf-core/src/test/java/com/formdev/flatlaf/FlatChooserTest.java
@@ -38,6 +38,8 @@ public class FlatChooserTest
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JLabel colorChooserLabel = new JLabel();
JColorChooser colorChooser1 = new JColorChooser();
+ JLabel fileChooserLabel = new JLabel();
+ JFileChooser fileChooser1 = new JFileChooser();
//======== this ========
setLayout(new MigLayout(
@@ -46,12 +48,18 @@ public class FlatChooserTest
"[]" +
"[]",
// rows
+ "[top]" +
"[top]"));
//---- colorChooserLabel ----
colorChooserLabel.setText("JColorChooser:");
add(colorChooserLabel, "cell 0 0");
add(colorChooser1, "cell 1 0");
+
+ //---- fileChooserLabel ----
+ fileChooserLabel.setText("JFileChooser:");
+ add(fileChooserLabel, "cell 0 1");
+ add(fileChooser1, "cell 1 1");
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
diff --git a/flatlaf-core/src/test/java/com/formdev/flatlaf/FlatChooserTest.jfd b/flatlaf-core/src/test/java/com/formdev/flatlaf/FlatChooserTest.jfd
index 35dae4ff..24cb7847 100644
--- a/flatlaf-core/src/test/java/com/formdev/flatlaf/FlatChooserTest.jfd
+++ b/flatlaf-core/src/test/java/com/formdev/flatlaf/FlatChooserTest.jfd
@@ -9,7 +9,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5,ltr"
"$columnConstraints": "[][]"
- "$rowConstraints": "[top]"
+ "$rowConstraints": "[top][top]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
@@ -23,6 +23,17 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
+ add( new FormComponent( "javax.swing.JLabel" ) {
+ name: "fileChooserLabel"
+ "text": "JFileChooser:"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 0 1"
+ } )
+ add( new FormComponent( "javax.swing.JFileChooser" ) {
+ name: "fileChooser1"
+ }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
+ "value": "cell 1 1"
+ } )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 790, 715 )
diff --git a/flatlaf-core/svg/FileChooserDetailsViewIcon.svg b/flatlaf-core/svg/FileChooserDetailsViewIcon.svg
new file mode 100644
index 00000000..069275e1
--- /dev/null
+++ b/flatlaf-core/svg/FileChooserDetailsViewIcon.svg
@@ -0,0 +1,8 @@
+
diff --git a/flatlaf-core/svg/FileChooserHomeFolderIcon.svg b/flatlaf-core/svg/FileChooserHomeFolderIcon.svg
new file mode 100644
index 00000000..e2599d40
--- /dev/null
+++ b/flatlaf-core/svg/FileChooserHomeFolderIcon.svg
@@ -0,0 +1,3 @@
+
diff --git a/flatlaf-core/svg/FileChooserListViewIcon.svg b/flatlaf-core/svg/FileChooserListViewIcon.svg
new file mode 100644
index 00000000..dda96e57
--- /dev/null
+++ b/flatlaf-core/svg/FileChooserListViewIcon.svg
@@ -0,0 +1,10 @@
+
diff --git a/flatlaf-core/svg/FileChooserNewFolderIcon.svg b/flatlaf-core/svg/FileChooserNewFolderIcon.svg
new file mode 100644
index 00000000..59c59a83
--- /dev/null
+++ b/flatlaf-core/svg/FileChooserNewFolderIcon.svg
@@ -0,0 +1,6 @@
+
diff --git a/flatlaf-core/svg/FileChooserUpFolderIcon.svg b/flatlaf-core/svg/FileChooserUpFolderIcon.svg
new file mode 100644
index 00000000..f5a072ef
--- /dev/null
+++ b/flatlaf-core/svg/FileChooserUpFolderIcon.svg
@@ -0,0 +1,6 @@
+
diff --git a/flatlaf-core/svg/FlatLaf Icons.sketch b/flatlaf-core/svg/FlatLaf Icons.sketch
index 4f5261a2..0f1539f7 100644
Binary files a/flatlaf-core/svg/FlatLaf Icons.sketch and b/flatlaf-core/svg/FlatLaf Icons.sketch differ