├── README.md
├── TimingFramework-0.55.jar
├── build.xml
├── build
└── classes
│ ├── .netbeans_automatic_build
│ ├── .netbeans_update_resources
│ └── javaswingdev
│ ├── card
│ ├── Card.class
│ ├── Card.form
│ ├── LabelIcon.class
│ └── ModelCard.class
│ ├── form
│ ├── Form_Dashboard$1.class
│ ├── Form_Dashboard.class
│ ├── Form_Dashboard.form
│ ├── Form_Empty.class
│ └── Form_Empty.form
│ ├── main
│ ├── Main$1.class
│ ├── Main$2.class
│ ├── Main.class
│ └── Main.form
│ ├── menu
│ ├── EventMenuSelected.class
│ ├── Item$1.class
│ ├── Item$2.class
│ ├── Item.class
│ ├── Menu$1.class
│ ├── Menu.class
│ ├── MenuItem$1.class
│ ├── MenuItem$2.class
│ ├── MenuItem$3.class
│ ├── MenuItem$4.class
│ ├── MenuItem$5.class
│ ├── MenuItem.class
│ └── ModelMenuItem.class
│ ├── swing
│ ├── RoundPanel.class
│ ├── scroll
│ │ ├── ModernScrollBarUI$InvisibleScrollBarButton.class
│ │ ├── ModernScrollBarUI.class
│ │ └── ScrollBar.class
│ ├── table
│ │ ├── Table$1.class
│ │ ├── Table$2.class
│ │ ├── Table.class
│ │ └── TableHeader.class
│ └── titlebar
│ │ ├── ComponentResizer.class
│ │ ├── TitleBar$1.class
│ │ ├── TitleBar$2.class
│ │ ├── TitleBar$3.class
│ │ ├── TitleBar$4.class
│ │ ├── TitleBar$5.class
│ │ ├── TitleBar$6.class
│ │ ├── TitleBar$Item.class
│ │ └── TitleBar.class
│ └── system
│ └── SystemColor.class
├── gradient-icon-font.jar
├── manifest.mf
├── miglayout-4.0.jar
├── nbproject
├── build-impl.xml
├── genfiles.properties
├── private
│ ├── private.properties
│ └── private.xml
├── project.properties
└── project.xml
└── src
└── javaswingdev
├── card
├── Card.form
├── Card.java
├── LabelIcon.java
└── ModelCard.java
├── form
├── Form_Dashboard.form
├── Form_Dashboard.java
├── Form_Empty.form
└── Form_Empty.java
├── main
├── Main.form
└── Main.java
├── menu
├── EventMenuSelected.java
├── Item.java
├── Menu.java
├── MenuItem.java
└── ModelMenuItem.java
├── swing
├── RoundPanel.java
├── scroll
│ ├── ModernScrollBarUI.java
│ └── ScrollBar.java
├── table
│ ├── Table.java
│ └── TableHeader.java
└── titlebar
│ ├── ComponentResizer.java
│ └── TitleBar.java
└── system
└── SystemColor.java
/README.md:
--------------------------------------------------------------------------------
1 | # java-ui-dashboard-011
2 | Date : 03/04/2022
3 | How to coding in java
4 | visit my youtube : https://www.youtube.com/c/HelloWorld-Raven/featured
5 |
6 | 
7 |
--------------------------------------------------------------------------------
/TimingFramework-0.55.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/TimingFramework-0.55.jar
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Builds, tests, and runs the project java-ui-dashboard-011.
12 |
13 |
73 |
74 |
--------------------------------------------------------------------------------
/build/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/build/classes/.netbeans_update_resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/.netbeans_update_resources
--------------------------------------------------------------------------------
/build/classes/javaswingdev/card/Card.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/card/Card.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/card/Card.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
78 |
--------------------------------------------------------------------------------
/build/classes/javaswingdev/card/LabelIcon.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/card/LabelIcon.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/card/ModelCard.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/card/ModelCard.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/form/Form_Dashboard$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/form/Form_Dashboard$1.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/form/Form_Dashboard.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/form/Form_Dashboard.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/form/Form_Dashboard.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
175 |
--------------------------------------------------------------------------------
/build/classes/javaswingdev/form/Form_Empty.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/form/Form_Empty.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/form/Form_Empty.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
54 |
--------------------------------------------------------------------------------
/build/classes/javaswingdev/main/Main$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/main/Main$1.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/main/Main$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/main/Main$2.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/main/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/main/Main.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/main/Main.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
115 |
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/EventMenuSelected.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/EventMenuSelected.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/Item$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/Item$1.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/Item$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/Item$2.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/Item.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/Item.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/Menu$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/Menu$1.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/Menu.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/Menu.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/MenuItem$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/MenuItem$1.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/MenuItem$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/MenuItem$2.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/MenuItem$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/MenuItem$3.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/MenuItem$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/MenuItem$4.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/MenuItem$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/MenuItem$5.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/MenuItem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/MenuItem.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/menu/ModelMenuItem.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/menu/ModelMenuItem.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/RoundPanel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/RoundPanel.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/scroll/ModernScrollBarUI$InvisibleScrollBarButton.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/scroll/ModernScrollBarUI$InvisibleScrollBarButton.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/scroll/ModernScrollBarUI.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/scroll/ModernScrollBarUI.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/scroll/ScrollBar.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/scroll/ScrollBar.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/table/Table$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/table/Table$1.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/table/Table$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/table/Table$2.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/table/Table.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/table/Table.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/table/TableHeader.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/table/TableHeader.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/titlebar/ComponentResizer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/titlebar/ComponentResizer.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/titlebar/TitleBar$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/titlebar/TitleBar$1.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/titlebar/TitleBar$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/titlebar/TitleBar$2.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/titlebar/TitleBar$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/titlebar/TitleBar$3.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/titlebar/TitleBar$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/titlebar/TitleBar$4.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/titlebar/TitleBar$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/titlebar/TitleBar$5.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/titlebar/TitleBar$6.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/titlebar/TitleBar$6.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/titlebar/TitleBar$Item.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/titlebar/TitleBar$Item.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/swing/titlebar/TitleBar.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/swing/titlebar/TitleBar.class
--------------------------------------------------------------------------------
/build/classes/javaswingdev/system/SystemColor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/build/classes/javaswingdev/system/SystemColor.class
--------------------------------------------------------------------------------
/gradient-icon-font.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/gradient-icon-font.jar
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/miglayout-4.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-011/171a6d3b6ba315b189a1021a7a372dc6d59df9d5/miglayout-4.0.jar
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=861ef87c
2 | build.xml.script.CRC32=885cbfd1
3 | build.xml.stylesheet.CRC32=f85dc8f2@1.101.0.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=861ef87c
7 | nbproject/build-impl.xml.script.CRC32=aa058600
8 | nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.101.0.48
9 |
--------------------------------------------------------------------------------
/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\RAVEN\\AppData\\Roaming\\NetBeans\\12.6\\build.properties
3 |
--------------------------------------------------------------------------------
/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/D:/Raven/youtube/ui%20design/ui-dashboard%20011/project/java-ui-dashboard-011/src/javaswingdev/system/SystemColor.java
7 | file:/D:/Raven/youtube/ui%20design/ui-dashboard%20011/project/java-ui-dashboard-011/src/javaswingdev/menu/Item.java
8 | file:/D:/Raven/youtube/ui%20design/ui-dashboard%20011/project/java-ui-dashboard-011/src/javaswingdev/main/Main.java
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.modulepath=\
22 | ${run.modulepath}
23 | debug.test.classpath=\
24 | ${run.test.classpath}
25 | debug.test.modulepath=\
26 | ${run.test.modulepath}
27 | # Files in build.classes.dir which should be excluded from distribution jar
28 | dist.archive.excludes=
29 | # This directory is removed when the project is cleaned:
30 | dist.dir=dist
31 | dist.jar=${dist.dir}/java-ui-dashboard-011.jar
32 | dist.javadoc.dir=${dist.dir}/javadoc
33 | dist.jlink.dir=${dist.dir}/jlink
34 | dist.jlink.output=${dist.jlink.dir}/java-ui-dashboard-011
35 | excludes=
36 | file.reference.gradient-icon-font.jar=gradient-icon-font.jar
37 | file.reference.miglayout-4.0.jar=miglayout-4.0.jar
38 | file.reference.TimingFramework-0.55.jar=TimingFramework-0.55.jar
39 | includes=**
40 | jar.compress=false
41 | javac.classpath=\
42 | ${file.reference.TimingFramework-0.55.jar}:\
43 | ${file.reference.gradient-icon-font.jar}:\
44 | ${file.reference.miglayout-4.0.jar}
45 | # Space-separated list of extra javac options
46 | javac.compilerargs=
47 | javac.deprecation=false
48 | javac.external.vm=true
49 | javac.modulepath=
50 | javac.processormodulepath=
51 | javac.processorpath=\
52 | ${javac.classpath}
53 | javac.source=11
54 | javac.target=11
55 | javac.test.classpath=\
56 | ${javac.classpath}:\
57 | ${build.classes.dir}
58 | javac.test.modulepath=\
59 | ${javac.modulepath}
60 | javac.test.processorpath=\
61 | ${javac.test.classpath}
62 | javadoc.additionalparam=
63 | javadoc.author=false
64 | javadoc.encoding=${source.encoding}
65 | javadoc.html5=false
66 | javadoc.noindex=false
67 | javadoc.nonavbar=false
68 | javadoc.notree=false
69 | javadoc.private=false
70 | javadoc.splitindex=true
71 | javadoc.use=true
72 | javadoc.version=false
73 | javadoc.windowtitle=
74 | # The jlink additional root modules to resolve
75 | jlink.additionalmodules=
76 | # The jlink additional command line parameters
77 | jlink.additionalparam=
78 | jlink.launcher=true
79 | jlink.launcher.name=java-ui-dashboard-011
80 | main.class=javaswingdev.main.Main
81 | manifest.file=manifest.mf
82 | meta.inf.dir=${src.dir}/META-INF
83 | mkdist.disabled=false
84 | platform.active=default_platform
85 | run.classpath=\
86 | ${javac.classpath}:\
87 | ${build.classes.dir}
88 | # Space-separated list of JVM arguments used when running the project.
89 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
90 | # To set system properties for unit tests define test-sys-prop.name=value:
91 | run.jvmargs=
92 | run.modulepath=\
93 | ${javac.modulepath}
94 | run.test.classpath=\
95 | ${javac.test.classpath}:\
96 | ${build.test.classes.dir}
97 | run.test.modulepath=\
98 | ${javac.test.modulepath}
99 | source.encoding=UTF-8
100 | src.dir=src
101 | test.src.dir=test
102 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | java-ui-dashboard-011
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/javaswingdev/card/Card.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
78 |
--------------------------------------------------------------------------------
/src/javaswingdev/card/Card.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.card;
2 |
3 | import java.awt.Color;
4 | import java.awt.GradientPaint;
5 | import java.awt.Graphics;
6 | import java.awt.Graphics2D;
7 | import java.awt.RenderingHints;
8 | import java.awt.geom.Area;
9 | import java.awt.geom.Rectangle2D;
10 | import java.awt.geom.RoundRectangle2D;
11 | import javaswingdev.GoogleMaterialDesignIcon;
12 | import javaswingdev.GoogleMaterialIcon;
13 | import javaswingdev.GradientType;
14 |
15 | public class Card extends javax.swing.JPanel {
16 |
17 | private GoogleMaterialDesignIcon icon;
18 |
19 | public Card() {
20 | initComponents();
21 | init();
22 | }
23 |
24 | private void init() {
25 | setOpaque(false);
26 | setBackground(Color.WHITE);
27 | setIcon(GoogleMaterialDesignIcon.AUTORENEW);
28 | }
29 |
30 | public void setIcon(GoogleMaterialDesignIcon icon) {
31 | this.icon = icon;
32 | lbIcon.setIcon(new GoogleMaterialIcon(icon, GradientType.DIAGONAL_1, new Color(191, 191, 191), Color.WHITE, 32).toIcon());
33 | }
34 |
35 | public GoogleMaterialDesignIcon getIcon() {
36 | return icon;
37 | }
38 |
39 | @Override
40 | protected void paintComponent(Graphics g) {
41 | Graphics2D g2 = (Graphics2D) g.create();
42 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
43 | Area area = new Area(new RoundRectangle2D.Double(0, 20, getWidth(), getHeight() - 20, 10, 10));
44 | g2.setColor(getBackground());
45 | g2.fill(area);
46 | area.subtract(new Area(new Rectangle2D.Double(0, 20, getWidth(), getHeight() - 23)));
47 | g2.setPaint(new GradientPaint(0, 0, lbIcon.getColor1(), getWidth(), 0, lbIcon.getColor2()));
48 | g2.fill(area);
49 | g2.dispose();
50 | super.paintComponent(g);
51 | }
52 |
53 | public Color getColor1() {
54 | return lbIcon.getColor1();
55 | }
56 |
57 | public void setColor1(Color color1) {
58 | lbIcon.setColor1(color1);
59 | }
60 |
61 | public Color getColor2() {
62 | return lbIcon.getColor2();
63 | }
64 |
65 | public void setColor2(Color color2) {
66 | lbIcon.setColor2(color2);
67 | }
68 |
69 | public void setDescription(String description) {
70 | lbDescription.setText(description);
71 | }
72 |
73 | public String getDescription() {
74 | return lbDescription.getText();
75 | }
76 |
77 | public void setValues(String values) {
78 | lbValues.setText(values);
79 | }
80 |
81 | public String getValues() {
82 | return lbValues.getText();
83 | }
84 |
85 | public void setData(ModelCard data) {
86 | lbValues.setText(data.getValues());
87 | lbDescription.setText(data.getDescription());
88 | if (data.getColor1() != null) {
89 | setColor1(data.getColor1());
90 | }
91 | if (data.getColor2() != null) {
92 | setColor2(data.getColor2());
93 | }
94 | if (data.getIcon() != null) {
95 | setIcon(data.getIcon());
96 | }
97 | repaint();
98 | }
99 |
100 | @SuppressWarnings("unchecked")
101 | // //GEN-BEGIN:initComponents
102 | private void initComponents() {
103 |
104 | lbIcon = new javaswingdev.card.LabelIcon();
105 | lbValues = new javax.swing.JLabel();
106 | lbDescription = new javax.swing.JLabel();
107 |
108 | lbIcon.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
109 |
110 | lbValues.setFont(new java.awt.Font("sansserif", 1, 24)); // NOI18N
111 | lbValues.setForeground(new java.awt.Color(128, 128, 128));
112 | lbValues.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
113 | lbValues.setText("$ 0.00");
114 |
115 | lbDescription.setFont(new java.awt.Font("sansserif", 0, 14)); // NOI18N
116 | lbDescription.setForeground(new java.awt.Color(153, 153, 153));
117 | lbDescription.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
118 | lbDescription.setText("Report Income Monthly");
119 |
120 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
121 | this.setLayout(layout);
122 | layout.setHorizontalGroup(
123 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
124 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
125 | .addGap(10, 10, 10)
126 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
127 | .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
128 | .addComponent(lbIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
129 | .addGap(0, 0, Short.MAX_VALUE))
130 | .addComponent(lbDescription, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
131 | .addComponent(lbValues, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
132 | .addGap(10, 10, 10))
133 | );
134 | layout.setVerticalGroup(
135 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
136 | .addGroup(layout.createSequentialGroup()
137 | .addComponent(lbIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
138 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
139 | .addComponent(lbValues)
140 | .addGap(3, 3, 3)
141 | .addComponent(lbDescription)
142 | .addGap(20, 20, 20))
143 | );
144 | }// //GEN-END:initComponents
145 |
146 | // Variables declaration - do not modify//GEN-BEGIN:variables
147 | private javax.swing.JLabel lbDescription;
148 | private javaswingdev.card.LabelIcon lbIcon;
149 | private javax.swing.JLabel lbValues;
150 | // End of variables declaration//GEN-END:variables
151 | }
152 |
--------------------------------------------------------------------------------
/src/javaswingdev/card/LabelIcon.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.card;
2 |
3 | import java.awt.Color;
4 | import java.awt.GradientPaint;
5 | import java.awt.Graphics;
6 | import java.awt.Graphics2D;
7 | import java.awt.RenderingHints;
8 | import javaswingdev.system.SystemColor;
9 | import javax.swing.JLabel;
10 |
11 | public class LabelIcon extends JLabel {
12 |
13 | public Color getColor1() {
14 | return color1;
15 | }
16 |
17 | public void setColor1(Color color1) {
18 | this.color1 = color1;
19 | }
20 |
21 | public Color getColor2() {
22 | return color2;
23 | }
24 |
25 | public void setColor2(Color color2) {
26 | this.color2 = color2;
27 | }
28 |
29 | private Color color1 = SystemColor.MAIN_COLOR_1;
30 | private Color color2 = SystemColor.MAIN_COLOR_2;
31 |
32 | public LabelIcon() {
33 | }
34 |
35 | @Override
36 | protected void paintComponent(Graphics g) {
37 | Graphics2D g2 = (Graphics2D) g.create();
38 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
39 | g2.setPaint(new GradientPaint(0, 0, color1, getWidth(), getHeight(), color2));
40 | g2.fillRoundRect(0, 0, getWidth(), getHeight(), 10, 10);
41 | g2.dispose();
42 | super.paintComponent(g);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/javaswingdev/card/ModelCard.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.card;
2 |
3 | import java.awt.Color;
4 | import javaswingdev.GoogleMaterialDesignIcon;
5 |
6 | public class ModelCard {
7 |
8 | public GoogleMaterialDesignIcon getIcon() {
9 | return icon;
10 | }
11 |
12 | public void setIcon(GoogleMaterialDesignIcon icon) {
13 | this.icon = icon;
14 | }
15 |
16 | public Color getColor1() {
17 | return color1;
18 | }
19 |
20 | public void setColor1(Color color1) {
21 | this.color1 = color1;
22 | }
23 |
24 | public Color getColor2() {
25 | return color2;
26 | }
27 |
28 | public void setColor2(Color color2) {
29 | this.color2 = color2;
30 | }
31 |
32 | public String getValues() {
33 | return values;
34 | }
35 |
36 | public void setValues(String values) {
37 | this.values = values;
38 | }
39 |
40 | public String getDescription() {
41 | return description;
42 | }
43 |
44 | public void setDescription(String description) {
45 | this.description = description;
46 | }
47 |
48 | public ModelCard(GoogleMaterialDesignIcon icon, Color color1, Color color2, String values, String description) {
49 | this.icon = icon;
50 | this.color1 = color1;
51 | this.color2 = color2;
52 | this.values = values;
53 | this.description = description;
54 | }
55 |
56 | public ModelCard() {
57 | }
58 |
59 | private GoogleMaterialDesignIcon icon;
60 | private Color color1;
61 | private Color color2;
62 | private String values;
63 | private String description;
64 | }
65 |
--------------------------------------------------------------------------------
/src/javaswingdev/form/Form_Dashboard.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
175 |
--------------------------------------------------------------------------------
/src/javaswingdev/form/Form_Dashboard.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.form;
2 |
3 | import javaswingdev.card.ModelCard;
4 |
5 | public class Form_Dashboard extends javax.swing.JPanel {
6 |
7 | public Form_Dashboard() {
8 | initComponents();
9 | init();
10 | }
11 |
12 | private void init() {
13 | table.fixTable(jScrollPane1);
14 | table.addRow(new Object[]{"1", "Mike Bhand", "mikebhand@gmail.com", "Admin", "25 Apr,2018"});
15 | table.addRow(new Object[]{"2", "Andrew Strauss", "andrewstrauss@gmail.com", "Editor", "25 Apr,2018"});
16 | table.addRow(new Object[]{"3", "Ross Kopelman", "rosskopelman@gmail.com", "Subscriber", "25 Apr,2018"});
17 | table.addRow(new Object[]{"4", "Mike Hussy", "mikehussy@gmail.com", "Admin", "25 Apr,2018"});
18 | table.addRow(new Object[]{"5", "Kevin Pietersen", "kevinpietersen@gmail.com", "Admin", "25 Apr,2018"});
19 | table.addRow(new Object[]{"6", "Andrew Strauss", "andrewstrauss@gmail.com", "Editor", "25 Apr,2018"});
20 | table.addRow(new Object[]{"7", "Ross Kopelman", "rosskopelman@gmail.com", "Subscriber", "25 Apr,2018"});
21 | table.addRow(new Object[]{"8", "Mike Hussy", "mikehussy@gmail.com", "Admin", "25 Apr,2018"});
22 | table.addRow(new Object[]{"9", "Kevin Pietersen", "kevinpietersen@gmail.com", "Admin", "25 Apr,2018"});
23 | table.addRow(new Object[]{"10", "Kevin Pietersen", "kevinpietersen@gmail.com", "Admin", "25 Apr,2018"});
24 | table.addRow(new Object[]{"11", "Andrew Strauss", "andrewstrauss@gmail.com", "Editor", "25 Apr,2018"});
25 | table.addRow(new Object[]{"12", "Ross Kopelman", "rosskopelman@gmail.com", "Subscriber", "25 Apr,2018"});
26 | table.addRow(new Object[]{"13", "Mike Hussy", "mikehussy@gmail.com", "Admin", "25 Apr,2018"});
27 | table.addRow(new Object[]{"14", "Kevin Pietersen", "kevinpietersen@gmail.com", "Admin", "25 Apr,2018"});
28 |
29 | // init card data
30 | card1.setData(new ModelCard(null, null, null, "$ 500.00", "Report Income Monthly"));
31 | card2.setData(new ModelCard(null, null, null, "$ 800.00", "Report Expense Monthly"));
32 | card3.setData(new ModelCard(null, null, null, "$ 300.00", "Report Profit Monthly"));
33 | }
34 |
35 | @SuppressWarnings("unchecked")
36 | // //GEN-BEGIN:initComponents
37 | private void initComponents() {
38 |
39 | card1 = new javaswingdev.card.Card();
40 | card2 = new javaswingdev.card.Card();
41 | card3 = new javaswingdev.card.Card();
42 | roundPanel1 = new javaswingdev.swing.RoundPanel();
43 | jScrollPane1 = new javax.swing.JScrollPane();
44 | table = new javaswingdev.swing.table.Table();
45 |
46 | setOpaque(false);
47 |
48 | card2.setColor1(new java.awt.Color(95, 211, 226));
49 | card2.setColor2(new java.awt.Color(26, 166, 170));
50 | card2.setIcon(javaswingdev.GoogleMaterialDesignIcon.PIE_CHART);
51 |
52 | card3.setColor1(new java.awt.Color(95, 243, 140));
53 | card3.setColor2(new java.awt.Color(3, 157, 27));
54 | card3.setIcon(javaswingdev.GoogleMaterialDesignIcon.RING_VOLUME);
55 |
56 | roundPanel1.setBackground(new java.awt.Color(255, 255, 255));
57 | roundPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
58 | roundPanel1.setRound(10);
59 |
60 | table.setModel(new javax.swing.table.DefaultTableModel(
61 | new Object [][] {
62 |
63 | },
64 | new String [] {
65 | "#", "Name", "Email", "Position", "Date Join"
66 | }
67 | ) {
68 | boolean[] canEdit = new boolean [] {
69 | false, false, false, false, false
70 | };
71 |
72 | public boolean isCellEditable(int rowIndex, int columnIndex) {
73 | return canEdit [columnIndex];
74 | }
75 | });
76 | jScrollPane1.setViewportView(table);
77 |
78 | javax.swing.GroupLayout roundPanel1Layout = new javax.swing.GroupLayout(roundPanel1);
79 | roundPanel1.setLayout(roundPanel1Layout);
80 | roundPanel1Layout.setHorizontalGroup(
81 | roundPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
82 | .addGroup(roundPanel1Layout.createSequentialGroup()
83 | .addContainerGap()
84 | .addComponent(jScrollPane1)
85 | .addContainerGap())
86 | );
87 | roundPanel1Layout.setVerticalGroup(
88 | roundPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
89 | .addGroup(roundPanel1Layout.createSequentialGroup()
90 | .addContainerGap()
91 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
92 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
93 | );
94 |
95 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
96 | this.setLayout(layout);
97 | layout.setHorizontalGroup(
98 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
99 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
100 | .addGap(30, 30, 30)
101 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
102 | .addComponent(roundPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
103 | .addGroup(layout.createSequentialGroup()
104 | .addComponent(card1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
105 | .addGap(30, 30, 30)
106 | .addComponent(card2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
107 | .addGap(30, 30, 30)
108 | .addComponent(card3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
109 | .addGap(30, 30, 30))
110 | );
111 | layout.setVerticalGroup(
112 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
113 | .addGroup(layout.createSequentialGroup()
114 | .addGap(30, 30, 30)
115 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
116 | .addComponent(card3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
117 | .addComponent(card2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
118 | .addComponent(card1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
119 | .addGap(30, 30, 30)
120 | .addComponent(roundPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
121 | .addGap(30, 30, 30))
122 | );
123 | }// //GEN-END:initComponents
124 |
125 | // Variables declaration - do not modify//GEN-BEGIN:variables
126 | private javaswingdev.card.Card card1;
127 | private javaswingdev.card.Card card2;
128 | private javaswingdev.card.Card card3;
129 | private javax.swing.JScrollPane jScrollPane1;
130 | private javaswingdev.swing.RoundPanel roundPanel1;
131 | private javaswingdev.swing.table.Table table;
132 | // End of variables declaration//GEN-END:variables
133 | }
134 |
--------------------------------------------------------------------------------
/src/javaswingdev/form/Form_Empty.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
54 |
--------------------------------------------------------------------------------
/src/javaswingdev/form/Form_Empty.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.form;
2 |
3 | public class Form_Empty extends javax.swing.JPanel {
4 |
5 | public Form_Empty(String name) {
6 | initComponents();
7 | lb.setText("Form " + name);
8 | }
9 |
10 | @SuppressWarnings("unchecked")
11 | // //GEN-BEGIN:initComponents
12 | private void initComponents() {
13 |
14 | lb = new javax.swing.JLabel();
15 |
16 | setOpaque(false);
17 |
18 | lb.setFont(new java.awt.Font("sansserif", 1, 48)); // NOI18N
19 | lb.setForeground(new java.awt.Color(125, 125, 125));
20 | lb.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
21 | lb.setText("Form");
22 |
23 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
24 | this.setLayout(layout);
25 | layout.setHorizontalGroup(
26 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
27 | .addGroup(layout.createSequentialGroup()
28 | .addContainerGap()
29 | .addComponent(lb, javax.swing.GroupLayout.DEFAULT_SIZE, 702, Short.MAX_VALUE)
30 | .addContainerGap())
31 | );
32 | layout.setVerticalGroup(
33 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
34 | .addGroup(layout.createSequentialGroup()
35 | .addContainerGap()
36 | .addComponent(lb, javax.swing.GroupLayout.DEFAULT_SIZE, 435, Short.MAX_VALUE)
37 | .addContainerGap())
38 | );
39 | }// //GEN-END:initComponents
40 |
41 | // Variables declaration - do not modify//GEN-BEGIN:variables
42 | private javax.swing.JLabel lb;
43 | // End of variables declaration//GEN-END:variables
44 | }
45 |
--------------------------------------------------------------------------------
/src/javaswingdev/main/Main.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
115 |
--------------------------------------------------------------------------------
/src/javaswingdev/main/Main.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.main;
2 |
3 | import java.awt.Component;
4 | import javaswingdev.form.Form_Dashboard;
5 | import javaswingdev.form.Form_Empty;
6 | import javaswingdev.menu.EventMenuSelected;
7 |
8 | public class Main extends javax.swing.JFrame {
9 |
10 | private static Main main;
11 |
12 | public Main() {
13 | initComponents();
14 | init();
15 | }
16 |
17 | private void init() {
18 | main = this;
19 | titleBar.initJFram(this);
20 | menu.addEvent(new EventMenuSelected() {
21 | @Override
22 | public void menuSelected(int index, int indexSubMenu) {
23 | if (index == 0 && indexSubMenu == 0) {
24 | showForm(new Form_Dashboard());
25 | } else {
26 | showForm(new Form_Empty(index + " " + indexSubMenu));
27 | }
28 | }
29 | });
30 | menu.setSelectedIndex(0, 0);
31 | }
32 |
33 | public void showForm(Component com) {
34 | body.removeAll();
35 | body.add(com);
36 | body.repaint();
37 | body.revalidate();
38 | }
39 |
40 | public static Main getMain() {
41 | return main;
42 | }
43 |
44 | @SuppressWarnings("unchecked")
45 | // //GEN-BEGIN:initComponents
46 | private void initComponents() {
47 |
48 | background = new javax.swing.JPanel();
49 | panelMenu = new javax.swing.JPanel();
50 | menu = new javaswingdev.menu.Menu();
51 | titleBar = new javaswingdev.swing.titlebar.TitleBar();
52 | body = new javax.swing.JPanel();
53 |
54 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
55 | setUndecorated(true);
56 |
57 | background.setBackground(new java.awt.Color(245, 245, 245));
58 |
59 | panelMenu.setBackground(new java.awt.Color(255, 255, 255));
60 |
61 | javax.swing.GroupLayout panelMenuLayout = new javax.swing.GroupLayout(panelMenu);
62 | panelMenu.setLayout(panelMenuLayout);
63 | panelMenuLayout.setHorizontalGroup(
64 | panelMenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
65 | .addGroup(panelMenuLayout.createSequentialGroup()
66 | .addGroup(panelMenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
67 | .addComponent(menu, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
68 | .addComponent(titleBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
69 | .addGap(0, 0, 0))
70 | );
71 | panelMenuLayout.setVerticalGroup(
72 | panelMenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
73 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelMenuLayout.createSequentialGroup()
74 | .addComponent(titleBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
75 | .addGap(0, 0, 0)
76 | .addComponent(menu, javax.swing.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)
77 | .addContainerGap())
78 | );
79 |
80 | body.setOpaque(false);
81 | body.setLayout(new java.awt.BorderLayout());
82 |
83 | javax.swing.GroupLayout backgroundLayout = new javax.swing.GroupLayout(background);
84 | background.setLayout(backgroundLayout);
85 | backgroundLayout.setHorizontalGroup(
86 | backgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
87 | .addGroup(backgroundLayout.createSequentialGroup()
88 | .addComponent(panelMenu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
89 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
90 | .addComponent(body, javax.swing.GroupLayout.DEFAULT_SIZE, 1098, Short.MAX_VALUE)
91 | .addContainerGap())
92 | );
93 | backgroundLayout.setVerticalGroup(
94 | backgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
95 | .addComponent(panelMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
96 | .addGroup(backgroundLayout.createSequentialGroup()
97 | .addContainerGap()
98 | .addComponent(body, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
99 | .addContainerGap())
100 | );
101 |
102 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
103 | getContentPane().setLayout(layout);
104 | layout.setHorizontalGroup(
105 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
106 | .addComponent(background, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
107 | );
108 | layout.setVerticalGroup(
109 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
110 | .addComponent(background, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
111 | );
112 |
113 | pack();
114 | setLocationRelativeTo(null);
115 | }// //GEN-END:initComponents
116 |
117 | public static void main(String args[]) {
118 | /* Set the Nimbus look and feel */
119 | //
120 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
121 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
122 | */
123 | try {
124 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
125 | if ("Nimbus".equals(info.getName())) {
126 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
127 | break;
128 | }
129 | }
130 | } catch (ClassNotFoundException ex) {
131 | java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
132 | } catch (InstantiationException ex) {
133 | java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
134 | } catch (IllegalAccessException ex) {
135 | java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
136 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
137 | java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
138 | }
139 | //
140 |
141 | /* Create and display the form */
142 | java.awt.EventQueue.invokeLater(new Runnable() {
143 | public void run() {
144 | new Main().setVisible(true);
145 | }
146 | });
147 | }
148 |
149 | // Variables declaration - do not modify//GEN-BEGIN:variables
150 | private javax.swing.JPanel background;
151 | private javax.swing.JPanel body;
152 | private javaswingdev.menu.Menu menu;
153 | private javax.swing.JPanel panelMenu;
154 | private javaswingdev.swing.titlebar.TitleBar titleBar;
155 | // End of variables declaration//GEN-END:variables
156 | }
157 |
--------------------------------------------------------------------------------
/src/javaswingdev/menu/EventMenuSelected.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.menu;
2 |
3 | public interface EventMenuSelected {
4 |
5 | public void menuSelected(int index, int indexSubMenu);
6 | }
7 |
--------------------------------------------------------------------------------
/src/javaswingdev/menu/Item.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.menu;
2 |
3 | import java.awt.AlphaComposite;
4 | import java.awt.Color;
5 | import java.awt.GradientPaint;
6 | import java.awt.Graphics;
7 | import java.awt.Graphics2D;
8 | import java.awt.RenderingHints;
9 | import java.awt.event.MouseAdapter;
10 | import java.awt.event.MouseEvent;
11 | import javaswingdev.GoogleMaterialDesignIcon;
12 | import javaswingdev.GoogleMaterialIcon;
13 | import javaswingdev.GradientType;
14 | import javaswingdev.system.SystemColor;
15 | import javax.swing.JButton;
16 | import javax.swing.border.EmptyBorder;
17 | import org.jdesktop.animation.timing.Animator;
18 | import org.jdesktop.animation.timing.TimingTargetAdapter;
19 |
20 | public class Item extends JButton {
21 |
22 | private final Color mainColor = SystemColor.MAIN_COLOR_2;
23 | private final int index;
24 | private Animator animator;
25 | private GoogleMaterialDesignIcon icon;
26 | private final boolean mainMenu;
27 | private boolean mouseEnter;
28 | private float alpha;
29 |
30 | public Item(boolean mainMenu, int index) {
31 | this.mainMenu = mainMenu;
32 | this.index = index;
33 | init();
34 | }
35 |
36 | private void init() {
37 | setContentAreaFilled(false);
38 | setHorizontalAlignment(JButton.LEFT);
39 | setForeground(new Color(50, 50, 50));
40 | if (mainMenu) {
41 | setBorder(new EmptyBorder(0, 20, 0, 0));
42 | } else {
43 | setBorder(new EmptyBorder(0, 51, 0, 0));
44 | }
45 | addMouseListener(new MouseAdapter() {
46 | @Override
47 | public void mouseEntered(MouseEvent e) {
48 | setForeground(mainColor);
49 | setGoogleIcon(icon);
50 | if (!mainMenu) {
51 | mouseEnter = true;
52 | startAnimator();
53 | }
54 | }
55 |
56 | @Override
57 | public void mouseExited(MouseEvent e) {
58 | if (!isSelected()) {
59 | setForeground(new Color(50, 50, 50));
60 | setGoogleIcon(icon);
61 | }
62 | if (!mainMenu) {
63 | mouseEnter = false;
64 | startAnimator();
65 | }
66 | }
67 | });
68 | if (!mainMenu) {
69 | animator = new Animator(350, new TimingTargetAdapter() {
70 | @Override
71 | public void timingEvent(float fraction) {
72 | alpha = mouseEnter ? fraction : 1f - fraction;
73 | repaint();
74 | }
75 | });
76 | animator.setResolution(0);
77 | animator.setAcceleration(.5f);
78 | animator.setDeceleration(.5f);
79 | }
80 | }
81 |
82 | private void startAnimator() {
83 | if (animator.isRunning()) {
84 | float f = animator.getTimingFraction();
85 | animator.stop();
86 | animator.setStartFraction(1f - f);
87 | } else {
88 | animator.setStartFraction(0f);
89 | }
90 | animator.start();
91 | }
92 |
93 | @Override
94 | protected void paintComponent(Graphics g) {
95 | super.paintComponent(g);
96 | if (!mainMenu) {
97 | Graphics2D g2 = (Graphics2D) g.create();
98 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
99 | g2.setColor(new Color(170, 170, 170));
100 | int height = getHeight();
101 | int size = 6;
102 | int y = (height - size) / 2;
103 | g2.drawOval(27, y, size, size);
104 | g2.setColor(mainColor);
105 | if (isSelected()) {
106 | alpha = 1;
107 | }
108 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
109 | g2.fillOval(27, y, size + 1, size + 1);
110 | g2.dispose();
111 | } else {
112 | if (isSelected()) {
113 | Graphics2D g2 = (Graphics2D) g.create();
114 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
115 | g2.setPaint(new GradientPaint(0, 3, SystemColor.MAIN_COLOR_1, 3, getHeight() - 6, SystemColor.MAIN_COLOR_2));
116 | g2.fillRect(0, 3, 3, getHeight() - 6);
117 | g2.dispose();
118 | }
119 | }
120 | }
121 |
122 | public void setGoogleIcon(GoogleMaterialDesignIcon icon) {
123 | if (icon != null) {
124 | this.icon = icon;
125 | setIcon(new GoogleMaterialIcon(icon, GradientType.HORIZONTAL, SystemColor.MAIN_COLOR_1, SystemColor.MAIN_COLOR_2, 19).toIcon());
126 | }
127 | }
128 |
129 | @Override
130 | public void setSelected(boolean b) {
131 | super.setSelected(b);
132 | if (b || mouseEnter) {
133 | setForeground(mainColor);
134 | } else {
135 | alpha = 0;
136 | setForeground(new Color(50, 50, 50));
137 | }
138 | setGoogleIcon(icon);
139 | }
140 |
141 | public Color getMainColor() {
142 | return mainColor;
143 | }
144 |
145 | public int getIndex() {
146 | return index;
147 | }
148 |
149 | public boolean isMainMenu() {
150 | return mainMenu;
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/src/javaswingdev/menu/Menu.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.menu;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.Color;
5 | import java.awt.Component;
6 | import java.awt.Font;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 | import javaswingdev.GoogleMaterialDesignIcon;
10 | import javaswingdev.swing.scroll.ScrollBar;
11 | import javax.swing.JLabel;
12 | import javax.swing.JPanel;
13 | import javax.swing.JScrollPane;
14 | import javax.swing.border.EmptyBorder;
15 | import net.miginfocom.swing.MigLayout;
16 |
17 | public class Menu extends JPanel {
18 |
19 | private int index = -1;
20 | private final List events = new ArrayList<>();
21 |
22 | public Menu() {
23 | init();
24 | }
25 |
26 | private void init() {
27 | setBackground(Color.WHITE);
28 | setLayout(new BorderLayout());
29 | JScrollPane scroll = createScroll();
30 | panelMenu = createPanelMenu();
31 | scroll.setViewportView(panelMenu);
32 | scroll.getViewport().setOpaque(false);
33 | scroll.setViewportBorder(null);
34 | add(scroll);
35 | addTitle("MAIN");
36 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.DASHBOARD, "Dashboard"));
37 | addTitle("WEB APPS");
38 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.MAIL_OUTLINE, "Email", "Inbox", "Read", "Compose"));
39 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.MESSAGE, "Chat"));
40 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.PERM_CONTACT_CALENDAR, "Calendar"));
41 | addTitle("COMPONENT");
42 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.WHATSHOT, "UI Kit", "Accordion", "Alerts", "Badges", "Breadcrumbs", "Buttons", "Button group"));
43 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.DIRECTIONS_BIKE, "Advanced UI", "Cropper", "Owl Carousel", "Sweet Alert"));
44 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.DVR, "Forms", "Basic Elements", "Advanced Elements", "SEditors", "Wizard"));
45 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.PIE_CHART_OUTLINED, "Charts", "Apex", "Flot", "Peity", "Sparkline"));
46 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.VIEW_LIST, "Table", "Basic Tables", "Data Table"));
47 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.INSERT_EMOTICON, "Icons", "Feather Icons", "Flag Icons", "Mdi Icons"));
48 | addTitle("PAGES");
49 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.INBOX, "Special Pages", "Blank page", "Faq", "Invoice", "Profile", "Pricing", "Timeline"));
50 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.LOCK_OUTLINE, "Authentication", "Login", "Register"));
51 | addMenuItem(new ModelMenuItem(GoogleMaterialDesignIcon.ERROR_OUTLINE, "Error", "404", "500"));
52 | }
53 |
54 | private JScrollPane createScroll() {
55 | JScrollPane scroll = new JScrollPane();
56 | scroll.setBorder(null);
57 | scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
58 | scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
59 | scroll.setVerticalScrollBar(new ScrollBar());
60 | return scroll;
61 | }
62 |
63 | private JPanel createPanelMenu() {
64 | JPanel panel = new JPanel();
65 | panel.setOpaque(false);
66 | menuLayout = new MigLayout("wrap,fillx,inset 0,gapy 0", "[fill]");
67 | panel.setLayout(menuLayout);
68 |
69 | return panel;
70 | }
71 |
72 | private JPanel createMenuItem(ModelMenuItem item) {
73 | MenuItem menuItem = new MenuItem(item, ++index, menuLayout);
74 | menuItem.addEvent(new EventMenuSelected() {
75 | @Override
76 | public void menuSelected(int index, int indexSubMenu) {
77 | if (!menuItem.isHasSubMenu() || indexSubMenu != 0) {
78 | clearSelected();
79 | setSelectedIndex(index, indexSubMenu);
80 | }
81 | }
82 | });
83 | return menuItem;
84 | }
85 |
86 | private void runEvent(int index, int indexSubMenu) {
87 | for (EventMenuSelected event : events) {
88 | event.menuSelected(index, indexSubMenu);
89 | }
90 | }
91 |
92 | // Public Method
93 | public void addMenuItem(ModelMenuItem menu) {
94 | panelMenu.add(createMenuItem(menu), "h 35!");
95 | }
96 |
97 | public void addTitle(String title) {
98 | JLabel label = new JLabel(title);
99 | label.setBorder(new EmptyBorder(15, 20, 5, 5));
100 | label.setFont(label.getFont().deriveFont(Font.BOLD));
101 | label.setForeground(new Color(170, 170, 170));
102 | panelMenu.add(label);
103 | }
104 |
105 | public void addSpace(int size) {
106 | panelMenu.add(new JLabel(), "h " + size + "!");
107 | }
108 |
109 | public void setSelectedIndex(int index, int indexSubMenu) {
110 | for (Component com : panelMenu.getComponents()) {
111 | if (com instanceof MenuItem) {
112 | MenuItem item = (MenuItem) com;
113 | if (item.getIndex() == index) {
114 | item.setSelectedIndex(indexSubMenu);
115 | runEvent(index, indexSubMenu);
116 | break;
117 | }
118 | }
119 | }
120 | }
121 |
122 | public void clearSelected() {
123 | for (Component com : panelMenu.getComponents()) {
124 | if (com instanceof MenuItem) {
125 | MenuItem item = (MenuItem) com;
126 | item.clearSelected();
127 | }
128 | }
129 | }
130 |
131 | public void addEvent(EventMenuSelected event) {
132 | events.add(event);
133 | }
134 |
135 | private MigLayout menuLayout;
136 | private JPanel panelMenu;
137 | }
138 |
--------------------------------------------------------------------------------
/src/javaswingdev/menu/MenuItem.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.menu;
2 |
3 | import java.awt.BasicStroke;
4 | import java.awt.Color;
5 | import java.awt.Component;
6 | import java.awt.Graphics;
7 | import java.awt.Graphics2D;
8 | import java.awt.RenderingHints;
9 | import java.awt.event.ActionEvent;
10 | import java.awt.event.ActionListener;
11 | import java.awt.event.MouseAdapter;
12 | import java.awt.event.MouseEvent;
13 | import java.awt.geom.AffineTransform;
14 | import java.awt.geom.Path2D;
15 | import java.util.ArrayList;
16 | import java.util.List;
17 | import javax.swing.JPanel;
18 | import net.miginfocom.swing.MigLayout;
19 | import org.jdesktop.animation.timing.Animator;
20 | import org.jdesktop.animation.timing.TimingTargetAdapter;
21 |
22 | public class MenuItem extends JPanel {
23 |
24 | private final List events = new ArrayList<>();
25 | private final int index;
26 | private final boolean hasSubMenu;
27 | private Animator animator;
28 | private int buttonAngle = -1;
29 | private boolean open;
30 |
31 | public MenuItem(ModelMenuItem item, int index, MigLayout layout) {
32 | this.index = index;
33 | this.hasSubMenu = item.getSubMenu().length > 0;
34 | init(item);
35 | if (hasSubMenu) {
36 | initAnimator(layout);
37 | buttonAngle = 0;
38 | }
39 | }
40 |
41 | private void init(ModelMenuItem item) {
42 | setOpaque(false);
43 | setForeground(new Color(170, 170, 170));
44 | setLayout(new MigLayout("wrap,fillx,inset 0", "[fill]", "[fill,35!]" + (hasSubMenu ? "0[fill,30!]" : "")));
45 | Item menu = new Item(true, 0);
46 | menu.setGoogleIcon(item.getIcon());
47 | menu.setText(" " + item.getMenuName());
48 | menu.addMouseListener(new MouseAdapter() {
49 | @Override
50 | public void mouseEntered(MouseEvent e) {
51 | setForeground(menu.getMainColor());
52 | }
53 |
54 | @Override
55 | public void mouseExited(MouseEvent e) {
56 | if (!menu.isSelected()) {
57 | setForeground(new Color(170, 170, 170));
58 | }
59 | }
60 | });
61 | menu.addActionListener(new ActionListener() {
62 | @Override
63 | public void actionPerformed(ActionEvent arg0) {
64 | runEvent(index, 0);
65 | }
66 | });
67 | if (hasSubMenu) {
68 | menu.addActionListener(new ActionListener() {
69 | @Override
70 | public void actionPerformed(ActionEvent arg0) {
71 | open = !open;
72 | startAnimator();
73 | }
74 | });
75 | }
76 | add(menu);
77 | int subIndex = 0;
78 | for (String subMenu : item.getSubMenu()) {
79 | Item sMenu = new Item(false, ++subIndex);
80 | sMenu.setText(subMenu);
81 | sMenu.addActionListener(new ActionListener() {
82 | @Override
83 | public void actionPerformed(ActionEvent arg0) {
84 | runEvent(index, sMenu.getIndex());
85 | }
86 | });
87 | add(sMenu);
88 | }
89 | }
90 |
91 | private void initAnimator(MigLayout layout) {
92 | animator = new Animator(300, new TimingTargetAdapter() {
93 | private int height;
94 |
95 | @Override
96 | public void begin() {
97 | height = getPreferredSize().height - 35;
98 | }
99 |
100 | @Override
101 | public void timingEvent(float fraction) {
102 | float f = open ? fraction : 1f - fraction;
103 | int s = (int) (35 + f * height);
104 | layout.setComponentConstraints(MenuItem.this, "h " + s + "!");
105 | buttonAngle = (int) (f * 180);
106 | revalidate();
107 | repaint();
108 | }
109 | });
110 | animator.setResolution(0);
111 | animator.setDeceleration(.5f);
112 | animator.setAcceleration(.5f);
113 | }
114 |
115 | private void startAnimator() {
116 | if (animator.isRunning()) {
117 | float f = animator.getTimingFraction();
118 | animator.stop();
119 | animator.setStartFraction(1f - f);
120 | } else {
121 | animator.setStartFraction(0f);
122 | }
123 | animator.start();
124 | }
125 |
126 | public void addEvent(EventMenuSelected event) {
127 | this.events.add(event);
128 | }
129 |
130 | private void runEvent(int index, int subIndex) {
131 | for (EventMenuSelected evnet : events) {
132 | evnet.menuSelected(index, subIndex);
133 | }
134 | }
135 |
136 | public int getIndex() {
137 | return index;
138 | }
139 |
140 | public boolean isHasSubMenu() {
141 | return hasSubMenu;
142 | }
143 |
144 | public void clearSelected() {
145 | setForeground(new Color(170, 170, 170));
146 | for (Component com : getComponents()) {
147 | Item item = (Item) com;
148 | item.setSelected(false);
149 | }
150 | }
151 |
152 | public void setSelectedIndex(int index) {
153 | for (Component com : getComponents()) {
154 | Item item = (Item) com;
155 | if (item.isMainMenu()) {
156 | item.setSelected(true);
157 | setForeground(item.getMainColor());
158 | }
159 | if (item.getIndex() == index) {
160 | item.setSelected(true);
161 | break;
162 | }
163 | }
164 | }
165 |
166 | @Override
167 | protected void paintComponent(Graphics g) {
168 | super.paintComponent(g);
169 | if (buttonAngle >= 0) {
170 | Graphics2D g2 = (Graphics2D) g.create();
171 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
172 | g2.setColor(getForeground());
173 | int x = getWidth() - 25;
174 | int y = 15;
175 | Path2D p2 = new Path2D.Double();
176 | p2.moveTo(x, y);
177 | p2.lineTo(x + 4, y + 4);
178 | p2.lineTo(x + 8, y);
179 | AffineTransform at = AffineTransform.getRotateInstance(Math.toRadians(buttonAngle), x + 4, y + 2);
180 | g2.setStroke(new BasicStroke(1.8f));
181 | g2.draw(at.createTransformedShape(p2));
182 | g2.dispose();
183 | }
184 | }
185 | }
186 |
--------------------------------------------------------------------------------
/src/javaswingdev/menu/ModelMenuItem.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.menu;
2 |
3 | import javaswingdev.GoogleMaterialDesignIcon;
4 |
5 | public class ModelMenuItem {
6 |
7 | public GoogleMaterialDesignIcon getIcon() {
8 | return icon;
9 | }
10 |
11 | public void setIcon(GoogleMaterialDesignIcon icon) {
12 | this.icon = icon;
13 | }
14 |
15 | public String getMenuName() {
16 | return menuName;
17 | }
18 |
19 | public void setMenuName(String menuName) {
20 | this.menuName = menuName;
21 | }
22 |
23 | public String[] getSubMenu() {
24 | return subMenu;
25 | }
26 |
27 | public void setSubMenu(String[] subMenu) {
28 | this.subMenu = subMenu;
29 | }
30 |
31 | public ModelMenuItem(GoogleMaterialDesignIcon icon, String menuName, String... subMenu) {
32 | this.icon = icon;
33 | this.menuName = menuName;
34 | this.subMenu = subMenu;
35 | }
36 |
37 | public ModelMenuItem() {
38 | }
39 |
40 | private GoogleMaterialDesignIcon icon;
41 | private String menuName;
42 | private String subMenu[];
43 | }
44 |
--------------------------------------------------------------------------------
/src/javaswingdev/swing/RoundPanel.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.swing;
2 |
3 | import java.awt.GradientPaint;
4 | import java.awt.Graphics;
5 | import java.awt.Graphics2D;
6 | import java.awt.RenderingHints;
7 | import java.awt.geom.Area;
8 | import java.awt.geom.Rectangle2D;
9 | import java.awt.geom.RoundRectangle2D;
10 | import javaswingdev.system.SystemColor;
11 | import javax.swing.JPanel;
12 |
13 | public class RoundPanel extends JPanel {
14 |
15 | public int getRound() {
16 | return round;
17 | }
18 |
19 | public void setRound(int round) {
20 | this.round = round;
21 | repaint();
22 | }
23 |
24 | private int round;
25 |
26 | public RoundPanel() {
27 | setOpaque(false);
28 | }
29 |
30 | @Override
31 | protected void paintComponent(Graphics g) {
32 | Graphics2D g2 = (Graphics2D) g.create();
33 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
34 | Area area = new Area(new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), round, round));
35 | g2.setColor(getBackground());
36 | g2.fill(area);
37 | area.subtract(new Area(new Rectangle2D.Double(0, 0, getWidth(), getHeight() - 3)));
38 | g2.setPaint(new GradientPaint(0, 0, SystemColor.MAIN_COLOR_1, getWidth(), 0, SystemColor.MAIN_COLOR_2));
39 | g2.fill(area);
40 | g2.dispose();
41 | super.paintComponent(g);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/javaswingdev/swing/scroll/ModernScrollBarUI.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.swing.scroll;
2 |
3 | import java.awt.AlphaComposite;
4 | import java.awt.Color;
5 | import java.awt.Dimension;
6 | import java.awt.Graphics;
7 | import java.awt.Graphics2D;
8 | import java.awt.Rectangle;
9 | import java.awt.RenderingHints;
10 | import javax.swing.BorderFactory;
11 | import javax.swing.JButton;
12 | import javax.swing.JComponent;
13 | import javax.swing.JScrollBar;
14 | import javax.swing.plaf.basic.BasicScrollBarUI;
15 |
16 | public class ModernScrollBarUI extends BasicScrollBarUI {
17 |
18 | private final int THUMB_SIZE = 5;
19 | private final Color THUMB_COLOR = new Color(170, 170, 170);
20 | private final float ALPHA = 0.3f;
21 |
22 | public ModernScrollBarUI() {
23 |
24 | }
25 |
26 | @Override
27 | protected JButton createDecreaseButton(int orientation) {
28 | return new InvisibleScrollBarButton();
29 | }
30 |
31 | @Override
32 | protected JButton createIncreaseButton(int orientation) {
33 | return new InvisibleScrollBarButton();
34 | }
35 |
36 | @Override
37 | protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
38 | }
39 |
40 | @Override
41 | public Dimension getMaximumThumbSize() {
42 | return new Dimension(0, (int) (scrollbar.getHeight() * 0.4f));
43 | }
44 |
45 | @Override
46 | protected Dimension getMinimumThumbSize() {
47 | return new Dimension(0, 75);
48 | }
49 |
50 | @Override
51 | protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
52 | if (scrollbar.getVisibleAmount() != scrollbar.getMaximum()) {
53 | int orientation = scrollbar.getOrientation();
54 | int x = thumbBounds.x + (orientation == JScrollBar.VERTICAL ? 0 : 8);
55 | int y = thumbBounds.y + (orientation == JScrollBar.VERTICAL ? 8 : 0);
56 | int width = orientation == JScrollBar.VERTICAL ? THUMB_SIZE : thumbBounds.width - 16;
57 | width = Math.max(width, THUMB_SIZE);
58 | int height = orientation == JScrollBar.VERTICAL ? thumbBounds.height - 16 : THUMB_SIZE;
59 | height = Math.max(height, THUMB_SIZE);
60 | Graphics2D graphics2D = (Graphics2D) g.create();
61 | graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
62 | graphics2D.setColor(THUMB_COLOR);
63 | graphics2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, ALPHA));
64 | graphics2D.fillRoundRect(x, y, width, height, 5, 5);
65 | graphics2D.dispose();
66 | }
67 | }
68 |
69 | private static class InvisibleScrollBarButton extends JButton {
70 |
71 | private InvisibleScrollBarButton() {
72 | init();
73 | }
74 |
75 | private void init() {
76 | setOpaque(false);
77 | setFocusable(false);
78 | setFocusPainted(false);
79 | setBorderPainted(false);
80 | setBorder(BorderFactory.createEmptyBorder());
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/src/javaswingdev/swing/scroll/ScrollBar.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.swing.scroll;
2 |
3 | import java.awt.Dimension;
4 | import javax.swing.JScrollBar;
5 |
6 | public class ScrollBar extends JScrollBar {
7 |
8 | public ScrollBar() {
9 | setUI(new ModernScrollBarUI());
10 | setPreferredSize(new Dimension(5, 5));
11 | setOpaque(false);
12 | setUnitIncrement(20);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/javaswingdev/swing/table/Table.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.swing.table;
2 |
3 | import java.awt.Color;
4 | import java.awt.Component;
5 | import javaswingdev.swing.scroll.ScrollBar;
6 | import javaswingdev.system.SystemColor;
7 | import javax.swing.JPanel;
8 | import javax.swing.JScrollPane;
9 | import javax.swing.JTable;
10 | import javax.swing.table.DefaultTableCellRenderer;
11 | import javax.swing.table.DefaultTableModel;
12 |
13 | public class Table extends JTable {
14 |
15 | public Table() {
16 | setShowHorizontalLines(true);
17 | setGridColor(new Color(230, 230, 230));
18 | setRowHeight(40);
19 | getTableHeader().setReorderingAllowed(false);
20 | getTableHeader().setDefaultRenderer(new DefaultTableCellRenderer() {
21 | @Override
22 | public Component getTableCellRendererComponent(JTable jtable, Object o, boolean bln, boolean bln1, int i, int i1) {
23 | TableHeader header = new TableHeader(o + "");
24 | return header;
25 | }
26 | });
27 | setDefaultRenderer(Object.class, new DefaultTableCellRenderer() {
28 | @Override
29 | public Component getTableCellRendererComponent(JTable jtable, Object o, boolean selected, boolean bln1, int i, int i1) {
30 | Component com = super.getTableCellRendererComponent(jtable, o, selected, bln1, i, i1);
31 | com.setBackground(Color.WHITE);
32 | setBorder(noFocusBorder);
33 | if (selected) {
34 | com.setForeground(SystemColor.MAIN_COLOR_1);
35 | } else {
36 | com.setForeground(new Color(102, 102, 102));
37 | }
38 | return com;
39 | }
40 | });
41 | }
42 |
43 | public void addRow(Object[] row) {
44 | DefaultTableModel model = (DefaultTableModel) getModel();
45 | model.addRow(row);
46 | }
47 |
48 | public void fixTable(JScrollPane scroll) {
49 | scroll.setBorder(null);
50 | scroll.setVerticalScrollBar(new ScrollBar());
51 | scroll.getVerticalScrollBar().setBackground(Color.WHITE);
52 | scroll.getViewport().setBackground(Color.WHITE);
53 | JPanel p = new JPanel();
54 | p.setBackground(Color.WHITE);
55 | scroll.setCorner(JScrollPane.UPPER_RIGHT_CORNER, p);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/javaswingdev/swing/table/TableHeader.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.swing.table;
2 |
3 | import java.awt.Color;
4 | import java.awt.Font;
5 | import java.awt.Graphics;
6 | import javax.swing.JLabel;
7 | import javax.swing.border.EmptyBorder;
8 |
9 | public class TableHeader extends JLabel {
10 |
11 | public TableHeader(String text) {
12 | super(text);
13 | setOpaque(true);
14 | setBackground(Color.WHITE);
15 | setFont(new Font("sansserif", 1, 12));
16 | setForeground(new Color(102, 102, 102));
17 | setBorder(new EmptyBorder(10, 5, 10, 5));
18 | }
19 |
20 | @Override
21 | protected void paintComponent(Graphics grphcs) {
22 | super.paintComponent(grphcs);
23 | grphcs.setColor(new Color(230, 230, 230));
24 | grphcs.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/javaswingdev/swing/titlebar/ComponentResizer.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.swing.titlebar;
2 |
3 | import java.awt.Component;
4 | import java.awt.Cursor;
5 | import java.awt.Dimension;
6 | import java.awt.GraphicsEnvironment;
7 | import java.awt.Insets;
8 | import java.awt.Point;
9 | import java.awt.Rectangle;
10 | import java.awt.Window;
11 | import java.awt.event.MouseAdapter;
12 | import java.awt.event.MouseEvent;
13 | import java.util.HashMap;
14 | import java.util.Map;
15 | import javax.swing.JComponent;
16 | import javax.swing.SwingUtilities;
17 |
18 | public class ComponentResizer extends MouseAdapter {
19 |
20 | private final static Dimension MINIMUM_SIZE = new Dimension(10, 10);
21 | private final static Dimension MAXIMUM_SIZE = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
22 | private static Map cursors = new HashMap();
23 |
24 | {
25 | cursors.put(1, Cursor.N_RESIZE_CURSOR);
26 | cursors.put(2, Cursor.W_RESIZE_CURSOR);
27 | cursors.put(4, Cursor.S_RESIZE_CURSOR);
28 | cursors.put(8, Cursor.E_RESIZE_CURSOR);
29 | cursors.put(3, Cursor.NW_RESIZE_CURSOR);
30 | cursors.put(9, Cursor.NE_RESIZE_CURSOR);
31 | cursors.put(6, Cursor.SW_RESIZE_CURSOR);
32 | cursors.put(12, Cursor.SE_RESIZE_CURSOR);
33 | }
34 |
35 | private Insets dragInsets;
36 | private Dimension snapSize;
37 | private int direction;
38 | protected static final int NORTH = 1;
39 | protected static final int WEST = 2;
40 | protected static final int SOUTH = 4;
41 | protected static final int EAST = 8;
42 | private Cursor sourceCursor;
43 | private boolean resizing;
44 | private Rectangle bounds;
45 | private Point pressed;
46 | private boolean autoscrolls;
47 | private Dimension minimumSize = MINIMUM_SIZE;
48 | private Dimension maximumSize = MAXIMUM_SIZE;
49 |
50 | public ComponentResizer() {
51 | this(new Insets(5, 5, 5, 5), new Dimension(1, 1));
52 | }
53 |
54 | public ComponentResizer(Component... components) {
55 | this(new Insets(5, 5, 5, 5), new Dimension(1, 1), components);
56 | }
57 |
58 | public ComponentResizer(Insets dragInsets, Component... components) {
59 | this(dragInsets, new Dimension(1, 1), components);
60 | }
61 |
62 | public ComponentResizer(Insets dragInsets, Dimension snapSize, Component... components) {
63 | setDragInsets(dragInsets);
64 | setSnapSize(snapSize);
65 | registerComponent(components);
66 | }
67 |
68 | public Insets getDragInsets() {
69 | return dragInsets;
70 | }
71 |
72 | public void setDragInsets(Insets dragInsets) {
73 | validateMinimumAndInsets(minimumSize, dragInsets);
74 |
75 | this.dragInsets = dragInsets;
76 | }
77 |
78 | public Dimension getMaximumSize() {
79 | return maximumSize;
80 | }
81 |
82 | public void setMaximumSize(Dimension maximumSize) {
83 | this.maximumSize = maximumSize;
84 | }
85 |
86 | public Dimension getMinimumSize() {
87 | return minimumSize;
88 | }
89 |
90 | public void setMinimumSize(Dimension minimumSize) {
91 | validateMinimumAndInsets(minimumSize, dragInsets);
92 |
93 | this.minimumSize = minimumSize;
94 | }
95 |
96 | public void deregisterComponent(Component... components) {
97 | for (Component component : components) {
98 | component.removeMouseListener(this);
99 | component.removeMouseMotionListener(this);
100 | }
101 | }
102 |
103 | public void registerComponent(Component... components) {
104 | for (Component component : components) {
105 | component.addMouseListener(this);
106 | component.addMouseMotionListener(this);
107 | }
108 | }
109 |
110 | public Dimension getSnapSize() {
111 | return snapSize;
112 | }
113 |
114 | public void setSnapSize(Dimension snapSize) {
115 | this.snapSize = snapSize;
116 | }
117 |
118 | private void validateMinimumAndInsets(Dimension minimum, Insets drag) {
119 | int minimumWidth = drag.left + drag.right;
120 | int minimumHeight = drag.top + drag.bottom;
121 | if (minimum.width < minimumWidth
122 | || minimum.height < minimumHeight) {
123 | String message = "Minimum size cannot be less than drag insets";
124 | throw new IllegalArgumentException(message);
125 | }
126 | }
127 |
128 | @Override
129 | public void mouseMoved(MouseEvent e) {
130 | Component source = e.getComponent();
131 | Point location = e.getPoint();
132 | direction = 0;
133 | if (location.x < dragInsets.left) {
134 | direction += WEST;
135 | }
136 | if (location.x > source.getWidth() - dragInsets.right - 1) {
137 | direction += EAST;
138 | }
139 | if (location.y < dragInsets.top) {
140 | direction += NORTH;
141 | }
142 | if (location.y > source.getHeight() - dragInsets.bottom - 1) {
143 | direction += SOUTH;
144 | }
145 | // Mouse is no longer over a resizable border
146 | if (direction == 0) {
147 | source.setCursor(sourceCursor);
148 | } else {
149 | int cursorType = cursors.get(direction);
150 | Cursor cursor = Cursor.getPredefinedCursor(cursorType);
151 | source.setCursor(cursor);
152 | }
153 | }
154 |
155 | @Override
156 | public void mouseEntered(MouseEvent e) {
157 | if (!resizing) {
158 | Component source = e.getComponent();
159 | sourceCursor = source.getCursor();
160 | }
161 | }
162 |
163 | @Override
164 | public void mouseExited(MouseEvent e) {
165 | if (!resizing) {
166 | Component source = e.getComponent();
167 | source.setCursor(sourceCursor);
168 | }
169 | }
170 |
171 | @Override
172 | public void mousePressed(MouseEvent e) {
173 | // The mouseMoved event continually updates this variable
174 | if (direction == 0) {
175 | return;
176 | }
177 | // Setup for resizing. All future dragging calculations are done based
178 | // on the original bounds of the component and mouse pressed location.
179 | resizing = true;
180 | Component source = e.getComponent();
181 | pressed = e.getPoint();
182 | SwingUtilities.convertPointToScreen(pressed, source);
183 | bounds = source.getBounds();
184 | // Making sure autoscrolls is false will allow for smoother resizing
185 | // of components
186 | if (source instanceof JComponent) {
187 | JComponent jc = (JComponent) source;
188 | autoscrolls = jc.getAutoscrolls();
189 | jc.setAutoscrolls(false);
190 | }
191 | }
192 |
193 | @Override
194 | public void mouseReleased(MouseEvent e) {
195 | resizing = false;
196 | Component source = e.getComponent();
197 | source.setCursor(sourceCursor);
198 | if (source instanceof JComponent) {
199 | ((JComponent) source).setAutoscrolls(autoscrolls);
200 | }
201 | }
202 |
203 | @Override
204 | public void mouseDragged(MouseEvent e) {
205 | if (resizing == false) {
206 | return;
207 | }
208 | Component source = e.getComponent();
209 | Point dragged = e.getPoint();
210 | SwingUtilities.convertPointToScreen(dragged, source);
211 | changeBounds(source, direction, bounds, pressed, dragged);
212 | }
213 |
214 | protected void changeBounds(Component source, int direction, Rectangle bounds, Point pressed, Point current) {
215 | // Start with original locaton and size
216 | int x = bounds.x;
217 | int y = bounds.y;
218 | int width = bounds.width;
219 | int height = bounds.height;
220 | // Resizing the West or North border affects the size and location
221 | if (WEST == (direction & WEST)) {
222 | int drag = getDragDistance(pressed.x, current.x, snapSize.width);
223 | int maximum = Math.min(width + x, maximumSize.width);
224 | drag = getDragBounded(drag, snapSize.width, width, minimumSize.width, maximum);
225 | x -= drag;
226 | width += drag;
227 | }
228 |
229 | if (NORTH == (direction & NORTH)) {
230 | int drag = getDragDistance(pressed.y, current.y, snapSize.height);
231 | int maximum = Math.min(height + y, maximumSize.height);
232 | drag = getDragBounded(drag, snapSize.height, height, minimumSize.height, maximum);
233 | y -= drag;
234 | height += drag;
235 | }
236 | // Resizing the East or South border only affects the size
237 | if (EAST == (direction & EAST)) {
238 | int drag = getDragDistance(current.x, pressed.x, snapSize.width);
239 | Dimension boundingSize = getBoundingSize(source);
240 | int maximum = Math.min(boundingSize.width - x, maximumSize.width);
241 | drag = getDragBounded(drag, snapSize.width, width, minimumSize.width, maximum);
242 | width += drag;
243 | }
244 |
245 | if (SOUTH == (direction & SOUTH)) {
246 | int drag = getDragDistance(current.y, pressed.y, snapSize.height);
247 | Dimension boundingSize = getBoundingSize(source);
248 | int maximum = Math.min(boundingSize.height - y, maximumSize.height);
249 | drag = getDragBounded(drag, snapSize.height, height, minimumSize.height, maximum);
250 | height += drag;
251 | }
252 |
253 | source.setBounds(x, y, width, height);
254 | source.validate();
255 | }
256 |
257 | private int getDragDistance(int larger, int smaller, int snapSize) {
258 | int halfway = snapSize / 2;
259 | int drag = larger - smaller;
260 | drag += (drag < 0) ? -halfway : halfway;
261 | drag = (drag / snapSize) * snapSize;
262 |
263 | return drag;
264 | }
265 |
266 | private int getDragBounded(int drag, int snapSize, int dimension, int minimum, int maximum) {
267 | while (dimension + drag < minimum) {
268 | drag += snapSize;
269 | }
270 | while (dimension + drag > maximum) {
271 | drag -= snapSize;
272 | }
273 | return drag;
274 | }
275 |
276 | private Dimension getBoundingSize(Component source) {
277 | if (source instanceof Window) {
278 | GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
279 | Rectangle bounds = env.getMaximumWindowBounds();
280 | return new Dimension(bounds.width, bounds.height);
281 | } else {
282 | return source.getParent().getSize();
283 | }
284 | }
285 | }
286 |
--------------------------------------------------------------------------------
/src/javaswingdev/swing/titlebar/TitleBar.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.swing.titlebar;
2 |
3 | import java.awt.Color;
4 | import java.awt.Cursor;
5 | import java.awt.Dimension;
6 | import java.awt.Graphics;
7 | import java.awt.Graphics2D;
8 | import java.awt.RenderingHints;
9 | import java.awt.event.ActionEvent;
10 | import java.awt.event.ActionListener;
11 | import java.awt.event.MouseAdapter;
12 | import java.awt.event.MouseEvent;
13 | import java.awt.event.MouseMotionAdapter;
14 | import java.awt.event.WindowEvent;
15 | import java.awt.event.WindowStateListener;
16 | import javax.swing.JButton;
17 | import javax.swing.JComponent;
18 | import javax.swing.JFrame;
19 | import javax.swing.JPanel;
20 | import javax.swing.SwingUtilities;
21 | import net.miginfocom.swing.MigLayout;
22 |
23 | public class TitleBar extends JComponent {
24 |
25 | private JFrame fram;
26 | private ComponentResizer resizer;
27 | private JPanel panel;
28 | private boolean register = true;
29 | private int x;
30 | private int y;
31 |
32 | public TitleBar() {
33 | init();
34 | }
35 |
36 | public void initJFram(JFrame fram) {
37 | this.fram = fram;
38 | resizer = new ComponentResizer();
39 | resizer.setSnapSize(new Dimension(10, 10));
40 | resizer.setMinimumSize(new Dimension(800, 600));
41 | resizer.registerComponent(fram);
42 | fram.addWindowStateListener(new WindowStateListener() {
43 | @Override
44 | public void windowStateChanged(WindowEvent e) {
45 | if (e.getNewState() == JFrame.MAXIMIZED_BOTH) {
46 | resizer.deregisterComponent(fram);
47 | register = false;
48 | } else if (e.getNewState() == JFrame.NORMAL) {
49 | if (register == false) {
50 | resizer.registerComponent(fram);
51 | register = true;
52 | }
53 | }
54 | }
55 | });
56 | panel.addMouseListener(new MouseAdapter() {
57 | @Override
58 | public void mousePressed(MouseEvent e) {
59 | if (fram.getExtendedState() == JFrame.NORMAL && SwingUtilities.isLeftMouseButton(e)) {
60 | x = e.getX() + 3;
61 | y = e.getY() + 3;
62 | }
63 | }
64 | });
65 | panel.addMouseMotionListener(new MouseMotionAdapter() {
66 | @Override
67 | public void mouseDragged(MouseEvent e) {
68 | if (SwingUtilities.isLeftMouseButton(e)) {
69 | if (fram.getExtendedState() == JFrame.NORMAL) {
70 | fram.setLocation(e.getXOnScreen() - x, e.getYOnScreen() - y);
71 | }
72 | }
73 | }
74 | });
75 | }
76 |
77 | private void init() {
78 | setLayout(new MigLayout("inset 3, fill", "[fill]", "[fill]"));
79 | panel = new JPanel();
80 | panel.setOpaque(false);
81 | add(panel);
82 | panel.setLayout(new MigLayout("inset 3"));
83 | Item close = new Item();
84 | Item minimize = new Item();
85 | Item resize = new Item();
86 | close.setBackground(new Color(235, 47, 47));
87 | minimize.setBackground(new Color(220, 213, 53));
88 | resize.setBackground(new Color(44, 203, 87));
89 | panel.add(close);
90 | panel.add(minimize);
91 | panel.add(resize);
92 | close.addActionListener(new ActionListener() {
93 | @Override
94 | public void actionPerformed(ActionEvent e) {
95 | System.exit(0);
96 | }
97 | });
98 | minimize.addActionListener(new ActionListener() {
99 | @Override
100 | public void actionPerformed(ActionEvent e) {
101 | fram.setState(JFrame.ICONIFIED);
102 | }
103 | });
104 | resize.addActionListener(new ActionListener() {
105 | @Override
106 | public void actionPerformed(ActionEvent e) {
107 | if (fram.getExtendedState() == JFrame.MAXIMIZED_BOTH) {
108 | fram.setExtendedState(JFrame.NORMAL);
109 | } else {
110 | fram.setExtendedState(JFrame.MAXIMIZED_BOTH);
111 | }
112 | }
113 | });
114 | }
115 |
116 | private class Item extends JButton {
117 |
118 | public Item() {
119 | init();
120 | }
121 |
122 | private void init() {
123 | setContentAreaFilled(false);
124 | setBorder(null);
125 | setPreferredSize(new Dimension(11, 11));
126 | setCursor(new Cursor(Cursor.HAND_CURSOR));
127 | }
128 |
129 | @Override
130 | protected void paintComponent(Graphics g) {
131 | Graphics2D g2 = (Graphics2D) g.create();
132 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
133 | int with = getWidth();
134 | int height = getHeight();
135 | g2.setColor(getBackground());
136 | g2.fillOval(0, 0, with, height);
137 | g2.dispose();
138 | }
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/src/javaswingdev/system/SystemColor.java:
--------------------------------------------------------------------------------
1 | package javaswingdev.system;
2 |
3 | import java.awt.Color;
4 |
5 | public class SystemColor {
6 |
7 | public final static Color MAIN_COLOR_1 = Color.decode("#8f94fb");
8 | public final static Color MAIN_COLOR_2 = Color.decode("#4e54c8");
9 | }
10 |
--------------------------------------------------------------------------------