diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameCloseIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameCloseIcon.java new file mode 100644 index 00000000..3471eece --- /dev/null +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameCloseIcon.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.BasicStroke; +import java.awt.Component; +import java.awt.Graphics2D; +import java.awt.geom.Line2D; +import java.awt.geom.Path2D; +import javax.swing.UIManager; + +/** + * "close" icon for {@link javax.swing.JInternalFrame}. + * + * @uiDefault InternalFrame.iconColor Color + * + * @author Karl Tauber + */ +public class FlatInternalFrameCloseIcon + extends FlatAbstractIcon +{ + public FlatInternalFrameCloseIcon() { + super( 16, 16, UIManager.getColor( "InternalFrame.iconColor" ) ); + } + + @Override + protected void paintIcon( Component c, Graphics2D g ) { + float mx = 8; + float my = 8; + float r = 3.25f; + + Path2D path = new Path2D.Float( Path2D.WIND_EVEN_ODD ); + path.append( new Line2D.Float( mx - r, my - r, mx + r, my + r ), false ); + path.append( new Line2D.Float( mx - r, my + r, mx + r, my - r ), false ); + g.setStroke( new BasicStroke( 1f ) ); + g.draw( path ); + } +} diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameIconifyIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameIconifyIcon.java new file mode 100644 index 00000000..2f59b283 --- /dev/null +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameIconifyIcon.java @@ -0,0 +1,41 @@ +/* + * 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; + +/** + * "iconify" icon for {@link javax.swing.JInternalFrame}. + * + * @uiDefault InternalFrame.iconColor Color + * + * @author Karl Tauber + */ +public class FlatInternalFrameIconifyIcon + extends FlatAbstractIcon +{ + public FlatInternalFrameIconifyIcon() { + super( 16, 16, UIManager.getColor( "InternalFrame.iconColor" ) ); + } + + @Override + protected void paintIcon( Component c, Graphics2D g ) { + g.fillRect( 3, 8, 10, 1 ); + } +} diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameMaximizeIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameMaximizeIcon.java new file mode 100644 index 00000000..3439e3de --- /dev/null +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameMaximizeIcon.java @@ -0,0 +1,42 @@ +/* + * 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; + +/** + * "maximize" icon for {@link javax.swing.JInternalFrame}. + * + * @uiDefault InternalFrame.iconColor Color + * + * @author Karl Tauber + */ +public class FlatInternalFrameMaximizeIcon + extends FlatAbstractIcon +{ + public FlatInternalFrameMaximizeIcon() { + super( 16, 16, UIManager.getColor( "InternalFrame.iconColor" ) ); + } + + @Override + protected void paintIcon( Component c, Graphics2D g ) { + g.fill( FlatUIUtils.createRectangle( 3, 3, 10, 10, 1 ) ); + } +} diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameMinimizeIcon.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameMinimizeIcon.java new file mode 100644 index 00000000..d829cfcc --- /dev/null +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/icons/FlatInternalFrameMinimizeIcon.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 java.awt.geom.Area; +import java.awt.geom.Path2D; +import java.awt.geom.Rectangle2D; +import javax.swing.UIManager; +import com.formdev.flatlaf.ui.FlatUIUtils; + +/** + * "minimize" (actually "restore") icon for {@link javax.swing.JInternalFrame}. + * + * @uiDefault InternalFrame.iconColor Color + * + * @author Karl Tauber + */ +public class FlatInternalFrameMinimizeIcon + extends FlatAbstractIcon +{ + public FlatInternalFrameMinimizeIcon() { + super( 16, 16, UIManager.getColor( "InternalFrame.iconColor" ) ); + } + + @Override + protected void paintIcon( Component c, Graphics2D g ) { + Path2D r1 = FlatUIUtils.createRectangle( 5, 3, 8, 8, 1 ); + Path2D r2 = FlatUIUtils.createRectangle( 3, 5, 8, 8, 1 ); + + Area area = new Area( r1 ); + area.subtract( new Area( new Rectangle2D.Float( 3, 5, 8, 8 ) ) ); + g.fill( area ); + + g.fill( r2 ); + } +} 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 b29d16bc..386cac0a 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 @@ -278,6 +278,17 @@ public class FlatUIUtils return null; } + /** + * Creates a not-filled rectangle shape with the given line width. + */ + public static Path2D createRectangle( float x, float y, float width, float height, float lineWidth ) { + Path2D path = new Path2D.Float( Path2D.WIND_EVEN_ODD ); + path.append( new Rectangle2D.Float( x, y, width, height ), false ); + path.append( new Rectangle2D.Float( x + lineWidth, y + lineWidth, + width - (lineWidth * 2), height - (lineWidth * 2) ), false ); + return path; + } + /** * Creates a not-filled rounded rectangle shape and allows specifying the line width and the radius or each corner. */