├── .gitignore ├── Part 1 └── ui-dashboard-002 │ ├── TimingFramework-0.55.jar │ ├── build.xml │ ├── build │ ├── built-jar.properties │ └── classes │ │ └── com │ │ └── raven │ │ └── swing │ │ ├── Button$1.class │ │ ├── Button$2.class │ │ ├── Button.class │ │ ├── ImageAvatar.class │ │ ├── ModernScrollBarUI$1.class │ │ ├── ModernScrollBarUI$InvisibleScrollBarButton.class │ │ ├── ModernScrollBarUI.class │ │ ├── ScrollBar.class │ │ └── shadow │ │ ├── GraphicsUtilities.class │ │ └── ShadowRenderer.class │ ├── dist │ ├── README.TXT │ ├── lib │ │ ├── TimingFramework-0.55.jar │ │ └── miglayout-4.0.jar │ └── ui-dashboard-002.jar │ ├── manifest.mf │ ├── miglayout-4.0.jar │ ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── private │ │ ├── private.properties │ │ └── private.xml │ ├── project.properties │ └── project.xml │ └── src │ └── com │ └── raven │ ├── component │ ├── Header.form │ ├── Header.java │ ├── Menu.form │ ├── Menu.java │ ├── MenuLayout.form │ ├── MenuLayout.java │ ├── Profile.form │ └── Profile.java │ ├── event │ └── EventMenuSelected.java │ ├── form │ ├── MainForm.form │ └── MainForm.java │ ├── icon │ ├── 1.png │ ├── 10.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ ├── 9.png │ ├── flag.png │ ├── menu.png │ ├── profile.jpg │ ├── profit.png │ ├── search.png │ ├── staff.jpg │ └── stock.png │ ├── main │ ├── Main.form │ └── Main.java │ ├── model │ └── Model_Menu.java │ └── swing │ ├── Button.java │ ├── ImageAvatar.java │ ├── ListMenu.java │ ├── MenuItem.form │ ├── MenuItem.java │ ├── ModernScrollBarUI.java │ ├── ScrollBar.java │ └── shadow │ ├── GraphicsUtilities.java │ └── ShadowRenderer.java ├── Part 2 └── ui-dashboard-002 │ ├── TimingFramework-0.55.jar │ ├── build.xml │ ├── manifest.mf │ ├── miglayout-4.0.jar │ ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── private │ │ ├── private.properties │ │ └── private.xml │ ├── project.properties │ └── project.xml │ └── src │ └── com │ └── raven │ ├── chart │ ├── ChartLine.form │ ├── ChartLine.java │ ├── ChartPie.form │ ├── ChartPie.java │ ├── ItemChartLine.form │ ├── ItemChartLine.java │ ├── ItemChartPie.form │ ├── ItemChartPie.java │ ├── ModelChartLine.java │ ├── ModelChartPie.java │ ├── PanelChartLine.form │ ├── PanelChartLine.java │ ├── PanelChartPie.form │ └── PanelChartPie.java │ ├── component │ ├── Header.form │ ├── Header.java │ ├── Menu.form │ ├── Menu.java │ ├── MenuLayout.form │ ├── MenuLayout.java │ ├── Profile.form │ └── Profile.java │ ├── event │ └── EventMenuSelected.java │ ├── form │ ├── Form_1.form │ ├── Form_1.java │ ├── MainForm.form │ └── MainForm.java │ ├── icon │ ├── 1.png │ ├── 10.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ ├── 9.png │ ├── flag.png │ ├── menu.png │ ├── profile.jpg │ ├── profit.png │ ├── search.png │ ├── staff.jpg │ └── stock.png │ ├── main │ ├── Main.form │ └── Main.java │ ├── model │ └── Model_Menu.java │ └── swing │ ├── Button.java │ ├── ImageAvatar.java │ ├── ListMenu.java │ ├── MenuItem.form │ ├── MenuItem.java │ ├── ModernScrollBarUI.java │ ├── ScrollBar.java │ └── shadow │ ├── GraphicsUtilities.java │ └── ShadowRenderer.java ├── Part 3 └── ui-dashboard-002 │ ├── TimingFramework-0.55.jar │ ├── build.xml │ ├── manifest.mf │ ├── miglayout-4.0.jar │ ├── nbproject │ ├── build-impl.xml │ ├── genfiles.properties │ ├── private │ │ ├── private.properties │ │ └── private.xml │ ├── project.properties │ └── project.xml │ └── src │ └── com │ └── raven │ ├── chart │ ├── ChartLine.form │ ├── ChartLine.java │ ├── ChartPie.form │ ├── ChartPie.java │ ├── ItemChartLine.form │ ├── ItemChartLine.java │ ├── ItemChartPie.form │ ├── ItemChartPie.java │ ├── ModelChartLine.java │ ├── ModelChartPie.java │ ├── PanelChartLine.form │ ├── PanelChartLine.java │ ├── PanelChartPie.form │ └── PanelChartPie.java │ ├── component │ ├── Header.form │ ├── Header.java │ ├── Menu.form │ ├── Menu.java │ ├── MenuLayout.form │ ├── MenuLayout.java │ ├── Profile.form │ └── Profile.java │ ├── event │ └── EventMenuSelected.java │ ├── form │ ├── Form_1.form │ ├── Form_1.java │ ├── Form_2.form │ ├── Form_2.java │ ├── MainForm.form │ └── MainForm.java │ ├── icon │ ├── 1.png │ ├── 10.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ ├── 9.png │ ├── flag.png │ ├── menu.png │ ├── profile.jpg │ ├── profit.png │ ├── search.png │ ├── staff.jpg │ └── stock.png │ ├── main │ ├── Main.form │ └── Main.java │ ├── model │ ├── ModelStaff.java │ └── Model_Menu.java │ └── swing │ ├── Button.java │ ├── ImageAvatar.java │ ├── LabelStatus.java │ ├── ListMenu.java │ ├── MenuItem.form │ ├── MenuItem.java │ ├── ModernScrollBarUI.java │ ├── ScrollBar.java │ ├── Table.java │ ├── TableCell.java │ ├── TableCell_Image.form │ ├── TableCell_Image.java │ ├── TableCell_Status.form │ ├── TableCell_Status.java │ ├── TableHeader.java │ ├── WindowSnapshots.java │ └── shadow │ ├── GraphicsUtilities.java │ └── ShadowRenderer.java └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /Part 1/ui-dashboard-002/build/ 2 | /Part 1/ui-dashboard-002/dist/ 3 | /Part 2/ui-dashboard-002/build/ 4 | /Part 2/ui-dashboard-002/dist/ 5 | /Part 3/ui-dashboard-002/build/ 6 | /Part 3/ui-dashboard-002/dist/ -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/TimingFramework-0.55.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/TimingFramework-0.55.jar -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/built-jar.properties: -------------------------------------------------------------------------------- 1 | #Sat, 04 Sep 2021 18:38:23 +0700 2 | 3 | 4 | D\:\\Raven\\youtube\\ui\ design\\ui-dashboard\ 002\\working\ project\\Part\ 1\\ui-dashboard-002= 5 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/classes/com/raven/swing/Button$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/build/classes/com/raven/swing/Button$1.class -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/classes/com/raven/swing/Button$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/build/classes/com/raven/swing/Button$2.class -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/classes/com/raven/swing/Button.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/build/classes/com/raven/swing/Button.class -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/classes/com/raven/swing/ImageAvatar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/build/classes/com/raven/swing/ImageAvatar.class -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/classes/com/raven/swing/ModernScrollBarUI$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/build/classes/com/raven/swing/ModernScrollBarUI$1.class -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/classes/com/raven/swing/ModernScrollBarUI$InvisibleScrollBarButton.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/build/classes/com/raven/swing/ModernScrollBarUI$InvisibleScrollBarButton.class -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/classes/com/raven/swing/ModernScrollBarUI.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/build/classes/com/raven/swing/ModernScrollBarUI.class -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/classes/com/raven/swing/ScrollBar.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/build/classes/com/raven/swing/ScrollBar.class -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/classes/com/raven/swing/shadow/GraphicsUtilities.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/build/classes/com/raven/swing/shadow/GraphicsUtilities.class -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/build/classes/com/raven/swing/shadow/ShadowRenderer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/build/classes/com/raven/swing/shadow/ShadowRenderer.class -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/dist/README.TXT: -------------------------------------------------------------------------------- 1 | ======================== 2 | BUILD OUTPUT DESCRIPTION 3 | ======================== 4 | 5 | When you build an Java application project that has a main class, the IDE 6 | automatically copies all of the JAR 7 | files on the projects classpath to your projects dist/lib folder. The IDE 8 | also adds each of the JAR files to the Class-Path element in the application 9 | JAR files manifest file (MANIFEST.MF). 10 | 11 | To run the project from the command line, go to the dist folder and 12 | type the following: 13 | 14 | java -jar "ui-dashboard-002.jar" 15 | 16 | To distribute this project, zip up the dist folder (including the lib folder) 17 | and distribute the ZIP file. 18 | 19 | Notes: 20 | 21 | * If two JAR files on the project classpath have the same name, only the first 22 | JAR file is copied to the lib folder. 23 | * Only JAR files are copied to the lib folder. 24 | If the classpath contains other types of files or folders, these files (folders) 25 | are not copied. 26 | * If a library on the projects classpath also has a Class-Path element 27 | specified in the manifest,the content of the Class-Path element has to be on 28 | the projects runtime path. 29 | * To set a main class in a standard Java project, right-click the project node 30 | in the Projects window and choose Properties. Then click Run and enter the 31 | class name in the Main Class field. Alternatively, you can manually type the 32 | class name in the manifest Main-Class element. 33 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/dist/lib/TimingFramework-0.55.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/dist/lib/TimingFramework-0.55.jar -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/dist/lib/miglayout-4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/dist/lib/miglayout-4.0.jar -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/dist/ui-dashboard-002.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/dist/ui-dashboard-002.jar -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/miglayout-4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/miglayout-4.0.jar -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=1f2d7de5 2 | build.xml.script.CRC32=762ba6ca 3 | build.xml.stylesheet.CRC32=f85dc8f2@1.97.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=1f2d7de5 7 | nbproject/build-impl.xml.script.CRC32=2c12c8b8 8 | nbproject/build-impl.xml.stylesheet.CRC32=d549e5cc@1.97.0.48 9 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=true 2 | user.properties.file=C:\\Users\\RAVEN\\AppData\\Roaming\\NetBeans\\12.2\\build.properties 3 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | ui-dashboard-002 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/component/Header.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/component/Header.java: -------------------------------------------------------------------------------- 1 | package com.raven.component; 2 | 3 | import com.raven.swing.shadow.ShadowRenderer; 4 | import java.awt.Color; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.event.ActionListener; 8 | import java.awt.event.MouseAdapter; 9 | import java.awt.event.MouseEvent; 10 | import java.awt.event.MouseMotionAdapter; 11 | import java.awt.image.BufferedImage; 12 | import javax.swing.JFrame; 13 | 14 | public class Header extends javax.swing.JPanel { 15 | 16 | public Header() { 17 | initComponents(); 18 | setBackground(new Color(250, 250, 250)); 19 | } 20 | 21 | @SuppressWarnings("unchecked") 22 | // //GEN-BEGIN:initComponents 23 | private void initComponents() { 24 | 25 | cmdMenu = new com.raven.swing.Button(); 26 | 27 | cmdMenu.setBackground(new java.awt.Color(250, 250, 250)); 28 | cmdMenu.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/raven/icon/menu.png"))); // NOI18N 29 | 30 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 31 | this.setLayout(layout); 32 | layout.setHorizontalGroup( 33 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 34 | .addGroup(layout.createSequentialGroup() 35 | .addContainerGap() 36 | .addComponent(cmdMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) 37 | .addContainerGap(344, Short.MAX_VALUE)) 38 | ); 39 | layout.setVerticalGroup( 40 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 41 | .addGroup(layout.createSequentialGroup() 42 | .addContainerGap() 43 | .addComponent(cmdMenu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 44 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 45 | ); 46 | }// //GEN-END:initComponents 47 | 48 | @Override 49 | protected void paintComponent(Graphics grphcs) { 50 | super.paintComponent(grphcs); 51 | int width = getWidth(); 52 | int height = getHeight() - 6; 53 | BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); 54 | Graphics2D g2 = img.createGraphics(); 55 | g2.setColor(getBackground()); 56 | g2.fillRect(0, 0, getWidth(), getHeight()); 57 | grphcs.drawImage(new ShadowRenderer(3, 0.3f, Color.GRAY).createShadow(img), -3, 0, null); 58 | grphcs.drawImage(img, 0, 0, null); 59 | } 60 | 61 | private int x; 62 | private int y; 63 | 64 | public void initMoving(JFrame fram) { 65 | this.addMouseListener(new MouseAdapter() { 66 | @Override 67 | public void mousePressed(MouseEvent me) { 68 | x = me.getX(); 69 | y = me.getY(); 70 | } 71 | 72 | }); 73 | this.addMouseMotionListener(new MouseMotionAdapter() { 74 | @Override 75 | public void mouseDragged(MouseEvent me) { 76 | fram.setLocation(me.getXOnScreen() - x, me.getYOnScreen() - y); 77 | } 78 | }); 79 | } 80 | 81 | public void addEventMenu(ActionListener event) { 82 | cmdMenu.addActionListener(event); 83 | } 84 | 85 | // Variables declaration - do not modify//GEN-BEGIN:variables 86 | private com.raven.swing.Button cmdMenu; 87 | // End of variables declaration//GEN-END:variables 88 | } 89 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/component/Menu.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
51 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/component/MenuLayout.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/component/MenuLayout.java: -------------------------------------------------------------------------------- 1 | package com.raven.component; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Color; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.event.MouseAdapter; 8 | 9 | public class MenuLayout extends javax.swing.JPanel { 10 | 11 | public boolean isShow() { 12 | return show; 13 | } 14 | 15 | public void setShow(boolean show) { 16 | this.show = show; 17 | } 18 | 19 | public float getAlpha() { 20 | return alpha; 21 | } 22 | 23 | public void setAlpha(float alpha) { 24 | this.alpha = alpha; 25 | } 26 | 27 | private boolean show; 28 | private float alpha; 29 | 30 | public MenuLayout() { 31 | initComponents(); 32 | setOpaque(false); 33 | setVisible(false); 34 | menu1.addMouseListener(new MouseAdapter() { 35 | }); 36 | } 37 | 38 | @SuppressWarnings("unchecked") 39 | // //GEN-BEGIN:initComponents 40 | private void initComponents() { 41 | 42 | menu1 = new com.raven.component.Menu(); 43 | 44 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 45 | this.setLayout(layout); 46 | layout.setHorizontalGroup( 47 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 48 | .addGroup(layout.createSequentialGroup() 49 | .addComponent(menu1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 50 | .addGap(0, 49, Short.MAX_VALUE)) 51 | ); 52 | layout.setVerticalGroup( 53 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 54 | .addComponent(menu1, javax.swing.GroupLayout.DEFAULT_SIZE, 537, Short.MAX_VALUE) 55 | ); 56 | }// //GEN-END:initComponents 57 | 58 | @Override 59 | protected void paintComponent(Graphics grphcs) { 60 | Graphics2D g2 = (Graphics2D) grphcs; 61 | g2.setColor(new Color(150, 150, 150)); 62 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); 63 | g2.fillRect(0, 0, getWidth(), getHeight()); 64 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f)); 65 | super.paintComponent(grphcs); 66 | } 67 | 68 | public Menu getMenu() { 69 | return menu1; 70 | } 71 | 72 | // Variables declaration - do not modify//GEN-BEGIN:variables 73 | private com.raven.component.Menu menu1; 74 | // End of variables declaration//GEN-END:variables 75 | } 76 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/component/Profile.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
50 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/component/Profile.java: -------------------------------------------------------------------------------- 1 | package com.raven.component; 2 | 3 | public class Profile extends javax.swing.JPanel { 4 | 5 | public Profile() { 6 | initComponents(); 7 | setOpaque(false); 8 | } 9 | 10 | @SuppressWarnings("unchecked") 11 | // //GEN-BEGIN:initComponents 12 | private void initComponents() { 13 | 14 | pic = new com.raven.swing.ImageAvatar(); 15 | 16 | pic.setForeground(new java.awt.Color(245, 245, 245)); 17 | pic.setBorderSize(2); 18 | pic.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/raven/icon/profile.jpg"))); // NOI18N 19 | 20 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 21 | this.setLayout(layout); 22 | layout.setHorizontalGroup( 23 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 24 | .addComponent(pic, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) 25 | ); 26 | layout.setVerticalGroup( 27 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 28 | .addGroup(layout.createSequentialGroup() 29 | .addGap(20, 20, 20) 30 | .addComponent(pic, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) 31 | .addGap(20, 20, 20)) 32 | ); 33 | }// //GEN-END:initComponents 34 | 35 | // Variables declaration - do not modify//GEN-BEGIN:variables 36 | private com.raven.swing.ImageAvatar pic; 37 | // End of variables declaration//GEN-END:variables 38 | } 39 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/event/EventMenuSelected.java: -------------------------------------------------------------------------------- 1 | package com.raven.event; 2 | 3 | public interface EventMenuSelected { 4 | 5 | public void selected(int index); 6 | } 7 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/1.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/10.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/2.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/3.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/4.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/5.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/6.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/7.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/8.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/9.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/flag.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/menu.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/profile.jpg -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/profit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/profit.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/search.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/staff.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/staff.jpg -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/icon/stock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 1/ui-dashboard-002/src/com/raven/icon/stock.png -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/main/Main.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
60 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/model/Model_Menu.java: -------------------------------------------------------------------------------- 1 | package com.raven.model; 2 | 3 | import javax.swing.Icon; 4 | import javax.swing.ImageIcon; 5 | 6 | public class Model_Menu { 7 | 8 | public String getIcon() { 9 | return icon; 10 | } 11 | 12 | public void setIcon(String icon) { 13 | this.icon = icon; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public MenuType getType() { 25 | return type; 26 | } 27 | 28 | public void setType(MenuType type) { 29 | this.type = type; 30 | } 31 | 32 | public Model_Menu(String icon, String name, MenuType type) { 33 | this.icon = icon; 34 | this.name = name; 35 | this.type = type; 36 | } 37 | 38 | public Model_Menu() { 39 | } 40 | 41 | private String icon; 42 | private String name; 43 | private MenuType type; 44 | 45 | public Icon toIcon() { 46 | return new ImageIcon(getClass().getResource("/com/raven/icon/" + icon + ".png")); 47 | } 48 | 49 | public static enum MenuType { 50 | TITLE, MENU, EMPTY 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/swing/Button.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Color; 5 | import java.awt.Cursor; 6 | import java.awt.Graphics; 7 | import java.awt.Graphics2D; 8 | import java.awt.Point; 9 | import java.awt.RenderingHints; 10 | import java.awt.event.MouseAdapter; 11 | import java.awt.event.MouseEvent; 12 | import java.awt.image.BufferedImage; 13 | import javax.swing.JButton; 14 | import javax.swing.border.EmptyBorder; 15 | import org.jdesktop.animation.timing.Animator; 16 | import org.jdesktop.animation.timing.TimingTarget; 17 | import org.jdesktop.animation.timing.TimingTargetAdapter; 18 | 19 | public class Button extends JButton { 20 | 21 | public Color getEffectColor() { 22 | return effectColor; 23 | } 24 | 25 | public void setEffectColor(Color effectColor) { 26 | this.effectColor = effectColor; 27 | } 28 | 29 | private Animator animator; 30 | private int targetSize; 31 | private float animatSize; 32 | private Point pressedPoint; 33 | private float alpha; 34 | private Color effectColor = new Color(173, 173, 173); 35 | 36 | public Button() { 37 | setContentAreaFilled(false); 38 | setBorder(new EmptyBorder(5, 0, 5, 0)); 39 | setBackground(Color.WHITE); 40 | setCursor(new Cursor(Cursor.HAND_CURSOR)); 41 | addMouseListener(new MouseAdapter() { 42 | @Override 43 | public void mousePressed(MouseEvent me) { 44 | targetSize = Math.max(getWidth(), getHeight()) * 2; 45 | animatSize = 0; 46 | pressedPoint = me.getPoint(); 47 | alpha = 0.5f; 48 | if (animator.isRunning()) { 49 | animator.stop(); 50 | } 51 | animator.start(); 52 | } 53 | }); 54 | TimingTarget target = new TimingTargetAdapter() { 55 | @Override 56 | public void timingEvent(float fraction) { 57 | if (fraction > 0.5f) { 58 | alpha = 1 - fraction; 59 | } 60 | animatSize = fraction * targetSize; 61 | repaint(); 62 | } 63 | }; 64 | animator = new Animator(400, target); 65 | } 66 | 67 | @Override 68 | protected void paintComponent(Graphics grphcs) { 69 | int width = getWidth(); 70 | int height = getHeight(); 71 | BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); 72 | Graphics2D g2 = img.createGraphics(); 73 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 74 | g2.setColor(getBackground()); 75 | g2.fillRoundRect(0, 0, width, height, 5, 5); 76 | if (pressedPoint != null) { 77 | g2.setColor(effectColor); 78 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); 79 | g2.fillOval((int) (pressedPoint.x - animatSize / 2), (int) (pressedPoint.y - animatSize / 2), (int) animatSize, (int) animatSize); 80 | } 81 | g2.dispose(); 82 | grphcs.drawImage(img, 0, 0, null); 83 | super.paintComponent(grphcs); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/swing/ImageAvatar.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Composite; 5 | import java.awt.Dimension; 6 | import java.awt.Graphics; 7 | import java.awt.Graphics2D; 8 | import java.awt.Image; 9 | import java.awt.RenderingHints; 10 | import java.awt.image.BufferedImage; 11 | import javax.swing.Icon; 12 | import javax.swing.ImageIcon; 13 | import javax.swing.JComponent; 14 | 15 | public class ImageAvatar extends JComponent { 16 | 17 | public Icon getIcon() { 18 | return icon; 19 | } 20 | 21 | public void setIcon(Icon icon) { 22 | this.icon = icon; 23 | } 24 | 25 | public int getBorderSize() { 26 | return borderSize; 27 | } 28 | 29 | public void setBorderSize(int borderSize) { 30 | this.borderSize = borderSize; 31 | } 32 | 33 | private Icon icon; 34 | private int borderSize; 35 | 36 | @Override 37 | protected void paintComponent(Graphics grphcs) { 38 | if (icon != null) { 39 | int width = getWidth(); 40 | int height = getHeight(); 41 | int diameter = Math.min(width, height); 42 | int x = width / 2 - diameter / 2; 43 | int y = height / 2 - diameter / 2; 44 | int border = borderSize * 2; 45 | diameter -= border; 46 | Dimension size = getAutoSize(icon, diameter); 47 | BufferedImage img = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB); 48 | Graphics2D g2_img = img.createGraphics(); 49 | g2_img.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 50 | g2_img.fillOval(0, 0, diameter, diameter); 51 | Composite composite = g2_img.getComposite(); 52 | g2_img.setComposite(AlphaComposite.SrcIn); 53 | g2_img.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); 54 | g2_img.drawImage(toImage(icon), 0, 0, size.width, size.height, null); 55 | g2_img.setComposite(composite); 56 | g2_img.dispose(); 57 | Graphics2D g2 = (Graphics2D) grphcs; 58 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 59 | if (borderSize > 0) { 60 | diameter += border; 61 | g2.setColor(getForeground()); 62 | g2.fillOval(x, y, diameter, diameter); 63 | } 64 | if (isOpaque()) { 65 | g2.setColor(getBackground()); 66 | diameter -= border; 67 | g2.fillOval(x + borderSize, y + borderSize, diameter, diameter); 68 | } 69 | g2.drawImage(img, x + borderSize, y + borderSize, null); 70 | } 71 | super.paintComponent(grphcs); 72 | } 73 | 74 | private Dimension getAutoSize(Icon image, int size) { 75 | int w = size; 76 | int h = size; 77 | int iw = image.getIconWidth(); 78 | int ih = image.getIconHeight(); 79 | double xScale = (double) w / iw; 80 | double yScale = (double) h / iw; 81 | double scale = Math.max(xScale, yScale); 82 | int width = (int) (scale * iw); 83 | int height = (int) (scale * ih); 84 | if (width < 1) { 85 | width = 1; 86 | } 87 | if (height < 1) { 88 | height = 1; 89 | } 90 | return new Dimension(width, height); 91 | } 92 | 93 | private Image toImage(Icon icon) { 94 | return ((ImageIcon) icon).getImage(); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/swing/MenuItem.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/swing/MenuItem.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import com.raven.model.Model_Menu; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.Graphics; 7 | import java.awt.Graphics2D; 8 | import java.awt.RenderingHints; 9 | 10 | public class MenuItem extends javax.swing.JPanel { 11 | 12 | private boolean selected; 13 | private boolean over; 14 | 15 | public MenuItem(Model_Menu data) { 16 | initComponents(); 17 | setOpaque(false); 18 | if (data.getType() == Model_Menu.MenuType.MENU) { 19 | lbIcon.setIcon(data.toIcon()); 20 | lbName.setText(data.getName()); 21 | } else if (data.getType() == Model_Menu.MenuType.TITLE) { 22 | lbIcon.setText(data.getName()); 23 | lbIcon.setFont(new Font("sansserif", 1, 12)); 24 | lbName.setVisible(false); 25 | } else { 26 | lbName.setText(" "); 27 | } 28 | } 29 | 30 | public void setSelected(boolean selected) { 31 | this.selected = selected; 32 | repaint(); 33 | } 34 | 35 | public void setOver(boolean over) { 36 | this.over = over; 37 | repaint(); 38 | } 39 | 40 | @SuppressWarnings("unchecked") 41 | // //GEN-BEGIN:initComponents 42 | private void initComponents() { 43 | 44 | lbIcon = new javax.swing.JLabel(); 45 | lbName = new javax.swing.JLabel(); 46 | 47 | lbIcon.setForeground(new java.awt.Color(255, 255, 255)); 48 | 49 | lbName.setForeground(new java.awt.Color(255, 255, 255)); 50 | lbName.setText("Menu Name"); 51 | 52 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 53 | this.setLayout(layout); 54 | layout.setHorizontalGroup( 55 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 56 | .addGroup(layout.createSequentialGroup() 57 | .addGap(20, 20, 20) 58 | .addComponent(lbIcon) 59 | .addGap(18, 18, 18) 60 | .addComponent(lbName) 61 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 62 | ); 63 | layout.setVerticalGroup( 64 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 65 | .addComponent(lbIcon, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 66 | .addComponent(lbName, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE) 67 | ); 68 | }// //GEN-END:initComponents 69 | 70 | @Override 71 | protected void paintComponent(Graphics grphcs) { 72 | if (selected || over) { 73 | Graphics2D g2 = (Graphics2D) grphcs; 74 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 75 | if (selected) { 76 | g2.setColor(new Color(255, 255, 255, 80)); 77 | } else { 78 | g2.setColor(new Color(255, 255, 255, 20)); 79 | } 80 | g2.fillRoundRect(10, 0, getWidth() - 20, getHeight(), 5, 5); 81 | } 82 | super.paintComponent(grphcs); 83 | } 84 | 85 | // Variables declaration - do not modify//GEN-BEGIN:variables 86 | private javax.swing.JLabel lbIcon; 87 | private javax.swing.JLabel lbName; 88 | // End of variables declaration//GEN-END:variables 89 | } 90 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/swing/ModernScrollBarUI.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | import java.awt.Graphics2D; 6 | import java.awt.Rectangle; 7 | import javax.swing.BorderFactory; 8 | import javax.swing.JButton; 9 | import javax.swing.JComponent; 10 | import javax.swing.JScrollBar; 11 | import javax.swing.plaf.basic.BasicScrollBarUI; 12 | 13 | public class ModernScrollBarUI extends BasicScrollBarUI { 14 | 15 | private static final int SCROLL_BAR_ALPHA_ROLLOVER = 60; 16 | private static final int SCROLL_BAR_ALPHA = 50; 17 | private static final int THUMB_SIZE = 8; 18 | 19 | public ModernScrollBarUI() { 20 | 21 | } 22 | 23 | @Override 24 | protected JButton createDecreaseButton(int orientation) { 25 | return new InvisibleScrollBarButton(); 26 | } 27 | 28 | @Override 29 | protected JButton createIncreaseButton(int orientation) { 30 | return new InvisibleScrollBarButton(); 31 | } 32 | 33 | @Override 34 | protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { 35 | } 36 | 37 | @Override 38 | protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { 39 | int alpha = isThumbRollover() ? SCROLL_BAR_ALPHA_ROLLOVER : SCROLL_BAR_ALPHA; 40 | int orientation = scrollbar.getOrientation(); 41 | int x = thumbBounds.x; 42 | int y = thumbBounds.y; 43 | int width = orientation == JScrollBar.VERTICAL ? THUMB_SIZE : thumbBounds.width; 44 | width = Math.max(width, THUMB_SIZE); 45 | int height = orientation == JScrollBar.VERTICAL ? thumbBounds.height : THUMB_SIZE; 46 | height = Math.max(height, THUMB_SIZE); 47 | Graphics2D graphics2D = (Graphics2D) g.create(); 48 | graphics2D.setColor(new Color(scrollbar.getForeground().getRed(), scrollbar.getForeground().getGreen(), scrollbar.getForeground().getBlue(), alpha)); 49 | graphics2D.fillRect(x, y, width, height); 50 | graphics2D.dispose(); 51 | } 52 | 53 | private static class InvisibleScrollBarButton extends JButton { 54 | 55 | private InvisibleScrollBarButton() { 56 | setOpaque(false); 57 | setFocusable(false); 58 | setFocusPainted(false); 59 | setBorderPainted(false); 60 | setBorder(BorderFactory.createEmptyBorder()); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Part 1/ui-dashboard-002/src/com/raven/swing/ScrollBar.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Dimension; 5 | import javax.swing.JScrollBar; 6 | 7 | public class ScrollBar extends JScrollBar { 8 | 9 | public ScrollBar() { 10 | setUI(new ModernScrollBarUI()); 11 | setPreferredSize(new Dimension(5, 5)); 12 | setBackground(new Color(250, 250, 250)); 13 | setUnitIncrement(20); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/TimingFramework-0.55.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/TimingFramework-0.55.jar -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/miglayout-4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/miglayout-4.0.jar -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=1f2d7de5 2 | build.xml.script.CRC32=762ba6ca 3 | build.xml.stylesheet.CRC32=f85dc8f2@1.97.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=1f2d7de5 7 | nbproject/build-impl.xml.script.CRC32=3d46ef2e 8 | nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.108.0.48 9 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=true 2 | user.properties.file=C:\\Users\\Raven\\AppData\\Roaming\\NetBeans\\19\\build.properties 3 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | ui-dashboard-002 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/ChartLine.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |
68 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/ChartPie.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |
68 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/ItemChartLine.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
54 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/ItemChartLine.java: -------------------------------------------------------------------------------- 1 | package com.raven.chart; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | import java.text.DecimalFormat; 6 | 7 | public class ItemChartLine extends javax.swing.JPanel { 8 | 9 | public ItemChartLine(ModelChartLine data) { 10 | initComponents(); 11 | setOpaque(false); 12 | DecimalFormat df = new DecimalFormat("$ #,##0.##"); 13 | lbName.setText(data.getName()); 14 | lbValues.setText(df.format(data.getValue())); 15 | } 16 | 17 | @SuppressWarnings("unchecked") 18 | // //GEN-BEGIN:initComponents 19 | private void initComponents() { 20 | 21 | lbName = new javax.swing.JLabel(); 22 | lbValues = new javax.swing.JLabel(); 23 | 24 | lbName.setForeground(new java.awt.Color(69, 69, 69)); 25 | lbName.setText("Name"); 26 | 27 | lbValues.setForeground(new java.awt.Color(69, 69, 69)); 28 | lbValues.setText("Values"); 29 | 30 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 31 | this.setLayout(layout); 32 | layout.setHorizontalGroup( 33 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 34 | .addGroup(layout.createSequentialGroup() 35 | .addContainerGap() 36 | .addComponent(lbName) 37 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 38 | .addComponent(lbValues) 39 | .addContainerGap()) 40 | ); 41 | layout.setVerticalGroup( 42 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 43 | .addComponent(lbValues, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 44 | .addComponent(lbName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 45 | ); 46 | }// //GEN-END:initComponents 47 | 48 | @Override 49 | protected void paintComponent(Graphics g) { 50 | // Create line 51 | g.setColor(new Color(240, 240, 240)); 52 | g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1); 53 | super.paintComponent(g); 54 | } 55 | 56 | // Variables declaration - do not modify//GEN-BEGIN:variables 57 | private javax.swing.JLabel lbName; 58 | private javax.swing.JLabel lbValues; 59 | // End of variables declaration//GEN-END:variables 60 | } 61 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/ItemChartPie.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
54 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/ItemChartPie.java: -------------------------------------------------------------------------------- 1 | package com.raven.chart; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | import java.text.DecimalFormat; 6 | 7 | public class ItemChartPie extends javax.swing.JPanel { 8 | 9 | private final ModelChartPie data; 10 | 11 | public ItemChartPie(ModelChartPie data) { 12 | this.data = data; 13 | initComponents(); 14 | setOpaque(false); 15 | DecimalFormat df = new DecimalFormat("$ #,##0.##"); 16 | lbName.setText(data.getName()); 17 | lbValues.setText(df.format(data.getValue())); 18 | } 19 | 20 | @SuppressWarnings("unchecked") 21 | // //GEN-BEGIN:initComponents 22 | private void initComponents() { 23 | 24 | lbName = new javax.swing.JLabel(); 25 | lbValues = new javax.swing.JLabel(); 26 | 27 | lbName.setForeground(new java.awt.Color(69, 69, 69)); 28 | lbName.setText("Name"); 29 | 30 | lbValues.setForeground(new java.awt.Color(69, 69, 69)); 31 | lbValues.setText("Values"); 32 | 33 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 34 | this.setLayout(layout); 35 | layout.setHorizontalGroup( 36 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 37 | .addGroup(layout.createSequentialGroup() 38 | .addGap(30, 30, 30) 39 | .addComponent(lbName) 40 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 41 | .addComponent(lbValues) 42 | .addContainerGap()) 43 | ); 44 | layout.setVerticalGroup( 45 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 46 | .addComponent(lbValues, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 47 | .addComponent(lbName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 48 | ); 49 | }// //GEN-END:initComponents 50 | 51 | @Override 52 | protected void paintComponent(Graphics g) { 53 | // Create line 54 | g.setColor(new Color(240, 240, 240)); 55 | g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1); 56 | int margin = 8; 57 | int size = getHeight() - margin * 2; 58 | g.setColor(data.getColor()); 59 | g.fillRect(margin, margin, size, size); 60 | super.paintComponent(g); 61 | } 62 | 63 | // Variables declaration - do not modify//GEN-BEGIN:variables 64 | private javax.swing.JLabel lbName; 65 | private javax.swing.JLabel lbValues; 66 | // End of variables declaration//GEN-END:variables 67 | } 68 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/ModelChartLine.java: -------------------------------------------------------------------------------- 1 | package com.raven.chart; 2 | 3 | public class ModelChartLine { 4 | 5 | public String getName() { 6 | return name; 7 | } 8 | 9 | public void setName(String name) { 10 | this.name = name; 11 | } 12 | 13 | public double getValue() { 14 | return value; 15 | } 16 | 17 | public void setValue(double value) { 18 | this.value = value; 19 | } 20 | 21 | public ModelChartLine(String name, double value) { 22 | this.name = name; 23 | this.value = value; 24 | } 25 | 26 | public ModelChartLine() { 27 | } 28 | 29 | private String name; 30 | private double value; 31 | } 32 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/ModelChartPie.java: -------------------------------------------------------------------------------- 1 | package com.raven.chart; 2 | 3 | import java.awt.Color; 4 | 5 | public class ModelChartPie { 6 | 7 | public String getName() { 8 | return name; 9 | } 10 | 11 | public void setName(String name) { 12 | this.name = name; 13 | } 14 | 15 | public double getValue() { 16 | return value; 17 | } 18 | 19 | public void setValue(double value) { 20 | this.value = value; 21 | } 22 | 23 | public Color getColor() { 24 | return color; 25 | } 26 | 27 | public void setColor(Color color) { 28 | this.color = color; 29 | } 30 | 31 | public ModelChartPie(String name, double value, Color color) { 32 | this.name = name; 33 | this.value = value; 34 | this.color = color; 35 | } 36 | 37 | public ModelChartPie() { 38 | } 39 | 40 | private String name; 41 | private double value; 42 | private Color color; 43 | } 44 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/PanelChartLine.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/PanelChartPie.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/chart/PanelChartPie.java: -------------------------------------------------------------------------------- 1 | package com.raven.chart; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Color; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.RenderingHints; 8 | import java.awt.Shape; 9 | import java.awt.geom.Arc2D; 10 | import java.awt.geom.Ellipse2D; 11 | import java.awt.image.BufferedImage; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class PanelChartPie extends javax.swing.JPanel { 16 | 17 | private final List list; 18 | private float chartSize = 0.5f; 19 | 20 | public PanelChartPie() { 21 | initComponents(); 22 | list = new ArrayList<>(); 23 | setBackground(new Color(250, 250, 250)); 24 | setOpaque(false); 25 | } 26 | 27 | private double getTotal() { 28 | double total = 0; 29 | for (ModelChartPie d : list) { 30 | total += d.getValue(); 31 | } 32 | return total; 33 | } 34 | 35 | @Override 36 | protected void paintComponent(Graphics grphcs) { 37 | int width = getWidth(); 38 | int height = getHeight(); 39 | int size = Math.min(width, height); 40 | BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); 41 | Graphics2D g2 = img.createGraphics(); 42 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 43 | double x = (width - size) / 2; 44 | double y = (height - size) / 2; 45 | Shape area = new Ellipse2D.Double(x, y, size, size); 46 | g2.setColor(getBackground()); 47 | g2.fill(area); 48 | double total = getTotal(); 49 | double curvalu = 0; 50 | for (ModelChartPie data : list) { 51 | double startAngle = (curvalu * 360f / total) + 90; // +90 to start from 90 angle 52 | double angle = (data.getValue() * 360f / total); 53 | g2.setColor(data.getColor()); 54 | Shape shape = new Arc2D.Double(x, y, size, size, startAngle, angle, Arc2D.PIE); 55 | g2.fill(shape); 56 | curvalu += data.getValue(); 57 | } 58 | double inSize = size * chartSize; 59 | double x1 = (width - inSize) / 2; 60 | double y1 = (height - inSize) / 2; 61 | Shape cut = new Ellipse2D.Double(x1, y1, inSize, inSize); 62 | g2.setComposite(AlphaComposite.Clear); 63 | g2.fill(cut); 64 | grphcs.drawImage(img, 0, 0, null); 65 | super.paintComponent(grphcs); 66 | } 67 | 68 | public void addItem(ModelChartPie data) { 69 | list.add(data); 70 | repaint(); 71 | } 72 | 73 | public void removeAllData() { 74 | list.clear(); 75 | repaint(); 76 | } 77 | 78 | @SuppressWarnings("unchecked") 79 | // //GEN-BEGIN:initComponents 80 | private void initComponents() { 81 | 82 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 83 | this.setLayout(layout); 84 | layout.setHorizontalGroup( 85 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 86 | .addGap(0, 248, Short.MAX_VALUE) 87 | ); 88 | layout.setVerticalGroup( 89 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 90 | .addGap(0, 197, Short.MAX_VALUE) 91 | ); 92 | }// //GEN-END:initComponents 93 | 94 | // Variables declaration - do not modify//GEN-BEGIN:variables 95 | // End of variables declaration//GEN-END:variables 96 | } 97 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/component/Header.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/component/Menu.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
51 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/component/MenuLayout.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/component/MenuLayout.java: -------------------------------------------------------------------------------- 1 | package com.raven.component; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Color; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.event.MouseAdapter; 8 | 9 | public class MenuLayout extends javax.swing.JPanel { 10 | 11 | public boolean isShow() { 12 | return show; 13 | } 14 | 15 | public void setShow(boolean show) { 16 | this.show = show; 17 | } 18 | 19 | public float getAlpha() { 20 | return alpha; 21 | } 22 | 23 | public void setAlpha(float alpha) { 24 | this.alpha = alpha; 25 | } 26 | 27 | private boolean show; 28 | private float alpha; 29 | 30 | public MenuLayout() { 31 | initComponents(); 32 | setOpaque(false); 33 | setVisible(false); 34 | menu1.addMouseListener(new MouseAdapter() { 35 | }); 36 | } 37 | 38 | @SuppressWarnings("unchecked") 39 | // //GEN-BEGIN:initComponents 40 | private void initComponents() { 41 | 42 | menu1 = new com.raven.component.Menu(); 43 | 44 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 45 | this.setLayout(layout); 46 | layout.setHorizontalGroup( 47 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 48 | .addGroup(layout.createSequentialGroup() 49 | .addComponent(menu1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 50 | .addGap(0, 49, Short.MAX_VALUE)) 51 | ); 52 | layout.setVerticalGroup( 53 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 54 | .addComponent(menu1, javax.swing.GroupLayout.DEFAULT_SIZE, 537, Short.MAX_VALUE) 55 | ); 56 | }// //GEN-END:initComponents 57 | 58 | @Override 59 | protected void paintComponent(Graphics grphcs) { 60 | Graphics2D g2 = (Graphics2D) grphcs; 61 | g2.setColor(new Color(150, 150, 150)); 62 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); 63 | g2.fillRect(0, 0, getWidth(), getHeight()); 64 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f)); 65 | super.paintComponent(grphcs); 66 | } 67 | 68 | public Menu getMenu() { 69 | return menu1; 70 | } 71 | 72 | // Variables declaration - do not modify//GEN-BEGIN:variables 73 | private com.raven.component.Menu menu1; 74 | // End of variables declaration//GEN-END:variables 75 | } 76 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/component/Profile.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
50 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/component/Profile.java: -------------------------------------------------------------------------------- 1 | package com.raven.component; 2 | 3 | public class Profile extends javax.swing.JPanel { 4 | 5 | public Profile() { 6 | initComponents(); 7 | setOpaque(false); 8 | } 9 | 10 | @SuppressWarnings("unchecked") 11 | // //GEN-BEGIN:initComponents 12 | private void initComponents() { 13 | 14 | pic = new com.raven.swing.ImageAvatar(); 15 | 16 | pic.setForeground(new java.awt.Color(245, 245, 245)); 17 | pic.setBorderSize(2); 18 | pic.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/raven/icon/profile.jpg"))); // NOI18N 19 | 20 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 21 | this.setLayout(layout); 22 | layout.setHorizontalGroup( 23 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 24 | .addComponent(pic, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) 25 | ); 26 | layout.setVerticalGroup( 27 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 28 | .addGroup(layout.createSequentialGroup() 29 | .addGap(20, 20, 20) 30 | .addComponent(pic, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) 31 | .addGap(20, 20, 20)) 32 | ); 33 | }// //GEN-END:initComponents 34 | 35 | // Variables declaration - do not modify//GEN-BEGIN:variables 36 | private com.raven.swing.ImageAvatar pic; 37 | // End of variables declaration//GEN-END:variables 38 | } 39 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/event/EventMenuSelected.java: -------------------------------------------------------------------------------- 1 | package com.raven.event; 2 | 3 | public interface EventMenuSelected { 4 | 5 | public void selected(int index); 6 | } 7 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/form/Form_1.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/form/MainForm.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
55 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/form/MainForm.java: -------------------------------------------------------------------------------- 1 | package com.raven.form; 2 | 3 | import java.awt.Component; 4 | import java.awt.event.ActionListener; 5 | import javax.swing.JFrame; 6 | 7 | public class MainForm extends javax.swing.JPanel { 8 | 9 | public MainForm() { 10 | initComponents(); 11 | show(new Form_1()); 12 | } 13 | 14 | @SuppressWarnings("unchecked") 15 | // //GEN-BEGIN:initComponents 16 | private void initComponents() { 17 | 18 | header1 = new com.raven.component.Header(); 19 | body = new javax.swing.JPanel(); 20 | 21 | setBackground(new java.awt.Color(250, 250, 250)); 22 | 23 | body.setOpaque(false); 24 | body.setLayout(new java.awt.BorderLayout()); 25 | 26 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 27 | this.setLayout(layout); 28 | layout.setHorizontalGroup( 29 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 30 | .addComponent(header1, javax.swing.GroupLayout.DEFAULT_SIZE, 809, Short.MAX_VALUE) 31 | .addGroup(layout.createSequentialGroup() 32 | .addContainerGap() 33 | .addComponent(body, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 34 | .addContainerGap()) 35 | ); 36 | layout.setVerticalGroup( 37 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 38 | .addGroup(layout.createSequentialGroup() 39 | .addComponent(header1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 40 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 41 | .addComponent(body, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 42 | .addContainerGap()) 43 | ); 44 | }// //GEN-END:initComponents 45 | 46 | public void addEventMenu(ActionListener event) { 47 | header1.addEventMenu(event); 48 | } 49 | 50 | public void initMoving(JFrame fram) { 51 | header1.initMoving(fram); 52 | } 53 | 54 | public void show(Component com) { 55 | body.removeAll(); 56 | body.add(com); 57 | body.repaint(); 58 | body.revalidate(); 59 | } 60 | 61 | // Variables declaration - do not modify//GEN-BEGIN:variables 62 | private javax.swing.JPanel body; 63 | private com.raven.component.Header header1; 64 | // End of variables declaration//GEN-END:variables 65 | } 66 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/1.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/10.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/2.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/3.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/4.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/5.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/6.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/7.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/8.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/9.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/flag.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/menu.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/profile.jpg -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/profit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/profit.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/search.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/staff.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/staff.jpg -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/icon/stock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 2/ui-dashboard-002/src/com/raven/icon/stock.png -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/main/Main.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
60 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/model/Model_Menu.java: -------------------------------------------------------------------------------- 1 | package com.raven.model; 2 | 3 | import javax.swing.Icon; 4 | import javax.swing.ImageIcon; 5 | 6 | public class Model_Menu { 7 | 8 | public String getIcon() { 9 | return icon; 10 | } 11 | 12 | public void setIcon(String icon) { 13 | this.icon = icon; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public MenuType getType() { 25 | return type; 26 | } 27 | 28 | public void setType(MenuType type) { 29 | this.type = type; 30 | } 31 | 32 | public Model_Menu(String icon, String name, MenuType type) { 33 | this.icon = icon; 34 | this.name = name; 35 | this.type = type; 36 | } 37 | 38 | public Model_Menu() { 39 | } 40 | 41 | private String icon; 42 | private String name; 43 | private MenuType type; 44 | 45 | public Icon toIcon() { 46 | return new ImageIcon(getClass().getResource("/com/raven/icon/" + icon + ".png")); 47 | } 48 | 49 | public static enum MenuType { 50 | TITLE, MENU, EMPTY 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/swing/Button.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Color; 5 | import java.awt.Cursor; 6 | import java.awt.Graphics; 7 | import java.awt.Graphics2D; 8 | import java.awt.Point; 9 | import java.awt.RenderingHints; 10 | import java.awt.event.MouseAdapter; 11 | import java.awt.event.MouseEvent; 12 | import java.awt.image.BufferedImage; 13 | import javax.swing.JButton; 14 | import javax.swing.border.EmptyBorder; 15 | import org.jdesktop.animation.timing.Animator; 16 | import org.jdesktop.animation.timing.TimingTarget; 17 | import org.jdesktop.animation.timing.TimingTargetAdapter; 18 | 19 | public class Button extends JButton { 20 | 21 | public Color getEffectColor() { 22 | return effectColor; 23 | } 24 | 25 | public void setEffectColor(Color effectColor) { 26 | this.effectColor = effectColor; 27 | } 28 | 29 | private Animator animator; 30 | private int targetSize; 31 | private float animatSize; 32 | private Point pressedPoint; 33 | private float alpha; 34 | private Color effectColor = new Color(173, 173, 173); 35 | 36 | public Button() { 37 | setContentAreaFilled(false); 38 | setBorder(new EmptyBorder(5, 0, 5, 0)); 39 | setBackground(Color.WHITE); 40 | setCursor(new Cursor(Cursor.HAND_CURSOR)); 41 | addMouseListener(new MouseAdapter() { 42 | @Override 43 | public void mousePressed(MouseEvent me) { 44 | targetSize = Math.max(getWidth(), getHeight()) * 2; 45 | animatSize = 0; 46 | pressedPoint = me.getPoint(); 47 | alpha = 0.5f; 48 | if (animator.isRunning()) { 49 | animator.stop(); 50 | } 51 | animator.start(); 52 | } 53 | }); 54 | TimingTarget target = new TimingTargetAdapter() { 55 | @Override 56 | public void timingEvent(float fraction) { 57 | if (fraction > 0.5f) { 58 | alpha = 1 - fraction; 59 | } 60 | animatSize = fraction * targetSize; 61 | repaint(); 62 | } 63 | }; 64 | animator = new Animator(400, target); 65 | } 66 | 67 | @Override 68 | protected void paintComponent(Graphics grphcs) { 69 | int width = getWidth(); 70 | int height = getHeight(); 71 | BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); 72 | Graphics2D g2 = img.createGraphics(); 73 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 74 | g2.setColor(getBackground()); 75 | g2.fillRoundRect(0, 0, width, height, 5, 5); 76 | if (pressedPoint != null) { 77 | g2.setColor(effectColor); 78 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); 79 | g2.fillOval((int) (pressedPoint.x - animatSize / 2), (int) (pressedPoint.y - animatSize / 2), (int) animatSize, (int) animatSize); 80 | } 81 | g2.dispose(); 82 | grphcs.drawImage(img, 0, 0, null); 83 | super.paintComponent(grphcs); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/swing/ImageAvatar.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Composite; 5 | import java.awt.Dimension; 6 | import java.awt.Graphics; 7 | import java.awt.Graphics2D; 8 | import java.awt.Image; 9 | import java.awt.RenderingHints; 10 | import java.awt.image.BufferedImage; 11 | import javax.swing.Icon; 12 | import javax.swing.ImageIcon; 13 | import javax.swing.JComponent; 14 | 15 | public class ImageAvatar extends JComponent { 16 | 17 | public Icon getIcon() { 18 | return icon; 19 | } 20 | 21 | public void setIcon(Icon icon) { 22 | this.icon = icon; 23 | } 24 | 25 | public int getBorderSize() { 26 | return borderSize; 27 | } 28 | 29 | public void setBorderSize(int borderSize) { 30 | this.borderSize = borderSize; 31 | } 32 | 33 | private Icon icon; 34 | private int borderSize; 35 | 36 | @Override 37 | protected void paintComponent(Graphics grphcs) { 38 | if (icon != null) { 39 | int width = getWidth(); 40 | int height = getHeight(); 41 | int diameter = Math.min(width, height); 42 | int x = width / 2 - diameter / 2; 43 | int y = height / 2 - diameter / 2; 44 | int border = borderSize * 2; 45 | diameter -= border; 46 | Dimension size = getAutoSize(icon, diameter); 47 | BufferedImage img = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB); 48 | Graphics2D g2_img = img.createGraphics(); 49 | g2_img.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 50 | g2_img.fillOval(0, 0, diameter, diameter); 51 | Composite composite = g2_img.getComposite(); 52 | g2_img.setComposite(AlphaComposite.SrcIn); 53 | g2_img.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); 54 | g2_img.drawImage(toImage(icon), 0, 0, size.width, size.height, null); 55 | g2_img.setComposite(composite); 56 | g2_img.dispose(); 57 | Graphics2D g2 = (Graphics2D) grphcs; 58 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 59 | if (borderSize > 0) { 60 | diameter += border; 61 | g2.setColor(getForeground()); 62 | g2.fillOval(x, y, diameter, diameter); 63 | } 64 | if (isOpaque()) { 65 | g2.setColor(getBackground()); 66 | diameter -= border; 67 | g2.fillOval(x + borderSize, y + borderSize, diameter, diameter); 68 | } 69 | g2.drawImage(img, x + borderSize, y + borderSize, null); 70 | } 71 | super.paintComponent(grphcs); 72 | } 73 | 74 | private Dimension getAutoSize(Icon image, int size) { 75 | int w = size; 76 | int h = size; 77 | int iw = image.getIconWidth(); 78 | int ih = image.getIconHeight(); 79 | double xScale = (double) w / iw; 80 | double yScale = (double) h / iw; 81 | double scale = Math.max(xScale, yScale); 82 | int width = (int) (scale * iw); 83 | int height = (int) (scale * ih); 84 | if (width < 1) { 85 | width = 1; 86 | } 87 | if (height < 1) { 88 | height = 1; 89 | } 90 | return new Dimension(width, height); 91 | } 92 | 93 | private Image toImage(Icon icon) { 94 | return ((ImageIcon) icon).getImage(); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/swing/MenuItem.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/swing/MenuItem.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import com.raven.model.Model_Menu; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.Graphics; 7 | import java.awt.Graphics2D; 8 | import java.awt.RenderingHints; 9 | 10 | public class MenuItem extends javax.swing.JPanel { 11 | 12 | private boolean selected; 13 | private boolean over; 14 | 15 | public MenuItem(Model_Menu data) { 16 | initComponents(); 17 | setOpaque(false); 18 | if (data.getType() == Model_Menu.MenuType.MENU) { 19 | lbIcon.setIcon(data.toIcon()); 20 | lbName.setText(data.getName()); 21 | } else if (data.getType() == Model_Menu.MenuType.TITLE) { 22 | lbIcon.setText(data.getName()); 23 | lbIcon.setFont(new Font("sansserif", 1, 12)); 24 | lbName.setVisible(false); 25 | } else { 26 | lbName.setText(" "); 27 | } 28 | } 29 | 30 | public void setSelected(boolean selected) { 31 | this.selected = selected; 32 | repaint(); 33 | } 34 | 35 | public void setOver(boolean over) { 36 | this.over = over; 37 | repaint(); 38 | } 39 | 40 | @SuppressWarnings("unchecked") 41 | // //GEN-BEGIN:initComponents 42 | private void initComponents() { 43 | 44 | lbIcon = new javax.swing.JLabel(); 45 | lbName = new javax.swing.JLabel(); 46 | 47 | lbIcon.setForeground(new java.awt.Color(255, 255, 255)); 48 | 49 | lbName.setForeground(new java.awt.Color(255, 255, 255)); 50 | lbName.setText("Menu Name"); 51 | 52 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 53 | this.setLayout(layout); 54 | layout.setHorizontalGroup( 55 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 56 | .addGroup(layout.createSequentialGroup() 57 | .addGap(20, 20, 20) 58 | .addComponent(lbIcon) 59 | .addGap(18, 18, 18) 60 | .addComponent(lbName) 61 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 62 | ); 63 | layout.setVerticalGroup( 64 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 65 | .addComponent(lbIcon, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 66 | .addComponent(lbName, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE) 67 | ); 68 | }// //GEN-END:initComponents 69 | 70 | @Override 71 | protected void paintComponent(Graphics grphcs) { 72 | if (selected || over) { 73 | Graphics2D g2 = (Graphics2D) grphcs; 74 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 75 | if (selected) { 76 | g2.setColor(new Color(255, 255, 255, 80)); 77 | } else { 78 | g2.setColor(new Color(255, 255, 255, 20)); 79 | } 80 | g2.fillRoundRect(10, 0, getWidth() - 20, getHeight(), 5, 5); 81 | } 82 | super.paintComponent(grphcs); 83 | } 84 | 85 | // Variables declaration - do not modify//GEN-BEGIN:variables 86 | private javax.swing.JLabel lbIcon; 87 | private javax.swing.JLabel lbName; 88 | // End of variables declaration//GEN-END:variables 89 | } 90 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/swing/ModernScrollBarUI.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | import java.awt.Graphics2D; 6 | import java.awt.Rectangle; 7 | import javax.swing.BorderFactory; 8 | import javax.swing.JButton; 9 | import javax.swing.JComponent; 10 | import javax.swing.JScrollBar; 11 | import javax.swing.plaf.basic.BasicScrollBarUI; 12 | 13 | public class ModernScrollBarUI extends BasicScrollBarUI { 14 | 15 | private static final int SCROLL_BAR_ALPHA_ROLLOVER = 60; 16 | private static final int SCROLL_BAR_ALPHA = 50; 17 | private static final int THUMB_SIZE = 8; 18 | 19 | public ModernScrollBarUI() { 20 | 21 | } 22 | 23 | @Override 24 | protected JButton createDecreaseButton(int orientation) { 25 | return new InvisibleScrollBarButton(); 26 | } 27 | 28 | @Override 29 | protected JButton createIncreaseButton(int orientation) { 30 | return new InvisibleScrollBarButton(); 31 | } 32 | 33 | @Override 34 | protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { 35 | } 36 | 37 | @Override 38 | protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { 39 | int alpha = isThumbRollover() ? SCROLL_BAR_ALPHA_ROLLOVER : SCROLL_BAR_ALPHA; 40 | int orientation = scrollbar.getOrientation(); 41 | int x = thumbBounds.x; 42 | int y = thumbBounds.y; 43 | int width = orientation == JScrollBar.VERTICAL ? THUMB_SIZE : thumbBounds.width; 44 | width = Math.max(width, THUMB_SIZE); 45 | int height = orientation == JScrollBar.VERTICAL ? thumbBounds.height : THUMB_SIZE; 46 | height = Math.max(height, THUMB_SIZE); 47 | Graphics2D graphics2D = (Graphics2D) g.create(); 48 | graphics2D.setColor(new Color(scrollbar.getForeground().getRed(), scrollbar.getForeground().getGreen(), scrollbar.getForeground().getBlue(), alpha)); 49 | graphics2D.fillRect(x, y, width, height); 50 | graphics2D.dispose(); 51 | } 52 | 53 | private static class InvisibleScrollBarButton extends JButton { 54 | 55 | private InvisibleScrollBarButton() { 56 | setOpaque(false); 57 | setFocusable(false); 58 | setFocusPainted(false); 59 | setBorderPainted(false); 60 | setBorder(BorderFactory.createEmptyBorder()); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Part 2/ui-dashboard-002/src/com/raven/swing/ScrollBar.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Dimension; 5 | import javax.swing.JScrollBar; 6 | 7 | public class ScrollBar extends JScrollBar { 8 | 9 | public ScrollBar() { 10 | setUI(new ModernScrollBarUI()); 11 | setPreferredSize(new Dimension(5, 5)); 12 | setBackground(new Color(250, 250, 250)); 13 | setUnitIncrement(20); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/TimingFramework-0.55.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/TimingFramework-0.55.jar -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/miglayout-4.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/miglayout-4.0.jar -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=1f2d7de5 2 | build.xml.script.CRC32=762ba6ca 3 | build.xml.stylesheet.CRC32=f85dc8f2@1.97.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=1f2d7de5 7 | nbproject/build-impl.xml.script.CRC32=3d46ef2e 8 | nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.108.0.48 9 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=true 2 | user.properties.file=C:\\Users\\Raven\\AppData\\Roaming\\NetBeans\\19\\build.properties 3 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | file:/D:/Raven/youtube/ui%20design/ui-dashboard%20002/working%20project/Part%201/ui-dashboard-002/src/com/raven/form/Form_2.java 7 | file:/D:/Raven/youtube/ui%20design/ui-dashboard%20002/working%20project/Part%201/ui-dashboard-002/src/com/raven/main/Main.java 8 | file:/D:/Raven/youtube/ui%20design/ui-dashboard%20002/working%20project/Part%201/ui-dashboard-002/src/com/raven/form/MainForm.java 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | ui-dashboard-002 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/ChartLine.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |
68 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/ChartPie.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 |
68 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/ItemChartLine.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
54 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/ItemChartLine.java: -------------------------------------------------------------------------------- 1 | package com.raven.chart; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | import java.text.DecimalFormat; 6 | 7 | public class ItemChartLine extends javax.swing.JPanel { 8 | 9 | public ItemChartLine(ModelChartLine data) { 10 | initComponents(); 11 | setOpaque(false); 12 | DecimalFormat df = new DecimalFormat("$ #,##0.##"); 13 | lbName.setText(data.getName()); 14 | lbValues.setText(df.format(data.getValue())); 15 | } 16 | 17 | @SuppressWarnings("unchecked") 18 | // //GEN-BEGIN:initComponents 19 | private void initComponents() { 20 | 21 | lbName = new javax.swing.JLabel(); 22 | lbValues = new javax.swing.JLabel(); 23 | 24 | lbName.setForeground(new java.awt.Color(69, 69, 69)); 25 | lbName.setText("Name"); 26 | 27 | lbValues.setForeground(new java.awt.Color(69, 69, 69)); 28 | lbValues.setText("Values"); 29 | 30 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 31 | this.setLayout(layout); 32 | layout.setHorizontalGroup( 33 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 34 | .addGroup(layout.createSequentialGroup() 35 | .addContainerGap() 36 | .addComponent(lbName) 37 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 38 | .addComponent(lbValues) 39 | .addContainerGap()) 40 | ); 41 | layout.setVerticalGroup( 42 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 43 | .addComponent(lbValues, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 44 | .addComponent(lbName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 45 | ); 46 | }// //GEN-END:initComponents 47 | 48 | @Override 49 | protected void paintComponent(Graphics g) { 50 | // Create line 51 | g.setColor(new Color(240, 240, 240)); 52 | g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1); 53 | super.paintComponent(g); 54 | } 55 | 56 | // Variables declaration - do not modify//GEN-BEGIN:variables 57 | private javax.swing.JLabel lbName; 58 | private javax.swing.JLabel lbValues; 59 | // End of variables declaration//GEN-END:variables 60 | } 61 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/ItemChartPie.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |
54 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/ItemChartPie.java: -------------------------------------------------------------------------------- 1 | package com.raven.chart; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | import java.text.DecimalFormat; 6 | 7 | public class ItemChartPie extends javax.swing.JPanel { 8 | 9 | private final ModelChartPie data; 10 | 11 | public ItemChartPie(ModelChartPie data) { 12 | this.data = data; 13 | initComponents(); 14 | setOpaque(false); 15 | DecimalFormat df = new DecimalFormat("$ #,##0.##"); 16 | lbName.setText(data.getName()); 17 | lbValues.setText(df.format(data.getValue())); 18 | } 19 | 20 | @SuppressWarnings("unchecked") 21 | // //GEN-BEGIN:initComponents 22 | private void initComponents() { 23 | 24 | lbName = new javax.swing.JLabel(); 25 | lbValues = new javax.swing.JLabel(); 26 | 27 | lbName.setForeground(new java.awt.Color(69, 69, 69)); 28 | lbName.setText("Name"); 29 | 30 | lbValues.setForeground(new java.awt.Color(69, 69, 69)); 31 | lbValues.setText("Values"); 32 | 33 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 34 | this.setLayout(layout); 35 | layout.setHorizontalGroup( 36 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 37 | .addGroup(layout.createSequentialGroup() 38 | .addGap(30, 30, 30) 39 | .addComponent(lbName) 40 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 41 | .addComponent(lbValues) 42 | .addContainerGap()) 43 | ); 44 | layout.setVerticalGroup( 45 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 46 | .addComponent(lbValues, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 47 | .addComponent(lbName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 48 | ); 49 | }// //GEN-END:initComponents 50 | 51 | @Override 52 | protected void paintComponent(Graphics g) { 53 | // Create line 54 | g.setColor(new Color(240, 240, 240)); 55 | g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1); 56 | int margin = 8; 57 | int size = getHeight() - margin * 2; 58 | g.setColor(data.getColor()); 59 | g.fillRect(margin, margin, size, size); 60 | super.paintComponent(g); 61 | } 62 | 63 | // Variables declaration - do not modify//GEN-BEGIN:variables 64 | private javax.swing.JLabel lbName; 65 | private javax.swing.JLabel lbValues; 66 | // End of variables declaration//GEN-END:variables 67 | } 68 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/ModelChartLine.java: -------------------------------------------------------------------------------- 1 | package com.raven.chart; 2 | 3 | public class ModelChartLine { 4 | 5 | public String getName() { 6 | return name; 7 | } 8 | 9 | public void setName(String name) { 10 | this.name = name; 11 | } 12 | 13 | public double getValue() { 14 | return value; 15 | } 16 | 17 | public void setValue(double value) { 18 | this.value = value; 19 | } 20 | 21 | public ModelChartLine(String name, double value) { 22 | this.name = name; 23 | this.value = value; 24 | } 25 | 26 | public ModelChartLine() { 27 | } 28 | 29 | private String name; 30 | private double value; 31 | } 32 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/ModelChartPie.java: -------------------------------------------------------------------------------- 1 | package com.raven.chart; 2 | 3 | import java.awt.Color; 4 | 5 | public class ModelChartPie { 6 | 7 | public String getName() { 8 | return name; 9 | } 10 | 11 | public void setName(String name) { 12 | this.name = name; 13 | } 14 | 15 | public double getValue() { 16 | return value; 17 | } 18 | 19 | public void setValue(double value) { 20 | this.value = value; 21 | } 22 | 23 | public Color getColor() { 24 | return color; 25 | } 26 | 27 | public void setColor(Color color) { 28 | this.color = color; 29 | } 30 | 31 | public ModelChartPie(String name, double value, Color color) { 32 | this.name = name; 33 | this.value = value; 34 | this.color = color; 35 | } 36 | 37 | public ModelChartPie() { 38 | } 39 | 40 | private String name; 41 | private double value; 42 | private Color color; 43 | } 44 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/PanelChartLine.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/PanelChartPie.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/chart/PanelChartPie.java: -------------------------------------------------------------------------------- 1 | package com.raven.chart; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Color; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.RenderingHints; 8 | import java.awt.Shape; 9 | import java.awt.geom.Arc2D; 10 | import java.awt.geom.Ellipse2D; 11 | import java.awt.image.BufferedImage; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | public class PanelChartPie extends javax.swing.JPanel { 16 | 17 | private final List list; 18 | private float chartSize = 0.5f; 19 | 20 | public PanelChartPie() { 21 | initComponents(); 22 | list = new ArrayList<>(); 23 | setBackground(new Color(250, 250, 250)); 24 | setOpaque(false); 25 | } 26 | 27 | private double getTotal() { 28 | double total = 0; 29 | for (ModelChartPie d : list) { 30 | total += d.getValue(); 31 | } 32 | return total; 33 | } 34 | 35 | @Override 36 | protected void paintComponent(Graphics grphcs) { 37 | int width = getWidth(); 38 | int height = getHeight(); 39 | int size = Math.min(width, height); 40 | BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); 41 | Graphics2D g2 = img.createGraphics(); 42 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 43 | double x = (width - size) / 2; 44 | double y = (height - size) / 2; 45 | Shape area = new Ellipse2D.Double(x, y, size, size); 46 | g2.setColor(getBackground()); 47 | g2.fill(area); 48 | double total = getTotal(); 49 | double curvalu = 0; 50 | for (ModelChartPie data : list) { 51 | double startAngle = (curvalu * 360f / total) + 90; // +90 to start from 90 angle 52 | double angle = (data.getValue() * 360f / total); 53 | g2.setColor(data.getColor()); 54 | Shape shape = new Arc2D.Double(x, y, size, size, startAngle, angle, Arc2D.PIE); 55 | g2.fill(shape); 56 | curvalu += data.getValue(); 57 | } 58 | double inSize = size * chartSize; 59 | double x1 = (width - inSize) / 2; 60 | double y1 = (height - inSize) / 2; 61 | Shape cut = new Ellipse2D.Double(x1, y1, inSize, inSize); 62 | g2.setComposite(AlphaComposite.Clear); 63 | g2.fill(cut); 64 | grphcs.drawImage(img, 0, 0, null); 65 | super.paintComponent(grphcs); 66 | } 67 | 68 | public void addItem(ModelChartPie data) { 69 | list.add(data); 70 | repaint(); 71 | } 72 | 73 | public void removeAllData() { 74 | list.clear(); 75 | repaint(); 76 | } 77 | 78 | @SuppressWarnings("unchecked") 79 | // //GEN-BEGIN:initComponents 80 | private void initComponents() { 81 | 82 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 83 | this.setLayout(layout); 84 | layout.setHorizontalGroup( 85 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 86 | .addGap(0, 248, Short.MAX_VALUE) 87 | ); 88 | layout.setVerticalGroup( 89 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 90 | .addGap(0, 197, Short.MAX_VALUE) 91 | ); 92 | }// //GEN-END:initComponents 93 | 94 | // Variables declaration - do not modify//GEN-BEGIN:variables 95 | // End of variables declaration//GEN-END:variables 96 | } 97 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/component/Header.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/component/Menu.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
51 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/component/MenuLayout.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/component/MenuLayout.java: -------------------------------------------------------------------------------- 1 | package com.raven.component; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Color; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.event.MouseAdapter; 8 | 9 | public class MenuLayout extends javax.swing.JPanel { 10 | 11 | public boolean isShow() { 12 | return show; 13 | } 14 | 15 | public void setShow(boolean show) { 16 | this.show = show; 17 | } 18 | 19 | public float getAlpha() { 20 | return alpha; 21 | } 22 | 23 | public void setAlpha(float alpha) { 24 | this.alpha = alpha; 25 | } 26 | 27 | private boolean show; 28 | private float alpha; 29 | 30 | public MenuLayout() { 31 | initComponents(); 32 | setOpaque(false); 33 | setVisible(false); 34 | menu1.addMouseListener(new MouseAdapter() { 35 | }); 36 | } 37 | 38 | @SuppressWarnings("unchecked") 39 | // //GEN-BEGIN:initComponents 40 | private void initComponents() { 41 | 42 | menu1 = new com.raven.component.Menu(); 43 | 44 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 45 | this.setLayout(layout); 46 | layout.setHorizontalGroup( 47 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 48 | .addGroup(layout.createSequentialGroup() 49 | .addComponent(menu1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 50 | .addGap(0, 49, Short.MAX_VALUE)) 51 | ); 52 | layout.setVerticalGroup( 53 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 54 | .addComponent(menu1, javax.swing.GroupLayout.DEFAULT_SIZE, 537, Short.MAX_VALUE) 55 | ); 56 | }// //GEN-END:initComponents 57 | 58 | @Override 59 | protected void paintComponent(Graphics grphcs) { 60 | Graphics2D g2 = (Graphics2D) grphcs; 61 | g2.setColor(new Color(150, 150, 150)); 62 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha)); 63 | g2.fillRect(0, 0, getWidth(), getHeight()); 64 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f)); 65 | super.paintComponent(grphcs); 66 | } 67 | 68 | public Menu getMenu() { 69 | return menu1; 70 | } 71 | 72 | // Variables declaration - do not modify//GEN-BEGIN:variables 73 | private com.raven.component.Menu menu1; 74 | // End of variables declaration//GEN-END:variables 75 | } 76 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/component/Profile.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
50 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/component/Profile.java: -------------------------------------------------------------------------------- 1 | package com.raven.component; 2 | 3 | public class Profile extends javax.swing.JPanel { 4 | 5 | public Profile() { 6 | initComponents(); 7 | setOpaque(false); 8 | } 9 | 10 | @SuppressWarnings("unchecked") 11 | // //GEN-BEGIN:initComponents 12 | private void initComponents() { 13 | 14 | pic = new com.raven.swing.ImageAvatar(); 15 | 16 | pic.setForeground(new java.awt.Color(245, 245, 245)); 17 | pic.setBorderSize(2); 18 | pic.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/raven/icon/profile.jpg"))); // NOI18N 19 | 20 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 21 | this.setLayout(layout); 22 | layout.setHorizontalGroup( 23 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 24 | .addComponent(pic, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) 25 | ); 26 | layout.setVerticalGroup( 27 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 28 | .addGroup(layout.createSequentialGroup() 29 | .addGap(20, 20, 20) 30 | .addComponent(pic, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) 31 | .addGap(20, 20, 20)) 32 | ); 33 | }// //GEN-END:initComponents 34 | 35 | // Variables declaration - do not modify//GEN-BEGIN:variables 36 | private com.raven.swing.ImageAvatar pic; 37 | // End of variables declaration//GEN-END:variables 38 | } 39 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/event/EventMenuSelected.java: -------------------------------------------------------------------------------- 1 | package com.raven.event; 2 | 3 | public interface EventMenuSelected { 4 | 5 | public void selected(int index); 6 | } 7 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/form/Form_2.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/form/Form_2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package com.raven.form; 7 | 8 | /** 9 | * 10 | * @author RAVEN 11 | */ 12 | public class Form_2 extends javax.swing.JPanel { 13 | 14 | /** 15 | * Creates new form Form_2 16 | */ 17 | public Form_2() { 18 | initComponents(); 19 | } 20 | 21 | /** 22 | * This method is called from within the constructor to initialize the form. 23 | * WARNING: Do NOT modify this code. The content of this method is always 24 | * regenerated by the Form Editor. 25 | */ 26 | @SuppressWarnings("unchecked") 27 | // //GEN-BEGIN:initComponents 28 | private void initComponents() { 29 | 30 | jLabel1 = new javax.swing.JLabel(); 31 | 32 | setBackground(new java.awt.Color(250, 250, 250)); 33 | 34 | jLabel1.setFont(new java.awt.Font("sansserif", 0, 24)); // NOI18N 35 | jLabel1.setForeground(new java.awt.Color(59, 59, 59)); 36 | jLabel1.setText("Form 2"); 37 | 38 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 39 | this.setLayout(layout); 40 | layout.setHorizontalGroup( 41 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 42 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 43 | .addContainerGap(295, Short.MAX_VALUE) 44 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE) 45 | .addGap(244, 244, 244)) 46 | ); 47 | layout.setVerticalGroup( 48 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 49 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 50 | .addContainerGap(214, Short.MAX_VALUE) 51 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) 52 | .addGap(209, 209, 209)) 53 | ); 54 | }// //GEN-END:initComponents 55 | 56 | 57 | // Variables declaration - do not modify//GEN-BEGIN:variables 58 | private javax.swing.JLabel jLabel1; 59 | // End of variables declaration//GEN-END:variables 60 | } 61 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/form/MainForm.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
55 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/form/MainForm.java: -------------------------------------------------------------------------------- 1 | package com.raven.form; 2 | 3 | import java.awt.Component; 4 | import java.awt.event.ActionListener; 5 | import javax.swing.JFrame; 6 | 7 | public class MainForm extends javax.swing.JPanel { 8 | 9 | public MainForm() { 10 | initComponents(); 11 | show(new Form_1()); 12 | } 13 | 14 | @SuppressWarnings("unchecked") 15 | // //GEN-BEGIN:initComponents 16 | private void initComponents() { 17 | 18 | header1 = new com.raven.component.Header(); 19 | body = new javax.swing.JPanel(); 20 | 21 | setBackground(new java.awt.Color(250, 250, 250)); 22 | 23 | body.setOpaque(false); 24 | body.setLayout(new java.awt.BorderLayout()); 25 | 26 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 27 | this.setLayout(layout); 28 | layout.setHorizontalGroup( 29 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 30 | .addComponent(header1, javax.swing.GroupLayout.DEFAULT_SIZE, 809, Short.MAX_VALUE) 31 | .addGroup(layout.createSequentialGroup() 32 | .addContainerGap() 33 | .addComponent(body, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 34 | .addContainerGap()) 35 | ); 36 | layout.setVerticalGroup( 37 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 38 | .addGroup(layout.createSequentialGroup() 39 | .addComponent(header1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 40 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 41 | .addComponent(body, javax.swing.GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE) 42 | .addContainerGap()) 43 | ); 44 | }// //GEN-END:initComponents 45 | 46 | public void addEventMenu(ActionListener event) { 47 | header1.addEventMenu(event); 48 | } 49 | 50 | public void initMoving(JFrame fram) { 51 | header1.initMoving(fram); 52 | } 53 | 54 | public void show(Component com) { 55 | body.removeAll(); 56 | body.add(com); 57 | body.repaint(); 58 | body.revalidate(); 59 | } 60 | 61 | // Variables declaration - do not modify//GEN-BEGIN:variables 62 | private javax.swing.JPanel body; 63 | private com.raven.component.Header header1; 64 | // End of variables declaration//GEN-END:variables 65 | } 66 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/1.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/10.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/2.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/3.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/4.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/5.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/6.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/7.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/8.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/9.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/flag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/flag.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/menu.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/profile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/profile.jpg -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/profit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/profit.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/search.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/staff.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/staff.jpg -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/icon/stock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DJ-Raven/java-ui-dashboard-002/96e47bc1f7c1d0b3d634eaf39279003fb656b944/Part 3/ui-dashboard-002/src/com/raven/icon/stock.png -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/main/Main.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
60 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/model/ModelStaff.java: -------------------------------------------------------------------------------- 1 | package com.raven.model; 2 | 3 | import javax.swing.Icon; 4 | 5 | public class ModelStaff { 6 | 7 | public Icon getIcon() { 8 | return icon; 9 | } 10 | 11 | public void setIcon(Icon icon) { 12 | this.icon = icon; 13 | } 14 | 15 | public String getName() { 16 | return name; 17 | } 18 | 19 | public void setName(String name) { 20 | this.name = name; 21 | } 22 | 23 | public String getGender() { 24 | return gender; 25 | } 26 | 27 | public void setGender(String gender) { 28 | this.gender = gender; 29 | } 30 | 31 | public String getEmail() { 32 | return email; 33 | } 34 | 35 | public void setEmail(String email) { 36 | this.email = email; 37 | } 38 | 39 | public String getStatus() { 40 | return status; 41 | } 42 | 43 | public void setStatus(String status) { 44 | this.status = status; 45 | } 46 | 47 | public ModelStaff(Icon icon, String name, String gender, String email, String status) { 48 | this.icon = icon; 49 | this.name = name; 50 | this.gender = gender; 51 | this.email = email; 52 | this.status = status; 53 | } 54 | 55 | public ModelStaff() { 56 | } 57 | 58 | private Icon icon; 59 | private String name; 60 | private String gender; 61 | private String email; 62 | private String status; 63 | 64 | public Object[] toDataTable() { 65 | return new Object[]{icon, name, gender, email, status}; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/model/Model_Menu.java: -------------------------------------------------------------------------------- 1 | package com.raven.model; 2 | 3 | import javax.swing.Icon; 4 | import javax.swing.ImageIcon; 5 | 6 | public class Model_Menu { 7 | 8 | public String getIcon() { 9 | return icon; 10 | } 11 | 12 | public void setIcon(String icon) { 13 | this.icon = icon; 14 | } 15 | 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | public void setName(String name) { 21 | this.name = name; 22 | } 23 | 24 | public MenuType getType() { 25 | return type; 26 | } 27 | 28 | public void setType(MenuType type) { 29 | this.type = type; 30 | } 31 | 32 | public Model_Menu(String icon, String name, MenuType type) { 33 | this.icon = icon; 34 | this.name = name; 35 | this.type = type; 36 | } 37 | 38 | public Model_Menu() { 39 | } 40 | 41 | private String icon; 42 | private String name; 43 | private MenuType type; 44 | 45 | public Icon toIcon() { 46 | return new ImageIcon(getClass().getResource("/com/raven/icon/" + icon + ".png")); 47 | } 48 | 49 | public static enum MenuType { 50 | TITLE, MENU, EMPTY 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/Button.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Color; 5 | import java.awt.Cursor; 6 | import java.awt.Graphics; 7 | import java.awt.Graphics2D; 8 | import java.awt.Point; 9 | import java.awt.RenderingHints; 10 | import java.awt.event.MouseAdapter; 11 | import java.awt.event.MouseEvent; 12 | import java.awt.image.BufferedImage; 13 | import javax.swing.JButton; 14 | import javax.swing.border.EmptyBorder; 15 | import org.jdesktop.animation.timing.Animator; 16 | import org.jdesktop.animation.timing.TimingTarget; 17 | import org.jdesktop.animation.timing.TimingTargetAdapter; 18 | 19 | public class Button extends JButton { 20 | 21 | public Color getEffectColor() { 22 | return effectColor; 23 | } 24 | 25 | public void setEffectColor(Color effectColor) { 26 | this.effectColor = effectColor; 27 | } 28 | 29 | private Animator animator; 30 | private int targetSize; 31 | private float animatSize; 32 | private Point pressedPoint; 33 | private float alpha; 34 | private Color effectColor = new Color(173, 173, 173); 35 | 36 | public Button() { 37 | setContentAreaFilled(false); 38 | setBorder(new EmptyBorder(5, 0, 5, 0)); 39 | setBackground(Color.WHITE); 40 | setCursor(new Cursor(Cursor.HAND_CURSOR)); 41 | addMouseListener(new MouseAdapter() { 42 | @Override 43 | public void mousePressed(MouseEvent me) { 44 | targetSize = Math.max(getWidth(), getHeight()) * 2; 45 | animatSize = 0; 46 | pressedPoint = me.getPoint(); 47 | alpha = 0.5f; 48 | if (animator.isRunning()) { 49 | animator.stop(); 50 | } 51 | animator.start(); 52 | } 53 | }); 54 | TimingTarget target = new TimingTargetAdapter() { 55 | @Override 56 | public void timingEvent(float fraction) { 57 | if (fraction > 0.5f) { 58 | alpha = 1 - fraction; 59 | } 60 | animatSize = fraction * targetSize; 61 | repaint(); 62 | } 63 | }; 64 | animator = new Animator(400, target); 65 | } 66 | 67 | @Override 68 | protected void paintComponent(Graphics grphcs) { 69 | int width = getWidth(); 70 | int height = getHeight(); 71 | BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); 72 | Graphics2D g2 = img.createGraphics(); 73 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 74 | g2.setColor(getBackground()); 75 | g2.fillRoundRect(0, 0, width, height, 5, 5); 76 | if (pressedPoint != null) { 77 | g2.setColor(effectColor); 78 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); 79 | g2.fillOval((int) (pressedPoint.x - animatSize / 2), (int) (pressedPoint.y - animatSize / 2), (int) animatSize, (int) animatSize); 80 | } 81 | g2.dispose(); 82 | grphcs.drawImage(img, 0, 0, null); 83 | super.paintComponent(grphcs); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/LabelStatus.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.AlphaComposite; 4 | import java.awt.Color; 5 | import java.awt.Graphics; 6 | import java.awt.Graphics2D; 7 | import java.awt.RenderingHints; 8 | import javax.swing.JLabel; 9 | import javax.swing.border.EmptyBorder; 10 | 11 | public class LabelStatus extends JLabel { 12 | 13 | public LabelStatus() { 14 | setForeground(Color.WHITE); 15 | setBorder(new EmptyBorder(2, 10, 2, 10)); 16 | setHorizontalAlignment(JLabel.CENTER); 17 | } 18 | 19 | @Override 20 | protected void paintComponent(Graphics grphcs) { 21 | Graphics2D g2 = (Graphics2D) grphcs; 22 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 23 | if (getText().equals("Pending")) { 24 | g2.setColor(new Color(253, 187, 65)); 25 | } else if (getText().equals("Approved")) { 26 | g2.setColor(new Color(59, 211, 160)); 27 | } else { 28 | g2.setColor(new Color(240, 81, 81)); 29 | } 30 | int x[] = {5, getWidth(), getWidth() - 5, 0}; 31 | int y[] = {0, 0, getHeight(), getHeight()}; 32 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.9f)); 33 | g2.fillPolygon(x, y, x.length); 34 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f)); 35 | super.paintComponent(grphcs); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/MenuItem.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 |
53 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/MenuItem.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import com.raven.model.Model_Menu; 4 | import java.awt.Color; 5 | import java.awt.Font; 6 | import java.awt.Graphics; 7 | import java.awt.Graphics2D; 8 | import java.awt.RenderingHints; 9 | 10 | public class MenuItem extends javax.swing.JPanel { 11 | 12 | private boolean selected; 13 | private boolean over; 14 | 15 | public MenuItem(Model_Menu data) { 16 | initComponents(); 17 | setOpaque(false); 18 | if (data.getType() == Model_Menu.MenuType.MENU) { 19 | lbIcon.setIcon(data.toIcon()); 20 | lbName.setText(data.getName()); 21 | } else if (data.getType() == Model_Menu.MenuType.TITLE) { 22 | lbIcon.setText(data.getName()); 23 | lbIcon.setFont(new Font("sansserif", 1, 12)); 24 | lbName.setVisible(false); 25 | } else { 26 | lbName.setText(" "); 27 | } 28 | } 29 | 30 | public void setSelected(boolean selected) { 31 | this.selected = selected; 32 | repaint(); 33 | } 34 | 35 | public void setOver(boolean over) { 36 | this.over = over; 37 | repaint(); 38 | } 39 | 40 | @SuppressWarnings("unchecked") 41 | // //GEN-BEGIN:initComponents 42 | private void initComponents() { 43 | 44 | lbIcon = new javax.swing.JLabel(); 45 | lbName = new javax.swing.JLabel(); 46 | 47 | lbIcon.setForeground(new java.awt.Color(255, 255, 255)); 48 | 49 | lbName.setForeground(new java.awt.Color(255, 255, 255)); 50 | lbName.setText("Menu Name"); 51 | 52 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 53 | this.setLayout(layout); 54 | layout.setHorizontalGroup( 55 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 56 | .addGroup(layout.createSequentialGroup() 57 | .addGap(20, 20, 20) 58 | .addComponent(lbIcon) 59 | .addGap(18, 18, 18) 60 | .addComponent(lbName) 61 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 62 | ); 63 | layout.setVerticalGroup( 64 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 65 | .addComponent(lbIcon, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 66 | .addComponent(lbName, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE) 67 | ); 68 | }// //GEN-END:initComponents 69 | 70 | @Override 71 | protected void paintComponent(Graphics grphcs) { 72 | if (selected || over) { 73 | Graphics2D g2 = (Graphics2D) grphcs; 74 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 75 | if (selected) { 76 | g2.setColor(new Color(255, 255, 255, 80)); 77 | } else { 78 | g2.setColor(new Color(255, 255, 255, 20)); 79 | } 80 | g2.fillRoundRect(10, 0, getWidth() - 20, getHeight(), 5, 5); 81 | } 82 | super.paintComponent(grphcs); 83 | } 84 | 85 | // Variables declaration - do not modify//GEN-BEGIN:variables 86 | private javax.swing.JLabel lbIcon; 87 | private javax.swing.JLabel lbName; 88 | // End of variables declaration//GEN-END:variables 89 | } 90 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/ModernScrollBarUI.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | import java.awt.Graphics2D; 6 | import java.awt.Rectangle; 7 | import javax.swing.BorderFactory; 8 | import javax.swing.JButton; 9 | import javax.swing.JComponent; 10 | import javax.swing.JScrollBar; 11 | import javax.swing.plaf.basic.BasicScrollBarUI; 12 | 13 | public class ModernScrollBarUI extends BasicScrollBarUI { 14 | 15 | private static final int SCROLL_BAR_ALPHA_ROLLOVER = 60; 16 | private static final int SCROLL_BAR_ALPHA = 50; 17 | private static final int THUMB_SIZE = 8; 18 | 19 | public ModernScrollBarUI() { 20 | 21 | } 22 | 23 | @Override 24 | protected JButton createDecreaseButton(int orientation) { 25 | return new InvisibleScrollBarButton(); 26 | } 27 | 28 | @Override 29 | protected JButton createIncreaseButton(int orientation) { 30 | return new InvisibleScrollBarButton(); 31 | } 32 | 33 | @Override 34 | protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { 35 | } 36 | 37 | @Override 38 | protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { 39 | int alpha = isThumbRollover() ? SCROLL_BAR_ALPHA_ROLLOVER : SCROLL_BAR_ALPHA; 40 | int orientation = scrollbar.getOrientation(); 41 | int x = thumbBounds.x; 42 | int y = thumbBounds.y; 43 | int width = orientation == JScrollBar.VERTICAL ? THUMB_SIZE : thumbBounds.width; 44 | width = Math.max(width, THUMB_SIZE); 45 | int height = orientation == JScrollBar.VERTICAL ? thumbBounds.height : THUMB_SIZE; 46 | height = Math.max(height, THUMB_SIZE); 47 | Graphics2D graphics2D = (Graphics2D) g.create(); 48 | graphics2D.setColor(new Color(scrollbar.getForeground().getRed(), scrollbar.getForeground().getGreen(), scrollbar.getForeground().getBlue(), alpha)); 49 | graphics2D.fillRect(x, y, width, height); 50 | graphics2D.dispose(); 51 | } 52 | 53 | private static class InvisibleScrollBarButton extends JButton { 54 | 55 | private InvisibleScrollBarButton() { 56 | setOpaque(false); 57 | setFocusable(false); 58 | setFocusPainted(false); 59 | setBorderPainted(false); 60 | setBorder(BorderFactory.createEmptyBorder()); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/ScrollBar.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Dimension; 5 | import javax.swing.JScrollBar; 6 | 7 | public class ScrollBar extends JScrollBar { 8 | 9 | public ScrollBar() { 10 | setUI(new ModernScrollBarUI()); 11 | setPreferredSize(new Dimension(5, 5)); 12 | setBackground(new Color(250, 250, 250)); 13 | setUnitIncrement(20); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/TableCell.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | import javax.swing.JLabel; 6 | import javax.swing.border.EmptyBorder; 7 | 8 | public class TableCell extends JLabel { 9 | 10 | public TableCell(String value) { 11 | super(value); 12 | setForeground(new Color(60, 60, 60)); 13 | setBorder(new EmptyBorder(5, 5, 5, 5)); 14 | } 15 | 16 | @Override 17 | protected void paintComponent(Graphics g) { 18 | g.setColor(new Color(250, 250, 250)); 19 | g.fillRect(0, 0, getWidth(), getHeight()); 20 | g.setColor(new Color(255, 255, 255)); 21 | g.fillRect(0, 6, getWidth(), getHeight() - 12); 22 | super.paintComponent(g); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/TableCell_Image.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
45 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/TableCell_Image.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | import javax.swing.Icon; 6 | 7 | public class TableCell_Image extends javax.swing.JPanel { 8 | 9 | public TableCell_Image(Icon icon) { 10 | initComponents(); 11 | setOpaque(false); 12 | pic.setIcon(icon); 13 | } 14 | 15 | @SuppressWarnings("unchecked") 16 | // //GEN-BEGIN:initComponents 17 | private void initComponents() { 18 | 19 | pic = new com.raven.swing.ImageAvatar(); 20 | 21 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 22 | this.setLayout(layout); 23 | layout.setHorizontalGroup( 24 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 25 | .addGroup(layout.createSequentialGroup() 26 | .addGap(20, 20, 20) 27 | .addComponent(pic, javax.swing.GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE) 28 | .addGap(10, 10, 10)) 29 | ); 30 | layout.setVerticalGroup( 31 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 32 | .addGroup(layout.createSequentialGroup() 33 | .addGap(10, 10, 10) 34 | .addComponent(pic, javax.swing.GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE) 35 | .addGap(10, 10, 10)) 36 | ); 37 | }// //GEN-END:initComponents 38 | 39 | @Override 40 | protected void paintComponent(Graphics g) { 41 | g.setColor(new Color(250, 250, 250)); 42 | g.fillRect(0, 0, getWidth(), getHeight()); 43 | g.setColor(new Color(255, 255, 255)); 44 | g.fillRect(0, 6, getWidth(), getHeight() - 12); 45 | super.paintComponent(g); 46 | } 47 | 48 | // Variables declaration - do not modify//GEN-BEGIN:variables 49 | private com.raven.swing.ImageAvatar pic; 50 | // End of variables declaration//GEN-END:variables 51 | } 52 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/TableCell_Status.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/TableCell_Status.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Color; 4 | import java.awt.Graphics; 5 | 6 | public class TableCell_Status extends javax.swing.JPanel { 7 | 8 | public TableCell_Status(String status) { 9 | initComponents(); 10 | setOpaque(false); 11 | labelStatus1.setText(status); 12 | } 13 | 14 | @SuppressWarnings("unchecked") 15 | // //GEN-BEGIN:initComponents 16 | private void initComponents() { 17 | 18 | labelStatus1 = new com.raven.swing.LabelStatus(); 19 | 20 | labelStatus1.setText("Status"); 21 | 22 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); 23 | this.setLayout(layout); 24 | layout.setHorizontalGroup( 25 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 26 | .addGroup(layout.createSequentialGroup() 27 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 28 | .addComponent(labelStatus1, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) 29 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 30 | ); 31 | layout.setVerticalGroup( 32 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 33 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 34 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 35 | .addComponent(labelStatus1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 36 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 37 | ); 38 | }// //GEN-END:initComponents 39 | 40 | @Override 41 | protected void paintComponent(Graphics g) { 42 | g.setColor(new Color(250, 250, 250)); 43 | g.fillRect(0, 0, getWidth(), getHeight()); 44 | g.setColor(new Color(255, 255, 255)); 45 | g.fillRect(0, 6, getWidth(), getHeight() - 12); 46 | super.paintComponent(g); 47 | } 48 | 49 | // Variables declaration - do not modify//GEN-BEGIN:variables 50 | private com.raven.swing.LabelStatus labelStatus1; 51 | // End of variables declaration//GEN-END:variables 52 | } 53 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/TableHeader.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Color; 4 | import javax.swing.JLabel; 5 | import javax.swing.border.EmptyBorder; 6 | 7 | public class TableHeader extends JLabel { 8 | 9 | public TableHeader(String text) { 10 | super(text); 11 | setOpaque(true); 12 | setBackground(new Color(250, 250, 250)); 13 | setFont(new java.awt.Font("sansserif", 1, 12)); 14 | setForeground(new Color(102, 102, 102)); 15 | setBorder(new EmptyBorder(10, 5, 10, 5)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Part 3/ui-dashboard-002/src/com/raven/swing/WindowSnapshots.java: -------------------------------------------------------------------------------- 1 | package com.raven.swing; 2 | 3 | import java.awt.Graphics; 4 | import java.awt.image.VolatileImage; 5 | import javax.swing.JComponent; 6 | import javax.swing.JFrame; 7 | import javax.swing.JLayeredPane; 8 | 9 | public class WindowSnapshots { 10 | 11 | private final JFrame frame; 12 | 13 | private JComponent snapshotLayer; 14 | private boolean inShowSnapshot; 15 | 16 | public WindowSnapshots(JFrame frame) { 17 | this.frame = frame; 18 | } 19 | 20 | public void createSnapshot() { 21 | if (inShowSnapshot) { 22 | return; 23 | } 24 | inShowSnapshot = true; 25 | if (frame.isShowing()) { 26 | VolatileImage snapshot = frame.createVolatileImage(frame.getWidth(), frame.getHeight()); 27 | if (snapshot != null) { 28 | JLayeredPane layeredPane = frame.getLayeredPane(); 29 | layeredPane.paint(snapshot.getGraphics()); 30 | snapshotLayer = new JComponent() { 31 | @Override 32 | public void paint(Graphics g) { 33 | if (snapshot.contentsLost()) { 34 | return; 35 | } 36 | g.drawImage(snapshot, 0, 0, null); 37 | } 38 | 39 | @Override 40 | public void removeNotify() { 41 | super.removeNotify(); 42 | snapshot.flush(); 43 | } 44 | }; 45 | snapshotLayer.setSize(layeredPane.getSize()); 46 | layeredPane.add(snapshotLayer, Integer.valueOf(JLayeredPane.DRAG_LAYER + 1)); 47 | } 48 | } 49 | } 50 | 51 | public void removeSnapshot() { 52 | frame.getLayeredPane().remove(snapshotLayer); 53 | inShowSnapshot = false; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # java-ui-dashboard-002 2 | Date : 04/09/2021
3 | How to coding in java 4 | visit my youtube : https://www.youtube.com/c/HelloWorld-Raven/featured 5 |

6 | 7 | ![2021-09-03_221134](https://user-images.githubusercontent.com/58245926/132029521-ee7e4279-439c-47c8-bfea-d906ea3543f9.png) 8 | 9 | ![2021-09-03_221141](https://user-images.githubusercontent.com/58245926/132029540-b6af0cd6-a4df-42fd-9ee5-db0c0f628b7d.png) 10 | --------------------------------------------------------------------------------