├── README.md ├── _config.yml ├── build.xml ├── manifest.mf ├── nbproject ├── build-impl.xml ├── genfiles.properties ├── project.properties └── project.xml ├── resources ├── JavaSwingButtonRipple.png ├── JavaSwingComboBox.png ├── JavaSwingFlatButtonRipple.png ├── JavaSwingTextField.png ├── JavaSwingWindow.png └── readme.md └── src ├── com └── hq │ └── swingmaterialdesign │ ├── JFrame_Main.form │ ├── JFrame_Main.java │ ├── SwingMaterialDesign.java │ └── materialdesign │ ├── ElevationEffect.java │ ├── FastGaussianBlur.java │ ├── MaterialButton.java │ ├── MaterialComboBox.java │ ├── MaterialFloatingLabel.java │ ├── MaterialIconButton.java │ ├── MaterialLine.java │ ├── MaterialPanel.java │ ├── MaterialShadow.java │ ├── MaterialTextField.java │ ├── MaterialUtils.java │ ├── RippleEffect.java │ ├── animation │ ├── AnimationListener.java │ └── Animator.java │ └── resource │ ├── MaterialColor.java │ ├── MaterialIcons.java │ └── Roboto.java └── resources └── fonts ├── MaterialIcons-Regular.ttf ├── Roboto-Black.ttf ├── Roboto-BlackItalic.ttf ├── Roboto-Bold.ttf ├── Roboto-BoldItalic.ttf ├── Roboto-Italic.ttf ├── Roboto-Light.ttf ├── Roboto-LightItalic.ttf ├── Roboto-Medium.ttf ├── Roboto-MediumItalic.ttf ├── Roboto-Regular.ttf ├── Roboto-Thin.ttf └── Roboto-ThinItalic.ttf /README.md: -------------------------------------------------------------------------------- 1 | 2 | # SwingMaterialDesign 3 | A **Material Design** components for java swing. Trying to make java swing more beautiful and vivid. With *shadows* and *ripples*. 4 | 5 | I used **netbeans** for this project, so it's easy to work with WYSIWYG IDE. 6 | 7 | ## Screenshots 8 | ![Java Swing Window](/resources/JavaSwingWindow.png) 9 | 10 | ![Java Swing Button Ripples](/resources/JavaSwingButtonRipple.png) 11 | 12 | ![Java Swing TextField](/resources/JavaSwingTextField.png) 13 | 14 | ![Java Swing ComboBox](/resources/JavaSwingComboBox.png) 15 | 16 | ![Java Swing FlatButton Ripples](/resources/JavaSwingFlatButtonRipple.png) 17 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | google_analytics: UA-138608278-1 2 | show_downloads: true 3 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Builds, tests, and runs the project SwingMaterialDesign. 12 | 13 | 73 | 74 | -------------------------------------------------------------------------------- /manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=9d503843 2 | build.xml.script.CRC32=0f910fe8 3 | build.xml.stylesheet.CRC32=8064a381@1.80.1.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=9d503843 7 | nbproject/build-impl.xml.script.CRC32=c18d0385 8 | nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 9 | -------------------------------------------------------------------------------- /nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Files in build.classes.dir which should be excluded from distribution jar 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/SwingMaterialDesign.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath= 33 | # Space-separated list of extra javac options 34 | javac.compilerargs= 35 | javac.deprecation=false 36 | javac.external.vm=true 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=com.hq.swingmaterialdesign.SwingMaterialDesign 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | SwingMaterialDesign 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /resources/JavaSwingButtonRipple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/resources/JavaSwingButtonRipple.png -------------------------------------------------------------------------------- /resources/JavaSwingComboBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/resources/JavaSwingComboBox.png -------------------------------------------------------------------------------- /resources/JavaSwingFlatButtonRipple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/resources/JavaSwingFlatButtonRipple.png -------------------------------------------------------------------------------- /resources/JavaSwingTextField.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/resources/JavaSwingTextField.png -------------------------------------------------------------------------------- /resources/JavaSwingWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/resources/JavaSwingWindow.png -------------------------------------------------------------------------------- /resources/readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/JFrame_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 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/JFrame_Main.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign; 2 | 3 | import com.hq.swingmaterialdesign.materialdesign.MaterialButton; 4 | import com.hq.swingmaterialdesign.materialdesign.MaterialPanel; 5 | import com.hq.swingmaterialdesign.materialdesign.MaterialComboBox; 6 | import com.hq.swingmaterialdesign.materialdesign.MaterialTextField; 7 | import com.hq.swingmaterialdesign.materialdesign.resource.MaterialColor; 8 | import com.hq.swingmaterialdesign.materialdesign.resource.MaterialIcons; 9 | import com.hq.swingmaterialdesign.materialdesign.resource.Roboto; 10 | import java.awt.event.MouseEvent; 11 | import javax.swing.JFrame; 12 | import javax.swing.JOptionPane; 13 | 14 | /** 15 | * 16 | * @author bilux (i.bilux@gmail.com) 17 | */ 18 | public class JFrame_Main extends javax.swing.JFrame { 19 | 20 | /** 21 | * Creates new form JFrame_Main 22 | */ 23 | public JFrame_Main() { 24 | initComponents(); 25 | //jButton_Main1.setFont(MaterialIcons.ICON_FONT.deriveFont(20f)); 26 | ((MaterialButton) jButton_Main).setType(MaterialButton.Type.FLAT); 27 | ((MaterialTextField) jTextField1).setLabel("Swing Material Design Text Field"); 28 | 29 | String x = String.valueOf(MaterialIcons.EXIT_TO_APP); 30 | this.setBackground(MaterialColor.TRANSPARENT); 31 | } 32 | 33 | /** 34 | * This method is called from within the constructor to initialize the form. 35 | * WARNING: Do NOT modify this code. The content of this method is always 36 | * regenerated by the Form Editor. 37 | */ 38 | @SuppressWarnings("unchecked") 39 | // //GEN-BEGIN:initComponents 40 | private void initComponents() { 41 | 42 | jPanel_MainPanel = new MaterialPanel(); 43 | jPanel_TitleBar = new javax.swing.JPanel(); 44 | jButton_Close = new MaterialButton(); 45 | jButton_Maximize = new MaterialButton(); 46 | jButton_Minimize = new MaterialButton(); 47 | jLabel1 = new javax.swing.JLabel(); 48 | jPanel_Main = new MaterialPanel(); 49 | jLabel2 = new javax.swing.JLabel(); 50 | jComboBox1 = new MaterialComboBox<>(); 51 | jTextField1 = new MaterialTextField(); 52 | jButton_Main = new MaterialButton(); 53 | jButton_Main1 = new MaterialButton(); 54 | jToolBar_Status = new javax.swing.JToolBar(); 55 | 56 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 57 | setTitle("MobyDroid"); 58 | setUndecorated(true); 59 | 60 | jPanel_TitleBar.setBackground(new java.awt.Color(153, 153, 153)); 61 | jPanel_TitleBar.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { 62 | public void mouseDragged(java.awt.event.MouseEvent evt) { 63 | jPanel_TitleBarMouseDragged(evt); 64 | } 65 | }); 66 | jPanel_TitleBar.addMouseListener(new java.awt.event.MouseAdapter() { 67 | public void mousePressed(java.awt.event.MouseEvent evt) { 68 | jPanel_TitleBarMousePressed(evt); 69 | } 70 | public void mouseClicked(java.awt.event.MouseEvent evt) { 71 | jPanel_TitleBarMouseClicked(evt); 72 | } 73 | }); 74 | 75 | jButton_Close.setBackground(new java.awt.Color(255, 51, 51)); 76 | jButton_Close.setFont(MaterialIcons.ICON_FONT.deriveFont(20f)); 77 | jButton_Close.setText(String.valueOf(MaterialIcons.CLOSE)); 78 | jButton_Close.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); 79 | jButton_Close.addActionListener(new java.awt.event.ActionListener() { 80 | public void actionPerformed(java.awt.event.ActionEvent evt) { 81 | jButton_CloseActionPerformed(evt); 82 | } 83 | }); 84 | 85 | jButton_Maximize.setBackground(new java.awt.Color(51, 153, 255)); 86 | jButton_Maximize.setFont(MaterialIcons.ICON_FONT.deriveFont(20f)); 87 | jButton_Maximize.setText(String.valueOf(MaterialIcons.FULLSCREEN)); 88 | jButton_Maximize.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); 89 | jButton_Maximize.addActionListener(new java.awt.event.ActionListener() { 90 | public void actionPerformed(java.awt.event.ActionEvent evt) { 91 | jButton_MaximizeActionPerformed(evt); 92 | } 93 | }); 94 | 95 | jButton_Minimize.setBackground(new java.awt.Color(255, 102, 0)); 96 | jButton_Minimize.setFont(MaterialIcons.ICON_FONT.deriveFont(20f)); 97 | jButton_Minimize.setText(String.valueOf(MaterialIcons.EXPAND_MORE)); 98 | jButton_Minimize.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); 99 | jButton_Minimize.addActionListener(new java.awt.event.ActionListener() { 100 | public void actionPerformed(java.awt.event.ActionEvent evt) { 101 | jButton_MinimizeActionPerformed(evt); 102 | } 103 | }); 104 | 105 | jLabel1.setFont(Roboto.BOLD.deriveFont(18f)); 106 | jLabel1.setText("Swing Material Design"); 107 | jLabel1.setToolTipText("MobyDroid"); 108 | 109 | javax.swing.GroupLayout jPanel_TitleBarLayout = new javax.swing.GroupLayout(jPanel_TitleBar); 110 | jPanel_TitleBar.setLayout(jPanel_TitleBarLayout); 111 | jPanel_TitleBarLayout.setHorizontalGroup( 112 | jPanel_TitleBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 113 | .addGroup(jPanel_TitleBarLayout.createSequentialGroup() 114 | .addContainerGap() 115 | .addComponent(jLabel1) 116 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 457, Short.MAX_VALUE) 117 | .addComponent(jButton_Minimize, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) 118 | .addGap(2, 2, 2) 119 | .addComponent(jButton_Maximize, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) 120 | .addGap(2, 2, 2) 121 | .addComponent(jButton_Close, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) 122 | .addGap(2, 2, 2)) 123 | ); 124 | jPanel_TitleBarLayout.setVerticalGroup( 125 | jPanel_TitleBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 126 | .addGroup(jPanel_TitleBarLayout.createSequentialGroup() 127 | .addGap(2, 2, 2) 128 | .addGroup(jPanel_TitleBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 129 | .addComponent(jButton_Minimize, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) 130 | .addComponent(jButton_Maximize, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) 131 | .addComponent(jButton_Close, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) 132 | .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) 133 | .addGap(2, 2, 2)) 134 | ); 135 | 136 | jLabel2.setFont(Roboto.REGULAR.deriveFont(14f)); 137 | jLabel2.setText("Material CheckBox :"); 138 | jLabel2.setToolTipText("MobyDroid"); 139 | 140 | jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); 141 | 142 | jTextField1.setText("Swing Material Design"); 143 | 144 | javax.swing.GroupLayout jPanel_MainLayout = new javax.swing.GroupLayout(jPanel_Main); 145 | jPanel_Main.setLayout(jPanel_MainLayout); 146 | jPanel_MainLayout.setHorizontalGroup( 147 | jPanel_MainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 148 | .addGroup(jPanel_MainLayout.createSequentialGroup() 149 | .addContainerGap() 150 | .addGroup(jPanel_MainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 151 | .addComponent(jTextField1) 152 | .addGroup(jPanel_MainLayout.createSequentialGroup() 153 | .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE) 154 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 155 | .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE) 156 | .addGap(0, 0, Short.MAX_VALUE))) 157 | .addContainerGap()) 158 | ); 159 | jPanel_MainLayout.setVerticalGroup( 160 | jPanel_MainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 161 | .addGroup(jPanel_MainLayout.createSequentialGroup() 162 | .addGap(31, 31, 31) 163 | .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) 164 | .addGap(70, 70, 70) 165 | .addGroup(jPanel_MainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) 166 | .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 167 | .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)) 168 | .addContainerGap(196, Short.MAX_VALUE)) 169 | ); 170 | 171 | jButton_Main.setBackground(new java.awt.Color(51, 153, 255)); 172 | jButton_Main.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N 173 | jButton_Main.setText("Flat Button"); 174 | jButton_Main.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); 175 | jButton_Main.addActionListener(new java.awt.event.ActionListener() { 176 | public void actionPerformed(java.awt.event.ActionEvent evt) { 177 | jButton_MainActionPerformed(evt); 178 | } 179 | }); 180 | 181 | jButton_Main1.setBackground(new java.awt.Color(51, 153, 255)); 182 | jButton_Main1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N 183 | jButton_Main1.setText("Default Button"); 184 | jButton_Main1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); 185 | jButton_Main1.addActionListener(new java.awt.event.ActionListener() { 186 | public void actionPerformed(java.awt.event.ActionEvent evt) { 187 | jButton_Main1ActionPerformed(evt); 188 | } 189 | }); 190 | 191 | jToolBar_Status.setFloatable(false); 192 | jToolBar_Status.setRollover(true); 193 | 194 | javax.swing.GroupLayout jPanel_MainPanelLayout = new javax.swing.GroupLayout(jPanel_MainPanel); 195 | jPanel_MainPanel.setLayout(jPanel_MainPanelLayout); 196 | jPanel_MainPanelLayout.setHorizontalGroup( 197 | jPanel_MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 198 | .addGroup(jPanel_MainPanelLayout.createSequentialGroup() 199 | .addContainerGap() 200 | .addGroup(jPanel_MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 201 | .addComponent(jButton_Main1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 202 | .addComponent(jButton_Main, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 203 | .addGap(18, 18, 18) 204 | .addComponent(jPanel_Main, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 205 | .addContainerGap()) 206 | .addComponent(jPanel_TitleBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 207 | .addComponent(jToolBar_Status, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 208 | ); 209 | jPanel_MainPanelLayout.setVerticalGroup( 210 | jPanel_MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 211 | .addGroup(jPanel_MainPanelLayout.createSequentialGroup() 212 | .addComponent(jPanel_TitleBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 213 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 214 | .addGroup(jPanel_MainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 215 | .addGroup(jPanel_MainPanelLayout.createSequentialGroup() 216 | .addGap(59, 59, 59) 217 | .addComponent(jButton_Main, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) 218 | .addGap(52, 52, 52) 219 | .addComponent(jButton_Main1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)) 220 | .addComponent(jPanel_Main, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 221 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 222 | .addComponent(jToolBar_Status, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE) 223 | .addGap(0, 0, 0)) 224 | ); 225 | 226 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 227 | getContentPane().setLayout(layout); 228 | layout.setHorizontalGroup( 229 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 230 | .addComponent(jPanel_MainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 231 | ); 232 | layout.setVerticalGroup( 233 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 234 | .addGroup(layout.createSequentialGroup() 235 | .addGap(0, 0, 0) 236 | .addComponent(jPanel_MainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 237 | .addGap(0, 0, 0)) 238 | ); 239 | 240 | pack(); 241 | }// //GEN-END:initComponents 242 | 243 | private void jButton_MainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_MainActionPerformed 244 | // TODO add your handling code here: 245 | }//GEN-LAST:event_jButton_MainActionPerformed 246 | 247 | private void jButton_CloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CloseActionPerformed 248 | //this.processWindowEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING)); 249 | exitHandle(); 250 | }//GEN-LAST:event_jButton_CloseActionPerformed 251 | 252 | private void jButton_MaximizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_MaximizeActionPerformed 253 | maximizeHandle(); 254 | }//GEN-LAST:event_jButton_MaximizeActionPerformed 255 | 256 | private void jButton_MinimizeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_MinimizeActionPerformed 257 | this.setExtendedState(this.getExtendedState() | JFrame.ICONIFIED); 258 | }//GEN-LAST:event_jButton_MinimizeActionPerformed 259 | 260 | private void jPanel_TitleBarMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel_TitleBarMouseDragged 261 | int x = evt.getXOnScreen(); 262 | int y = evt.getYOnScreen(); 263 | // Move frame by the mouse delta 264 | setLocation(getLocationOnScreen().x + x - lastX, getLocationOnScreen().y + y - lastY); 265 | lastX = x; 266 | lastY = y; 267 | }//GEN-LAST:event_jPanel_TitleBarMouseDragged 268 | 269 | private void jPanel_TitleBarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel_TitleBarMouseClicked 270 | if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) { 271 | maximizeHandle(); 272 | } 273 | }//GEN-LAST:event_jPanel_TitleBarMouseClicked 274 | 275 | private int lastX = 0; 276 | private int lastY = 0; 277 | private void jPanel_TitleBarMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel_TitleBarMousePressed 278 | if (evt.getButton() == MouseEvent.BUTTON1 && (this.getExtendedState() & JFrame.MAXIMIZED_BOTH) != JFrame.MAXIMIZED_BOTH) { 279 | lastX = evt.getXOnScreen(); 280 | lastY = evt.getYOnScreen(); 281 | } 282 | }//GEN-LAST:event_jPanel_TitleBarMousePressed 283 | 284 | private void jButton_Main1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_Main1ActionPerformed 285 | // TODO add your handling code here: 286 | }//GEN-LAST:event_jButton_Main1ActionPerformed 287 | 288 | // Variables declaration - do not modify//GEN-BEGIN:variables 289 | private javax.swing.JButton jButton_Close; 290 | private javax.swing.JButton jButton_Main; 291 | private javax.swing.JButton jButton_Main1; 292 | private javax.swing.JButton jButton_Maximize; 293 | private javax.swing.JButton jButton_Minimize; 294 | private javax.swing.JComboBox jComboBox1; 295 | private javax.swing.JLabel jLabel1; 296 | private javax.swing.JLabel jLabel2; 297 | private javax.swing.JPanel jPanel_Main; 298 | private javax.swing.JPanel jPanel_MainPanel; 299 | private javax.swing.JPanel jPanel_TitleBar; 300 | private javax.swing.JTextField jTextField1; 301 | private javax.swing.JToolBar jToolBar_Status; 302 | // End of variables declaration//GEN-END:variables 303 | 304 | /** 305 | * 306 | */ 307 | private void exitHandle() { 308 | // ask 309 | Object[] options = {"Yes", "No"}; 310 | int retStatus = JOptionPane.showOptionDialog(this, "Are you sure ?", "Exit", 311 | JOptionPane.YES_NO_OPTION, 312 | JOptionPane.QUESTION_MESSAGE, 313 | null, //do not use a custom Icon 314 | options, //the titles of buttons 315 | options[1]); //default button title 316 | if (retStatus == 0) { 317 | System.exit(0); 318 | } 319 | } 320 | 321 | /** 322 | * 323 | */ 324 | private void maximizeHandle() { 325 | if ((this.getExtendedState() & JFrame.MAXIMIZED_BOTH) == JFrame.MAXIMIZED_BOTH) { 326 | this.setExtendedState(this.getExtendedState() & ~JFrame.MAXIMIZED_BOTH); 327 | } else { 328 | this.setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH); 329 | } 330 | } 331 | } 332 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/SwingMaterialDesign.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign; 2 | 3 | /** 4 | * 5 | * @author bilux (i.bilux@gmail.com) 6 | */ 7 | public class SwingMaterialDesign { 8 | 9 | /** 10 | * @param args the command line arguments 11 | */ 12 | public static void main(String[] args) { 13 | // Set the Metal look and feel 14 | // 15 | try { 16 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 17 | if ("Metal".equals(info.getName())) { 18 | javax.swing.UIManager.setLookAndFeel(info.getClassName()); 19 | break; 20 | } 21 | } 22 | } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { 23 | //java.util.logging.Logger.getLogger(JDialog_AddProduct.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 24 | } 25 | // 26 | 27 | // Create and display the form 28 | JFrame_Main jFrame_Main = new JFrame_Main(); 29 | 30 | java.awt.EventQueue.invokeLater(() -> { 31 | jFrame_Main.setVisible(true); 32 | }); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/ElevationEffect.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import com.hq.swingmaterialdesign.materialdesign.animation.AnimationListener; 4 | import com.hq.swingmaterialdesign.materialdesign.animation.Animator; 5 | import javax.swing.*; 6 | import java.awt.*; 7 | import java.awt.geom.RoundRectangle2D; 8 | 9 | /** 10 | * An elevation effect. 11 | * 12 | * @author bilux (i.bilux@gmail.com) 13 | */ 14 | public class ElevationEffect { 15 | 16 | protected final JComponent target; 17 | protected final MaterialShadow shadow; 18 | protected double level; 19 | protected int borderRadius; 20 | private final Animator animator; 21 | private double startLevel; 22 | private double targetLevel; 23 | 24 | private ElevationEffect(final JComponent component, int elevationLevel) { 25 | target = component; 26 | level = elevationLevel; 27 | targetLevel = elevationLevel; 28 | shadow = new MaterialShadow(); 29 | animator = new Animator(new AnimationListener() { 30 | @Override 31 | public void onStart() { 32 | 33 | } 34 | 35 | @Override 36 | public void onAnimation(double percent) { 37 | level = startLevel + ((targetLevel - startLevel) * percent); 38 | //System.out.println("level: " + level); 39 | target.repaint(); 40 | } 41 | 42 | @Override 43 | public void onEnd() { 44 | level = targetLevel; 45 | target.repaint(); 46 | } 47 | 48 | @Override 49 | public void onStop() { 50 | level = targetLevel; 51 | target.repaint(); 52 | } 53 | }) 54 | .setDelay(0) 55 | .setDuration(500); 56 | } 57 | 58 | /** 59 | * Gets the elevation level. 60 | * 61 | * @return elevation level [0~5] 62 | */ 63 | public double getLevel() { 64 | return level; 65 | } 66 | 67 | /** 68 | * Sets the elevation newLevel. 69 | * 70 | * @param elevationLevel elevation newLevel [0~5] 71 | */ 72 | public void setLevel(int elevationLevel) { 73 | if (target.isShowing()) { 74 | if (elevationLevel != level) { 75 | animator.stop(); 76 | startLevel = level; 77 | targetLevel = elevationLevel; 78 | animator.start(); 79 | } 80 | } else { 81 | this.level = elevationLevel; 82 | } 83 | } 84 | 85 | /** 86 | * Gets the current border radius of the component casting a shadow. This 87 | * should be updated by the target component if such a property exists for 88 | * it and is modified. 89 | * 90 | * @return the current border radius casted on the shadow, in pixels. 91 | */ 92 | public int getBorderRadius() { 93 | return borderRadius; 94 | } 95 | 96 | /** 97 | * Sets the current border radius of the component casting a shadow. This 98 | * should be updated by the target component if such a property exists for 99 | * it and is modified. 100 | * 101 | * @param borderRadius the new border radius casted on the shadow, in 102 | * pixels. 103 | */ 104 | public void setBorderRadius(int borderRadius) { 105 | this.borderRadius = borderRadius; 106 | } 107 | 108 | /** 109 | * Paints this effect. 110 | * 111 | * @param g canvas 112 | */ 113 | public void paint(Graphics g) { 114 | Graphics2D g2 = (Graphics2D) g; 115 | g2.setBackground(target.getParent().getBackground()); 116 | g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f)); 117 | if (target instanceof MaterialButton && (((MaterialButton) target).getType() == MaterialButton.Type.FLAT)) { 118 | g2.setColor(MaterialUtils.brighten(target.getBackground(), (int) (((66.0 / (1 + Math.exp(-2.0 * level))) - 33.0)))); 119 | g2.fill(new RoundRectangle2D.Float(0, 0, target.getWidth(), target.getHeight(), borderRadius, borderRadius)); 120 | } else { 121 | g.drawImage(shadow.render(target.getWidth(), target.getHeight(), borderRadius, level), 0, 0, null); 122 | } 123 | } 124 | 125 | /** 126 | * Creates an elevation effect for the given component. Each component is 127 | * responsible of calling {@link #paint(Graphics)} in order to display the 128 | * effect. For this to work, there should be an offset between the contents 129 | * of the component and its actual bounds, these values can be found in 130 | * {@link MaterialShadow}. 131 | * 132 | * @param target the target of the resulting {@code ElevationEffect} 133 | * @param level the initial elevation level [0~5] 134 | * @return an {@code ElevationEffect} object providing support for painting 135 | * ripples 136 | * @see MaterialShadow#OFFSET_TOP 137 | * @see MaterialShadow#OFFSET_BOTTOM 138 | * @see MaterialShadow#OFFSET_LEFT 139 | * @see MaterialShadow#OFFSET_RIGHT 140 | */ 141 | public static ElevationEffect applyTo(JComponent target, int level) { 142 | return new ElevationEffect(target, level); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/FastGaussianBlur.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import java.awt.image.BufferedImage; 4 | 5 | public class FastGaussianBlur { 6 | 7 | public static void blur(BufferedImage image, final double radius, int n) { 8 | final int w = image.getWidth(); 9 | final int h = image.getHeight(); 10 | final int[] pixels = new int[w * h]; 11 | image.getRGB(0, 0, w, h, pixels, 0, w); 12 | int[][] channels = new int[4][]; 13 | int[] red = new int[w * h]; 14 | for (int channel = 0; channel <= 3; channel++) { 15 | int[] blurRed = new int[w * h]; 16 | for (int i = 0; i < w * h; i++) { 17 | red[i] = (pixels[i] >> (channel * 8)) & 0xff; 18 | } 19 | gaussBlur_4(red, blurRed, w, h, radius, n); 20 | channels[channel] = blurRed; 21 | } 22 | 23 | for (int i = 0; i < w * h; i++) { 24 | pixels[i] = channels[0][i] | channels[1][i] << 8 | channels[2][i] << 16 | channels[3][i] << 24; 25 | } 26 | 27 | image.setRGB(0, 0, w, h, pixels, 0, w); 28 | } 29 | 30 | private static int[] boxesForGauss(double sigma, int n) {// standard deviation, number of boxes 31 | double wIdeal = Math.sqrt((12 * sigma * sigma / n) + 1); // Ideal averaging filter width 32 | int wl = (int) Math.floor(wIdeal); 33 | if (wl % 2 == 0) { 34 | wl--; 35 | } 36 | int wu = wl + 2; 37 | 38 | double mIdeal = (12 * sigma * sigma - n * wl * wl - 4 * n * wl - 3 * n) / (-4 * wl - 4); 39 | int m = (int) Math.round(mIdeal); 40 | 41 | int[] sizes = new int[n]; 42 | for (int i = 0; i < n; i++) { 43 | sizes[i] = i < m ? wl : wu; 44 | } 45 | return sizes; 46 | } 47 | 48 | private static void gaussBlur_4(int[] scl, int[] tcl, int w, int h, double r, int n) { 49 | int[] bxs = boxesForGauss(r, n); 50 | boxBlur_4(scl, tcl, w, h, (bxs[0] - 1) / 2); 51 | boxBlur_4(tcl, scl, w, h, (bxs[1] - 1) / 2); 52 | boxBlur_4(scl, tcl, w, h, (bxs[2] - 1) / 2); 53 | } 54 | 55 | private static void boxBlur_4(int[] scl, int[] tcl, int w, int h, double r) { 56 | System.arraycopy(scl, 0, tcl, 0, scl.length); 57 | boxBlurH_4(tcl, scl, w, h, r); 58 | boxBlurT_4(scl, tcl, w, h, r); 59 | } 60 | 61 | private static void boxBlurH_4(int[] scl, int[] tcl, int w, int h, double r) { 62 | double iarr = 1.0 / (r + r + 1); 63 | for (int i = 0; i < h; i++) { 64 | int ti = i * w; 65 | int li = ti; 66 | int ri = (int) (ti + r); 67 | int fv = scl[ti]; 68 | int lv = scl[ti + w - 1]; 69 | double val = (r + 1) * fv; 70 | for (int j = 0; j < r; j++) { 71 | val += scl[ti + j]; 72 | } 73 | for (int j = 0; j <= r; j++) { 74 | val += scl[ri++] - fv; 75 | tcl[ti++] = (int) Math.round(val * iarr); 76 | } 77 | for (int j = (int) (r + 1); j < w - r; j++) { 78 | val += scl[ri++] - scl[li++]; 79 | tcl[ti++] = (int) Math.round(val * iarr); 80 | } 81 | for (int j = (int) (w - r); j < w; j++) { 82 | val += lv - scl[li++]; 83 | tcl[ti++] = (int) Math.round(val * iarr); 84 | } 85 | } 86 | } 87 | 88 | private static void boxBlurT_4(int[] scl, int[] tcl, int w, int h, double r) { 89 | double iarr = 1.0 / (r + r + 1); 90 | for (int i = 0; i < w; i++) { 91 | int ti = i; 92 | int li = ti; 93 | int ri = (int) (ti + r * w); 94 | int fv = scl[ti]; 95 | int lv = scl[ti + w * (h - 1)]; 96 | double val = (r + 1) * fv; 97 | for (int j = 0; j < r; j++) { 98 | val += scl[ti + j * w]; 99 | } 100 | for (int j = 0; j <= r; j++) { 101 | val += scl[ri] - fv; 102 | tcl[ti] = (int) Math.round(val * iarr); 103 | ri += w; 104 | ti += w; 105 | } 106 | for (int j = (int) (r + 1); j < h - r; j++) { 107 | val += scl[ri] - scl[li]; 108 | tcl[ti] = (int) Math.round(val * iarr); 109 | li += w; 110 | ri += w; 111 | ti += w; 112 | } 113 | for (int j = (int) (h - r); j < h; j++) { 114 | val += lv - scl[li]; 115 | tcl[ti] = (int) Math.round(val * iarr); 116 | li += w; 117 | ti += w; 118 | } 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/MaterialButton.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import com.hq.swingmaterialdesign.materialdesign.resource.MaterialColor; 4 | import java.awt.Color; 5 | import java.awt.Cursor; 6 | import java.awt.FontMetrics; 7 | import java.awt.Graphics; 8 | import java.awt.Graphics2D; 9 | import java.awt.RenderingHints; 10 | import javax.swing.JButton; 11 | import javax.swing.plaf.basic.BasicButtonUI; 12 | import java.awt.event.FocusEvent; 13 | import java.awt.event.MouseAdapter; 14 | import java.awt.event.MouseEvent; 15 | import java.awt.geom.RoundRectangle2D; 16 | import javax.swing.JComponent; 17 | 18 | /** 19 | * A Material Design button. 20 | * 21 | * @author bilux (i.bilux@gmail.com) 22 | */ 23 | public class MaterialButton extends JButton { 24 | 25 | private RippleEffect ripple; 26 | private ElevationEffect elevation; 27 | private Type type = Type.DEFAULT; 28 | private boolean isMousePressed = false; 29 | private boolean isMouseOver = false; 30 | private Color rippleColor = Color.WHITE; 31 | private Cursor cursor = super.getCursor(); 32 | private int borderRadius = 2; 33 | 34 | /** 35 | * Creates a new button. 36 | */ 37 | public MaterialButton() { 38 | ripple = RippleEffect.applyTo(this); 39 | elevation = ElevationEffect.applyTo(this, 0); 40 | setOpaque(false); 41 | 42 | addMouseListener(new MouseAdapter() { 43 | @Override 44 | public void mousePressed(MouseEvent mouseEvent) { 45 | isMousePressed = true; 46 | elevation.setLevel(getElevation()); 47 | } 48 | 49 | @Override 50 | public void mouseReleased(MouseEvent mouseEvent) { 51 | isMousePressed = false; 52 | elevation.setLevel(getElevation()); 53 | } 54 | 55 | @Override 56 | public void mouseEntered(MouseEvent e) { 57 | isMouseOver = true; 58 | elevation.setLevel(getElevation()); 59 | } 60 | 61 | @Override 62 | public void mouseExited(MouseEvent e) { 63 | isMouseOver = false; 64 | elevation.setLevel(getElevation()); 65 | } 66 | }); 67 | 68 | setUI(new BasicButtonUI() { 69 | @Override 70 | public boolean contains(JComponent c, int x, int y) { 71 | return x > MaterialShadow.OFFSET_LEFT && y > MaterialShadow.OFFSET_TOP 72 | && x < getWidth() - MaterialShadow.OFFSET_RIGHT && y < getHeight() - MaterialShadow.OFFSET_BOTTOM; 73 | } 74 | }); 75 | } 76 | 77 | /** 78 | * Gets the type of this button. 79 | * 80 | * @return the type of this button 81 | * @see Type 82 | */ 83 | public Type getType() { 84 | return type; 85 | } 86 | 87 | /** 88 | * Sets the type of this button. 89 | * 90 | * @param type the type of this button 91 | * @see Type 92 | */ 93 | public void setType(Type type) { 94 | this.type = type; 95 | repaint(); 96 | } 97 | 98 | /** 99 | * Sets the background color of this button. 100 | *

101 | * Keep on mind that setting a background color in a Material component like 102 | * this will also set the foreground color to either white or black and the 103 | * ripple color to a brighter or darker shade of the color, depending of how 104 | * bright or dark is the chosen background color. If you want to use a 105 | * custom foreground color and ripple color, ensure the background color has 106 | * been set first. 107 | *

108 | * NOTE: It is up to the look and feel to honor this property, some 109 | * may choose to ignore it. To avoid any conflicts, using the 110 | * 111 | * Metal Look and Feel is recommended. 112 | * 113 | * @param bg 114 | */ 115 | @Override 116 | public void setBackground(Color bg) { 117 | super.setBackground(bg); 118 | setForeground(MaterialUtils.isDark(bg) ? MaterialColor.WHITE : MaterialColor.BLACK); 119 | setRippleColor(MaterialUtils.isDark(bg) ? MaterialColor.WHITE : MaterialUtils.darken(MaterialUtils.darken(bg))); 120 | } 121 | 122 | /** 123 | * Gets the ripple color. 124 | * 125 | * @return the ripple color 126 | */ 127 | public Color getRippleColor() { 128 | return rippleColor; 129 | } 130 | 131 | /** 132 | * Sets the ripple color. You should only do this for flat buttons. 133 | * 134 | * @param rippleColor the ripple color 135 | */ 136 | public void setRippleColor(Color rippleColor) { 137 | this.rippleColor = rippleColor; 138 | } 139 | 140 | /** 141 | * Gets the current border radius of this button. 142 | * 143 | * @return the current border radius of this button, in pixels. 144 | */ 145 | public int getBorderRadius() { 146 | return borderRadius; 147 | } 148 | 149 | /** 150 | * Sets the border radius of this button. You can define a custom radius in 151 | * order to get some rounded corners in your button, making it look like a 152 | * pill or even a circular action button. 153 | * 154 | * @param borderRadius the new border radius of this button, in pixels. 155 | */ 156 | public void setBorderRadius(int borderRadius) { 157 | this.borderRadius = borderRadius; 158 | elevation.setBorderRadius(borderRadius); 159 | } 160 | 161 | @Override 162 | public void setEnabled(boolean b) { 163 | super.setEnabled(b); 164 | super.setCursor(b ? cursor : Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); 165 | } 166 | 167 | @Override 168 | public void setCursor(Cursor cursor) { 169 | super.setCursor(cursor); 170 | this.cursor = cursor; 171 | } 172 | 173 | @Override 174 | protected void processFocusEvent(FocusEvent focusEvent) { 175 | super.processFocusEvent(focusEvent); 176 | } 177 | 178 | @Override 179 | protected void processMouseEvent(MouseEvent mouseEvent) { 180 | super.processMouseEvent(mouseEvent); 181 | } 182 | 183 | private int getElevation() { 184 | if (isMousePressed) { 185 | return 2; 186 | } else if (type == Type.RAISED || isMouseOver) { 187 | return 1; 188 | } else { 189 | return 0; 190 | } 191 | } 192 | 193 | @Override 194 | protected void paintComponent(Graphics g) { 195 | Graphics2D g2 = (Graphics2D) g; 196 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 197 | g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); 198 | 199 | if ((type != Type.FLAT) && isEnabled()) { 200 | elevation.paint(g); 201 | g2.translate(MaterialShadow.OFFSET_LEFT, MaterialShadow.OFFSET_TOP); 202 | } 203 | 204 | int offset_lr; 205 | int offset_td; 206 | if (type == Type.FLAT) { 207 | offset_td = 0; 208 | offset_lr = 0; 209 | } else { 210 | offset_td = MaterialShadow.OFFSET_TOP + MaterialShadow.OFFSET_BOTTOM; 211 | offset_lr = MaterialShadow.OFFSET_LEFT + MaterialShadow.OFFSET_RIGHT; 212 | } 213 | 214 | if (isEnabled()) { 215 | g2.setColor(getBackground()); 216 | g2.fill(new RoundRectangle2D.Float(0, 0, getWidth() - offset_lr, getHeight() - offset_td, borderRadius, borderRadius)); 217 | g2.setColor(new Color(rippleColor.getRed() / 255f, rippleColor.getBlue() / 255f, rippleColor.getBlue() / 255f, 0.12f)); 218 | if (type == Type.FLAT) { 219 | elevation.paint(g); 220 | //g2.setColor(MaterialUtils.brighten(getBackground())); 221 | //g2.fill(new RoundRectangle2D.Float(0, 0, getWidth() - offset_lr, getHeight() - offset_td, borderRadius, borderRadius)); 222 | } 223 | } else { 224 | Color bg = getBackground(); 225 | g2.setColor(new Color(bg.getRed() / 255f, bg.getGreen() / 255f, bg.getBlue() / 255f, 0.6f)); 226 | g2.fill(new RoundRectangle2D.Float(0, 0, getWidth() - offset_lr, getHeight() - offset_td, borderRadius * 2, borderRadius * 2)); 227 | } 228 | 229 | FontMetrics metrics = g.getFontMetrics(getFont()); 230 | int x = (getWidth() - offset_lr - metrics.stringWidth(getText().toUpperCase())) / 2; 231 | int y = (getHeight() - offset_td - metrics.getHeight()) / 2 + metrics.getAscent(); 232 | g2.setFont(getFont()); 233 | if (isEnabled()) { 234 | g2.setColor(getForeground()); 235 | } else { 236 | Color fg = getForeground(); 237 | g2.setColor(new Color(fg.getRed() / 255f, fg.getGreen() / 255f, fg.getBlue() / 255f, 0.6f)); 238 | } 239 | g2.drawString(getText().toUpperCase(), x, y); 240 | 241 | if (isEnabled()) { 242 | g2.setClip(new RoundRectangle2D.Float(0, 0, getWidth() - offset_lr, getHeight() - offset_td, Math.max(borderRadius * 2 - 4, 0), Math.max(borderRadius * 2 - 4, 0))); 243 | g2.setColor(rippleColor); 244 | ripple.paint(g2); 245 | } 246 | } 247 | 248 | @Override 249 | protected void paintBorder(Graphics g) { 250 | //intentionally left blank 251 | } 252 | 253 | /** 254 | * Button types. 255 | */ 256 | public enum Type { 257 | /** 258 | * A default button. 259 | */ 260 | DEFAULT, 261 | /** 262 | * A raised button. Raised buttons have a shadow even if they are not 263 | * focused. 264 | */ 265 | RAISED, 266 | /** 267 | * A flat button. Flat buttons don't have shadows and are typically 268 | * transparent. 269 | */ 270 | FLAT 271 | } 272 | } 273 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/MaterialComboBox.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import com.hq.swingmaterialdesign.materialdesign.resource.MaterialColor; 4 | import static com.hq.swingmaterialdesign.materialdesign.MaterialTextField.HINT_OPACITY_MASK; 5 | import static com.hq.swingmaterialdesign.materialdesign.MaterialTextField.LINE_OPACITY_MASK; 6 | import com.hq.swingmaterialdesign.materialdesign.resource.Roboto; 7 | import javax.swing.*; 8 | import javax.swing.border.MatteBorder; 9 | import javax.swing.plaf.basic.BasicComboBoxUI; 10 | import javax.swing.plaf.basic.BasicComboPopup; 11 | import javax.swing.plaf.basic.BasicScrollBarUI; 12 | import javax.swing.plaf.basic.ComboPopup; 13 | import java.awt.*; 14 | import java.awt.event.FocusEvent; 15 | 16 | /** 17 | * A Material Design combo box. 18 | * 19 | * 20 | * @author bilux (i.bilux@gmail.com) 21 | */ 22 | public class MaterialComboBox extends JComboBox { 23 | 24 | private MaterialLine line = new MaterialLine(this); 25 | private Color accentColor = MaterialColor.PINK_500; 26 | private String hint = ""; 27 | 28 | public MaterialComboBox() { 29 | setModel(new DefaultComboBoxModel<>()); 30 | setRenderer(new FieldRenderer<>(this)); 31 | setUI(new BasicComboBoxUI() { 32 | @Override 33 | protected ComboPopup createPopup() { 34 | BasicComboPopup popupBox = new Popup(comboBox); 35 | popupBox.getAccessibleContext().setAccessibleParent(comboBox); 36 | return popupBox; 37 | } 38 | 39 | @Override 40 | protected JButton createArrowButton() { 41 | JButton button = new javax.swing.plaf.basic.BasicArrowButton( 42 | javax.swing.plaf.basic.BasicArrowButton.SOUTH, 43 | MaterialColor.TRANSPARENT, 44 | MaterialColor.TRANSPARENT, 45 | MaterialColor.TRANSPARENT, 46 | MaterialColor.TRANSPARENT); 47 | button.setName("ComboBox.arrowButton"); 48 | return button; 49 | } 50 | }); 51 | setOpaque(false); 52 | setBackground(MaterialColor.WHITE); 53 | } 54 | 55 | /** 56 | * Gets the color the label changes to when this {@code materialTextField} 57 | * is focused. 58 | * 59 | * @return the {@code "Color"} currently in use for accent. The default 60 | * value is {@link MaterialColor#PINK_500}. 61 | */ 62 | public Color getAccent() { 63 | return accentColor; 64 | } 65 | 66 | /** 67 | * Sets the color the label changes to when this {@code materialTextField} 68 | * is focused. The default value is {@link MaterialColor#PINK_500}. 69 | * 70 | * @param accentColor the {@code "Color"} that should be used for accent. 71 | */ 72 | public void setAccent(Color accentColor) { 73 | this.accentColor = accentColor; 74 | } 75 | 76 | /** 77 | * Gets the hint text. The hint text is displayed when the list inside this 78 | * combo box is empty or no element has been selected yet. 79 | * 80 | * @return hint text 81 | */ 82 | public String getHint() { 83 | return hint; 84 | } 85 | 86 | /** 87 | * Sets the hint text. The hint text is displayed when the list inside this 88 | * combo box is empty or no element has been selected yet. 89 | * 90 | * @param hint hint text 91 | */ 92 | public void setHint(String hint) { 93 | this.hint = hint; 94 | repaint(); 95 | } 96 | 97 | @Override 98 | protected void processFocusEvent(FocusEvent e) { 99 | super.processFocusEvent(e); 100 | line.update(); 101 | } 102 | 103 | @Override 104 | public void paint(Graphics g) { 105 | Graphics2D g2 = (Graphics2D) g; 106 | g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); 107 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 108 | 109 | // paint text baground 110 | g2.setColor(getBackground()); 111 | g2.fillRect(0, 0, getWidth(), getHeight() - 4); 112 | 113 | // paint the selected item 114 | g.setFont(Roboto.REGULAR.deriveFont(16f)); 115 | g.setColor(getSelectedItem() == null ? MaterialUtils.applyAlphaMask(getForeground(), HINT_OPACITY_MASK) : getForeground()); 116 | FontMetrics metrics = g.getFontMetrics(g.getFont()); 117 | String text = getSelectedItem() != null ? getSelectedItem().toString() : (hint != null ? hint : ""); 118 | g.drawString(text, 0, metrics.getAscent() + (getHeight() - metrics.getHeight()) / 2); 119 | 120 | // paint the Polygon < 121 | if (isFocusOwner()) { 122 | g2.setColor(accentColor); 123 | } 124 | g2.fillPolygon(new int[]{getWidth() - 5, getWidth() - 10, getWidth() - 15}, new int[]{getHeight() / 2 - 3, getHeight() / 2 + 3, getHeight() / 2 - 3}, 3); 125 | 126 | // paint line under text 127 | g2.setColor(MaterialUtils.applyAlphaMask(getForeground(), LINE_OPACITY_MASK)); 128 | g2.fillRect(0, getHeight() - 4, getWidth(), 1); 129 | 130 | // paint animated line under text 131 | g2.setColor(accentColor); 132 | g2.fillRect((int) ((getWidth() - line.getWidth()) / 2), getHeight() - 5, (int) line.getWidth(), 2); 133 | } 134 | 135 | public static class FieldRenderer extends JComponent implements ListCellRenderer { 136 | 137 | private final MaterialComboBox comboBox; 138 | private String text; 139 | private boolean mouseOver = false; 140 | private boolean selected = false; 141 | 142 | public FieldRenderer(MaterialComboBox comboBox) { 143 | this.comboBox = comboBox; 144 | } 145 | 146 | @Override 147 | public Component getListCellRendererComponent(JList jList, Object o, int index, boolean isSelected, boolean cellHasFocus) { 148 | text = o != null ? o.toString() : ""; 149 | setSize(jList.getWidth(), 56); 150 | setPreferredSize(new Dimension(jList.getWidth(), 32)); 151 | setOpaque(true); 152 | mouseOver = isSelected; 153 | selected = comboBox.getSelectedIndex() == index; 154 | return this; 155 | } 156 | 157 | @Override 158 | public void paint(Graphics g) { 159 | super.paint(g); 160 | Graphics2D g2 = (Graphics2D) g; 161 | g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); 162 | 163 | if (mouseOver) { 164 | g.setColor(MaterialUtils.isDark(comboBox.getBackground()) ? MaterialUtils.brighten(comboBox.getBackground()) : MaterialUtils.darken(comboBox.getBackground())); 165 | } else { 166 | g.setColor(comboBox.getBackground()); 167 | } 168 | g.fillRect(0, 0, getWidth(), getHeight()); 169 | 170 | g.setFont(Roboto.REGULAR.deriveFont(15f)); 171 | if (selected) { 172 | g2.setColor(comboBox.accentColor); 173 | } else { 174 | g2.setColor(comboBox.getForeground()); 175 | } 176 | FontMetrics metrics = g.getFontMetrics(g.getFont()); 177 | g.drawString(text, 24, metrics.getAscent() + (getHeight() - metrics.getHeight()) / 2); 178 | } 179 | } 180 | 181 | public static class Popup extends BasicComboPopup { 182 | 183 | public Popup(JComboBox combo) { 184 | super(combo); 185 | setBackground(combo.getBackground()); 186 | setOpaque(true); 187 | setBorderPainted(false); 188 | } 189 | 190 | @Override 191 | protected JScrollPane createScroller() { 192 | JScrollPane scrol = super.createScroller(); 193 | scrol.setVerticalScrollBar(new ScrollBar(comboBox, Adjustable.VERTICAL)); 194 | scrol.setBorder(new MatteBorder(16, 0, 16, 0, Color.WHITE)); 195 | return scrol; 196 | } 197 | 198 | @Override 199 | protected Rectangle computePopupBounds(int px, int py, int pw, int ph) { 200 | return super.computePopupBounds(px, py - 2, (int) Math.max(comboBox.getPreferredSize().getWidth(), pw), ph); 201 | } 202 | 203 | @Override 204 | public void paint(Graphics g) { 205 | super.paint(g); 206 | } 207 | } 208 | 209 | public static class ScrollBar extends JScrollBar { 210 | 211 | public ScrollBar(final JComboBox comboBox, int orientation) { 212 | super(orientation); 213 | setPreferredSize(new Dimension(5, 100)); 214 | 215 | setUI(new BasicScrollBarUI() { 216 | @Override 217 | protected ScrollListener createScrollListener() { 218 | setUnitIncrement(56); 219 | setBlockIncrement(560); 220 | return super.createScrollListener(); 221 | } 222 | 223 | @Override 224 | protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { 225 | g.setColor(comboBox.getBackground()); 226 | g.fillRect(trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height); 227 | } 228 | 229 | @Override 230 | protected JButton createDecreaseButton(int orientation) { 231 | JButton dummyButton = new JButton(); 232 | dummyButton.setPreferredSize(new Dimension(0, 0)); 233 | return dummyButton; 234 | } 235 | 236 | @Override 237 | protected JButton createIncreaseButton(int orientation) { 238 | JButton dummyButton = new JButton(); 239 | dummyButton.setPreferredSize(new Dimension(0, 0)); 240 | return dummyButton; 241 | } 242 | 243 | @Override 244 | protected Dimension getMinimumThumbSize() { 245 | return new Dimension(5, 50); 246 | } 247 | 248 | @Override 249 | protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { 250 | if (!thumbBounds.isEmpty() && this.scrollbar.isEnabled()) { 251 | ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, 252 | RenderingHints.VALUE_ANTIALIAS_ON); 253 | boolean isVertical = ScrollBar.this.getOrientation() 254 | == Adjustable.VERTICAL; 255 | g.setColor(MaterialColor.GREY_500); 256 | g.fillRoundRect(thumbBounds.x, thumbBounds.y, 257 | thumbBounds.width, thumbBounds.height, 258 | isVertical ? thumbBounds.width : thumbBounds.height, 259 | isVertical ? thumbBounds.width : thumbBounds.height); 260 | } 261 | } 262 | 263 | @Override 264 | public void layoutContainer(Container scrollbarContainer) { 265 | super.layoutContainer(scrollbarContainer); 266 | incrButton.setBounds(0, 0, 0, 0); 267 | decrButton.setBounds(0, 0, 0, 0); 268 | } 269 | }); 270 | } 271 | 272 | @Override 273 | public Component add(Component comp) { 274 | if (comp != null) { 275 | return super.add(comp); 276 | } 277 | return null; 278 | } 279 | 280 | @Override 281 | public void paint(Graphics g) { 282 | g.setColor(Color.WHITE); 283 | g.fillRect(0, 0, getWidth(), getHeight()); 284 | super.paint(g); 285 | } 286 | } 287 | } 288 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/MaterialFloatingLabel.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import com.hq.swingmaterialdesign.materialdesign.resource.MaterialColor; 4 | import com.hq.swingmaterialdesign.materialdesign.resource.Roboto; 5 | import com.hq.swingmaterialdesign.materialdesign.animation.AnimationListener; 6 | import com.hq.swingmaterialdesign.materialdesign.animation.Animator; 7 | 8 | import javax.swing.*; 9 | import java.awt.*; 10 | 11 | /** 12 | * A floating label of a text field. 13 | * 14 | * @author bilux (i.bilux@gmail.com) 15 | */ 16 | public class MaterialFloatingLabel { 17 | 18 | public static final int HINT_OPACITY_MASK = 0x99000000; 19 | 20 | private final JTextField target; 21 | private final Animator animator; 22 | private Color color; 23 | private String text; 24 | private Color accentColor = MaterialColor.CYAN_500; 25 | private double fontCrement; 26 | private double targetFontSize; 27 | private double fontSize; 28 | 29 | MaterialFloatingLabel(JTextField target) { 30 | this.target = target; 31 | targetFontSize = fontSize = 16d; 32 | color = MaterialUtils.applyAlphaMask(target.getForeground(), HINT_OPACITY_MASK); 33 | animator = new Animator(new AnimationListener() { 34 | @Override 35 | public void onStart() { 36 | 37 | } 38 | 39 | @Override 40 | public void onAnimation(double percent) { 41 | fontSize += fontCrement; 42 | target.repaint(); 43 | } 44 | 45 | @Override 46 | public void onEnd() { 47 | fontSize = targetFontSize; 48 | target.repaint(); 49 | } 50 | 51 | @Override 52 | public void onStop() { 53 | fontSize = targetFontSize; 54 | target.repaint(); 55 | } 56 | }) 57 | .setDelay(0) 58 | .setDuration(100); 59 | } 60 | 61 | void update() { 62 | animator.stop(); 63 | targetFontSize = target.isFocusOwner() ? 12d : 16d; 64 | if (fontSize != targetFontSize) { 65 | fontCrement = +(double) (targetFontSize - fontSize) / 100; 66 | animator.start(); 67 | } 68 | 69 | if (target.isFocusOwner()) { 70 | color = accentColor; 71 | } else { 72 | color = MaterialUtils.applyAlphaMask(target.getForeground(), HINT_OPACITY_MASK); 73 | } 74 | } 75 | 76 | public void updateForeground() { 77 | color = (MaterialUtils.applyAlphaMask(target.getForeground(), HINT_OPACITY_MASK)); 78 | } 79 | 80 | public Color getAccent() { 81 | return accentColor; 82 | } 83 | 84 | public void setAccent(Color accentColor) { 85 | this.accentColor = accentColor; 86 | } 87 | 88 | String getText() { 89 | return text; 90 | } 91 | 92 | void setText(String text) { 93 | this.text = text; 94 | } 95 | 96 | void paint(Graphics2D g) { 97 | g.setFont(Roboto.REGULAR.deriveFont((float) fontSize)); 98 | g.setColor(color); 99 | FontMetrics metrics = g.getFontMetrics(g.getFont()); 100 | g.drawString(getText(), 0, metrics.getAscent() + 0); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/MaterialIconButton.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import javax.swing.*; 4 | import java.awt.*; 5 | import java.awt.event.FocusEvent; 6 | import java.awt.event.MouseEvent; 7 | 8 | /** 9 | * 10 | * @author bilux (i.bilux@gmail.com) 11 | */ 12 | public class MaterialIconButton extends JButton { 13 | 14 | private final RippleEffect ripple; 15 | 16 | /** 17 | * Creates a new button. 18 | */ 19 | public MaterialIconButton() { 20 | ripple = RippleEffect.applyFixedTo(this); 21 | setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); 22 | setOpaque(false); 23 | setBackground(new Color(0, 0, 0, 0)); 24 | } 25 | 26 | @Override 27 | public void setIcon(Icon icon) { 28 | super.setIcon(icon); 29 | repaint(); 30 | } 31 | 32 | @Override 33 | public void setEnabled(boolean b) { 34 | super.setEnabled(b); 35 | repaint(); 36 | } 37 | 38 | @Override 39 | protected void processFocusEvent(FocusEvent focusEvent) { 40 | super.processFocusEvent(focusEvent); 41 | repaint(); 42 | } 43 | 44 | @Override 45 | protected void processMouseEvent(MouseEvent mouseEvent) { 46 | super.processMouseEvent(mouseEvent); 47 | repaint(); 48 | } 49 | 50 | @Override 51 | protected void paintComponent(Graphics g) { 52 | Graphics2D g2 = (Graphics2D) g; 53 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 54 | g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); 55 | 56 | if (isEnabled()) { 57 | if (getIcon() != null) { 58 | getIcon().paintIcon(this, g2, 12, 12); 59 | } 60 | g2.setColor(getForeground()); 61 | ripple.paint(g2); 62 | } else if (getIcon() != null) { 63 | AlphaComposite ac = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f); 64 | g2.setComposite(ac); 65 | getIcon().paintIcon(this, g2, 12, 12); 66 | } 67 | } 68 | 69 | @Override 70 | protected void paintBorder(Graphics g) { 71 | //intentionally left blank 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/MaterialLine.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import com.hq.swingmaterialdesign.materialdesign.animation.AnimationListener; 4 | import com.hq.swingmaterialdesign.materialdesign.animation.Animator; 5 | import javax.swing.*; 6 | 7 | /** 8 | * An animated line that appears below a component when it is focused. 9 | * 10 | * @author bilux (i.bilux@gmail.com) 11 | */ 12 | public class MaterialLine { 13 | 14 | private final JComponent target; 15 | private final Animator animator; 16 | private double width; 17 | private double targetWidth; 18 | private double widthCrement; 19 | 20 | public MaterialLine(JComponent target) { 21 | this.target = target; 22 | animator = new Animator(new AnimationListener() { 23 | @Override 24 | public void onStart() { 25 | 26 | } 27 | 28 | @Override 29 | public void onAnimation(double percent) { 30 | width += widthCrement; 31 | target.repaint(); 32 | } 33 | 34 | @Override 35 | public void onEnd() { 36 | width = targetWidth; 37 | target.repaint(); 38 | } 39 | 40 | @Override 41 | public void onStop() { 42 | width = targetWidth; 43 | target.repaint(); 44 | } 45 | }) 46 | .setDelay(0) 47 | .setDuration(200); 48 | } 49 | 50 | public void update() { 51 | animator.stop(); 52 | if (target.isFocusOwner()) { 53 | targetWidth = target.getWidth(); 54 | widthCrement = +(double) target.getWidth() / 200; 55 | } else { 56 | widthCrement = -(double) target.getWidth() / 200; 57 | targetWidth = 0; 58 | } 59 | animator.start(); 60 | } 61 | 62 | public double getWidth() { 63 | return width; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/MaterialPanel.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import com.hq.swingmaterialdesign.materialdesign.resource.MaterialColor; 4 | import javax.swing.*; 5 | import javax.swing.border.EmptyBorder; 6 | import java.awt.*; 7 | 8 | /** 9 | * A JPanel customized for Material components. What makes these panels special 10 | * is the possibility of assigning them an elevation level. Elevation can help 11 | * distinguishing elements inside a Material-based GUI, and any changes done to 12 | * them result in nicely animated transitions, helping to achieve that Material 13 | * flow. 14 | * 15 | * However, there is a catch: shadows are kinda expensive to compute, as Java2D 16 | * relies on the CPU for anything other than images, so having a lot of elements 17 | * with a given elevation (and thus, a shadow) can reduce performance when these 18 | * elevations change due to the triggered animations. 19 | * 20 | * Letting the components suggest a prefered size based on their contents is 21 | * still under development, so it is not advised to use your favorite 22 | * {@link LayoutManager} inside a {@code MaterialPanel} unless you set the 23 | * prefered, minimum and maximum size of each component by yourself. Currently, 24 | * the prefereable approach to follow is overriding {@link #doLayout()} and 25 | * taking care of any arrangements by yourself. 26 | * 27 | * @author bilux (i.bilux@gmail.com) 28 | */ 29 | public class MaterialPanel extends JPanel { 30 | 31 | private final ElevationEffect elevation; 32 | 33 | /** 34 | * Creates a new {@code MaterialPanel}. These panels cast a shadow below 35 | * them, although technically it is painted inside its borders. If you don't 36 | * need a shadow to be casted from this panel, use a {@link JPanel} instead. 37 | */ 38 | public MaterialPanel() { 39 | elevation = ElevationEffect.applyTo(this, 1); 40 | setBorder(new EmptyBorder(MaterialShadow.OFFSET_TOP, MaterialShadow.OFFSET_LEFT, MaterialShadow.OFFSET_BOTTOM, MaterialShadow.OFFSET_RIGHT)); 41 | } 42 | 43 | /** 44 | * Gets the elevation level of this panel. Changes in elevation trigger an 45 | * animated transition if the component is currently visible, so it is 46 | * incorrect to assume the returned value will reflect how the resulting 47 | * shadow looks right now. 48 | * 49 | * @return elevation level [0~5] 50 | * @see ElevationEffect 51 | */ 52 | public double getElevation() { 53 | return elevation.getLevel(); 54 | } 55 | 56 | /** 57 | * Sets the elevation level of this panel. Changes in elevation trigger an 58 | * animated transition if the component is currently visible, so it will 59 | * take a little while for the resulting shadow to reflect the level once it 60 | * is set. 61 | * 62 | * @param elevation elevation level [0~5] 63 | * @see ElevationEffect 64 | */ 65 | public void setElevation(int elevation) { 66 | this.elevation.setLevel(elevation); 67 | } 68 | 69 | /** 70 | * Sets the background color of this panel. Keep on mind that setting a 71 | * background color in a Material component like this will also set the 72 | * foreground color to either white or black, depending of how bright or 73 | * dark is the chosen background color. 74 | *

75 | * NOTE: It is up to the look and feel to honor this property, some 76 | * may choose to ignore it. To avoid any conflicts, using the 77 | * 78 | * Metal Look and Feel is recommended. 79 | * 80 | * @param bg the desired background Color 81 | */ 82 | @Override 83 | public void setBackground(Color bg) { 84 | super.setBackground(bg); 85 | setForeground(MaterialUtils.isDark(bg) ? MaterialColor.WHITE : MaterialColor.DARK_BLACK); 86 | } 87 | 88 | @Override 89 | protected void paintComponent(Graphics g) { 90 | Graphics2D g2 = (Graphics2D) g; 91 | elevation.paint(g); 92 | g.setClip(MaterialShadow.OFFSET_LEFT, MaterialShadow.OFFSET_TOP, 93 | getWidth() - MaterialShadow.OFFSET_LEFT - MaterialShadow.OFFSET_RIGHT, 94 | getHeight() - MaterialShadow.OFFSET_TOP - MaterialShadow.OFFSET_BOTTOM); 95 | super.paintComponent(g2); 96 | g.setClip(null); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/MaterialShadow.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import java.awt.*; 4 | import java.awt.geom.RoundRectangle2D; 5 | import java.awt.image.BufferedImage; 6 | 7 | /** 8 | * A renderer for Material shadows. Shadows are a sign of elevation, and help 9 | * distinguishing elements inside a Material-based GUI. 10 | * 11 | * @author bilux (i.bilux@gmail.com) 12 | */ 13 | public class MaterialShadow { 14 | 15 | /** 16 | * The default offset between the border of the shadow and the top of a 17 | * Material component. 18 | */ 19 | public static final int OFFSET_TOP = 2; 20 | /** 21 | * The default offset between the border of the shadow and the left of a 22 | * Material component. 23 | */ 24 | public static final int OFFSET_LEFT = 2; 25 | /** 26 | * The default offset between the border of the shadow and the bottom of a 27 | * Material component. 28 | */ 29 | public static final int OFFSET_BOTTOM = 2; 30 | /** 31 | * The default offset between the border of the shadow and the right of a 32 | * Material component. 33 | */ 34 | public static final int OFFSET_RIGHT = 2; 35 | 36 | /** 37 | * Creates a {@link BufferedImage} containing a shadow1 projected from a 38 | * square component of the given width and height. 39 | * 40 | * @param width the component's width, inpixels 41 | * @param height the component's height, inpixels 42 | * @param level the elevation level [0~5] 43 | * @return A {@link BufferedImage} with the contents of the shadow1 for a 44 | * circular component of the given radius. 45 | */ 46 | public static BufferedImage renderShadow(int width, int height, double level) { 47 | return renderShadow(width, height, level, 3); 48 | } 49 | 50 | /** 51 | * Creates a {@link BufferedImage} containing a shadow1 projected from a 52 | * square component of the given width and height. 53 | * 54 | * @param width the component's width, inpixels 55 | * @param height the component's height, inpixels 56 | * @param level the elevation level [0~5] 57 | * @param borderRadius an applicable radius to the border of the shadow1 58 | * @return A {@link BufferedImage} with the contents of the shadow1 for a 59 | * circular component of the given radius. 60 | */ 61 | public static BufferedImage renderShadow(int width, int height, double level, double borderRadius) { 62 | 63 | if (level <= 0.0) { 64 | level = 0.0; 65 | } 66 | if (level >= 2.0) { 67 | level = 2.0; 68 | } 69 | 70 | // y = a * x + b 71 | float opacity1f = (float) ((2.0 / (1 + Math.exp(-2 * level))) - 1.0); 72 | float radius1f = (float) ((4.0 / (1 + Math.exp(-2 * level))) - 2.0); 73 | 74 | //float radius1f = (float) (2.5 * Math.sin(0.41 * level * level) + 0.5); 75 | //System.out.println("level: " + level+" > radius1f: " + radius1f +" > opacity1f: " + opacity1f); 76 | BufferedImage shadowBlurImage = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR); 77 | Graphics2D graphics2D = (Graphics2D) shadowBlurImage.getGraphics(); 78 | //graphics2D.setComposite(AlphaComposite.SrcOver); 79 | graphics2D.setColor(new Color(0f, 0f, 0f, opacity1f)); 80 | graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 81 | graphics2D.fill(new RoundRectangle2D.Float(OFFSET_LEFT, OFFSET_TOP, width - OFFSET_LEFT - OFFSET_RIGHT, height - OFFSET_TOP - OFFSET_BOTTOM, (float) borderRadius, (float) borderRadius)); 82 | graphics2D.dispose(); 83 | FastGaussianBlur.blur(shadowBlurImage, radius1f, 3); 84 | 85 | return shadowBlurImage; 86 | 87 | } 88 | 89 | private int pWd, pHt; 90 | private double pLv, pRd; 91 | private BufferedImage shadowBg; 92 | 93 | /** 94 | * Default constructor for a {@code MaterialShadow}. It is recommended to 95 | * keep a single instance for each component that requires it. The 96 | * components bundled in this library already handle this by themselves. 97 | */ 98 | public MaterialShadow() { 99 | } 100 | 101 | /** 102 | * Renders this {@link MaterialShadow} into a {@link BufferedImage} and 103 | * returns it. A copy of the latest render is kept in case a shadow1 of the 104 | * same dimensions and elevation is needed in order to decrease CPU usage 105 | * when the component is idle. 106 | * 107 | * @param width the witdh of the square component casting a shadow1, or 108 | * diameter if it is circular. 109 | * @param height the height of the square component casting a shadow1. 110 | * @param radius the radius of the borders of a square component casting a 111 | * shadow1. 112 | * @param level the depth of the shadow1 [0~5] 113 | * @return A {@link BufferedImage} with the contents of the shadow1. 114 | * @see Type#SQUARE 115 | * @see Type#CIRCULAR 116 | */ 117 | public BufferedImage render(int width, int height, double radius, double level) { 118 | if (pWd != width || pHt != height || pRd != radius || pLv != level) { 119 | shadowBg = MaterialShadow.renderShadow(width, height, level, radius); 120 | pWd = width; 121 | pHt = height; 122 | pRd = radius; 123 | pLv = level; 124 | } 125 | return shadowBg; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/MaterialTextField.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import com.hq.swingmaterialdesign.materialdesign.resource.MaterialColor; 4 | import com.hq.swingmaterialdesign.materialdesign.resource.Roboto; 5 | 6 | import javax.swing.*; 7 | import javax.swing.text.DefaultCaret; 8 | import java.awt.*; 9 | import java.awt.event.FocusEvent; 10 | import java.awt.event.KeyEvent; 11 | 12 | /** 13 | * A Material Design single-line text field is the basic way of getting user 14 | * input. It includes a descriptive label that appears as a placeholder and then 15 | * floats above the text field as content is written. You can also set a hint 16 | * for it to appear below the label when the text field is empty. 17 | * 18 | * 19 | * @author bilux (i.bilux@gmail.com) 20 | */ 21 | public class MaterialTextField extends JTextField { 22 | 23 | public static final int HINT_OPACITY_MASK = 0x99000000; 24 | public static final int LINE_OPACITY_MASK = 0x66000000; 25 | 26 | private final MaterialFloatingLabel hintLabel = new MaterialFloatingLabel(this); 27 | private final MaterialLine line = new MaterialLine(this); 28 | 29 | private Color accentColor = MaterialColor.CYAN_500; 30 | 31 | /** 32 | * Default constructor for {@code MaterialTextField}. A default model is 33 | * created and the initial string is empty. 34 | */ 35 | public MaterialTextField() { 36 | super(); 37 | setBorder(null); 38 | setFont(Roboto.REGULAR.deriveFont(16f)); 39 | hintLabel.setText(""); 40 | setOpaque(false); 41 | setBackground(MaterialColor.WHITE); 42 | 43 | setCaret(new DefaultCaret() { 44 | @Override 45 | protected synchronized void damage(Rectangle r) { 46 | MaterialTextField.this.repaint(); //fix caret not being removed completely 47 | } 48 | }); 49 | getCaret().setBlinkRate(500); 50 | } 51 | 52 | /** 53 | * Default constructor for {@code MaterialTextField}. A default model is 54 | * created and the initial string is the one provided. 55 | * 56 | * @param text An starting value for this text field 57 | */ 58 | public MaterialTextField(String text) { 59 | super.setText(text); 60 | } 61 | 62 | /** 63 | * Gets the label text. The label will float above any contents input into 64 | * this text field. 65 | * 66 | * @return the text being used in the textfield label 67 | */ 68 | public String getLabel() { 69 | return hintLabel.getText(); 70 | } 71 | 72 | /** 73 | * Sets the label text. The label text is displayed when this textfield is 74 | * empty. 75 | * 76 | * 77 | * @param label the text to use in the floating label 78 | */ 79 | public void setLabel(String label) { 80 | hintLabel.setText(label); 81 | repaint(); 82 | } 83 | 84 | /** 85 | * Gets the color the label changes to when this {@code materialTextField} 86 | * is focused. 87 | * 88 | * @return the {@code "Color"} currently in use for accent. The default 89 | * value is {@link MaterialColor#CYAN_300}. 90 | */ 91 | public Color getAccent() { 92 | return accentColor; 93 | } 94 | 95 | /** 96 | * Sets the color the label changes to when this {@code materialTextField} 97 | * is focused. The default value is {@link MaterialColor#CYAN_300}. 98 | * 99 | * @param accentColor the {@code "Color"} that should be used for accent. 100 | */ 101 | public void setAccent(Color accentColor) { 102 | this.accentColor = accentColor; 103 | hintLabel.setAccent(accentColor); 104 | } 105 | 106 | @Override 107 | public void setForeground(Color fg) { 108 | super.setForeground(fg); 109 | if (hintLabel != null) { 110 | hintLabel.updateForeground(); 111 | } 112 | } 113 | 114 | @Override 115 | public void setText(String string) { 116 | super.setText(string); 117 | hintLabel.update(); 118 | line.update(); 119 | } 120 | 121 | @Override 122 | protected void processFocusEvent(FocusEvent e) { 123 | super.processFocusEvent(e); 124 | hintLabel.update(); 125 | line.update(); 126 | } 127 | 128 | @Override 129 | protected void processKeyEvent(KeyEvent e) { 130 | super.processKeyEvent(e); 131 | hintLabel.update(); 132 | line.update(); 133 | } 134 | 135 | @Override 136 | protected void paintComponent(Graphics g) { 137 | Graphics2D g2 = (Graphics2D) g; 138 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); 139 | g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); 140 | 141 | // paint text baground 142 | g2.setColor(getBackground()); 143 | g2.fillRect(0, (getHeight() / 2) - 4, getWidth(), getHeight() / 2); 144 | 145 | g2.translate(0, 9); 146 | super.paintComponent(g); 147 | g2.translate(0, -9); 148 | 149 | // hint label in text 150 | if (!getLabel().isEmpty() && getText().isEmpty() && (getLabel().isEmpty() || isFocusOwner())) { 151 | g.setFont(Roboto.REGULAR.deriveFont(16f)); 152 | g2.setColor(MaterialUtils.applyAlphaMask(getForeground(), HINT_OPACITY_MASK)); 153 | FontMetrics metrics = g.getFontMetrics(g.getFont()); 154 | g.drawString(getLabel(), 0, metrics.getAscent() + getHeight() / 2); 155 | } 156 | 157 | // paint hint label 158 | hintLabel.paint(g2); 159 | 160 | // paint line under text 161 | g2.setColor(MaterialUtils.applyAlphaMask(getForeground(), LINE_OPACITY_MASK)); 162 | g2.fillRect(0, getHeight() - 4, getWidth(), 1); 163 | 164 | // paint animated line under text 165 | g2.setColor(accentColor); 166 | g2.fillRect((int) ((getWidth() - line.getWidth()) / 2), getHeight() - 5, (int) line.getWidth(), 2); 167 | } 168 | 169 | @Override 170 | protected void paintBorder(Graphics g) { 171 | //intentionally left blank 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/MaterialUtils.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import java.awt.Color; 4 | 5 | /** 6 | * This class provides utilitary methods for Swing Material. These are public 7 | * and thus can be used directly. 8 | * 9 | * @author DragShot 10 | * 11 | * @author bilux (i.bilux@gmail.com) 12 | */ 13 | public class MaterialUtils { 14 | 15 | /** 16 | * Determines if a given {@link Color} is dark enough for white text to be 17 | * seen more easily than black text. This tries to stick to the Material 18 | * Color Guide as much as possible, and although two or three of the color 19 | * pairs doesn't match, the results are still good enough. 20 | * 21 | * @param color a {@link Color} to evaluate 22 | * @return {@code true} if the provided color is dark, {@code false} 23 | * otherwise. 24 | * @author DragShot 25 | */ 26 | public static boolean isDark(Color color) { 27 | //return (color.getRed()*0.299 + color.getGreen()*0.587 + color.getBlue()*0.114) < (0.6*255); 28 | //return (color.getRed() + color.getGreen() + color.getBlue())/3 < (0.63*255); 29 | return (color.getRed() * 0.2125 + color.getGreen() * 0.7154 + color.getBlue() * 0.0721) < (0.535 * 255); 30 | //return (color.getRed()*0.21 + color.getGreen()*0.72 + color.getBlue()*0.07) < (0.54*255); 31 | } 32 | 33 | /** 34 | * Utilitary method for getting a copy of a provided Color but using an 35 | * specific opacity mask. Intented for use within the library. 36 | * 37 | * @param color the color to use as base 38 | * @param bitMask the bitmask to apply, where the bits 25 to 32 are used 39 | * @return a copy of the given color, with a modified alpha value 40 | */ 41 | public static Color applyAlphaMask(Color color, int bitMask) { 42 | return new Color(color.getRGB() & 0x00FFFFFF | (bitMask & 0xFF000000), true); 43 | } 44 | 45 | /** 46 | * Utilitary method for getting a darker version of a provided Color. Unlike 47 | * {@link Color#darker()}, this decreases color at a fixed step instead of a 48 | * proportional. 49 | * 50 | * @param color the original color 51 | * @return a {@link Color} sightly darker than the one input. 52 | */ 53 | public static Color darken(Color color) { 54 | int r = wrapU8B(color.getRed() - 30); 55 | int g = wrapU8B(color.getGreen() - 30); 56 | int b = wrapU8B(color.getBlue() - 30); 57 | return new Color(r, g, b, color.getAlpha()); 58 | } 59 | 60 | /** 61 | * Utilitary method for getting a darker version of a provided Color. Unlike 62 | * {@link Color#brighter()}, this increases color at a fixed step instead of 63 | * a proportional. 64 | * 65 | * @param color the original color 66 | * @return a {@link Color} sightly brighter than the one input. 67 | */ 68 | public static Color brighten(Color color) { 69 | int r = wrapU8B(color.getRed() + 30); 70 | int g = wrapU8B(color.getGreen() + 30); 71 | int b = wrapU8B(color.getBlue() + 30); 72 | return new Color(r, g, b, color.getAlpha()); 73 | } 74 | 75 | public static Color brighten(Color color, int level) { 76 | int r = wrapU8B(color.getRed() + level); 77 | int g = wrapU8B(color.getGreen() + level); 78 | int b = wrapU8B(color.getBlue() + level); 79 | return new Color(r, g, b, color.getAlpha()); 80 | } 81 | 82 | private static int wrapU8B(int i) { 83 | return Math.min(255, Math.max(0, i)); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/RippleEffect.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign; 2 | 3 | import com.hq.swingmaterialdesign.materialdesign.animation.AnimationListener; 4 | import com.hq.swingmaterialdesign.materialdesign.animation.Animator; 5 | import javax.swing.*; 6 | import java.awt.*; 7 | import java.awt.event.MouseAdapter; 8 | import java.awt.event.MouseEvent; 9 | 10 | /** 11 | * A {@code RippleEffect} is applied into certain components, like buttons and 12 | * certain list elements. Basically, is that wave of color that appears when you 13 | * click stuff. 14 | * 15 | * @author bilux (i.bilux@gmail.com) 16 | */ 17 | public class RippleEffect { 18 | 19 | private final JComponent target; 20 | private final RippleAnimation ripple = new RippleAnimation(); 21 | 22 | private RippleEffect(final JComponent component) { 23 | this.target = component; 24 | } 25 | 26 | /** 27 | * Paints this effect. Each component is responsible of calling {@link 28 | * #paint(Graphics)} in order to display the effect. Here's an example of 29 | * how the ripple effect can be used: 30 | * 31 | * @param g canvas 32 | */ 33 | public void paint(Graphics g) { 34 | if (ripple.isRippling()) { 35 | Graphics2D g2 = (Graphics2D) g; 36 | float rippleOpacity = (float) ripple.getRippleOpacity(); 37 | Point rippleCenter = ripple.getRippleCenter(); 38 | int rippleRadius = (int) ripple.getRippleRadius(); 39 | Color fg = g2.getColor(); 40 | g2.setColor(new Color(fg.getRed() / 255f, fg.getGreen() / 255f, fg.getBlue() / 255f, rippleOpacity)); 41 | g2.fillOval(rippleCenter.x - rippleRadius, rippleCenter.y - rippleRadius, 2 * rippleRadius, 2 * rippleRadius); 42 | } 43 | } 44 | 45 | /** 46 | * Adds a ripple at the given point. 47 | * 48 | * @param point point to add the ripple at 49 | * @param maxRadius the maximum radius of the ripple 50 | */ 51 | private void addRipple(Point point, int maxRadius) { 52 | ripple.setRipple(point, maxRadius); 53 | ripple.start(); 54 | } 55 | 56 | /** 57 | * Creates a ripple effect for the given component. Each component is 58 | * responsible of calling {@link #paint(Graphics)} in order to display the 59 | * effect. Here's an example of how the ripple effect can be used: 60 | * 61 | * @param target target component 62 | * @return ripple effect for that component 63 | * @see MaterialButton for an example of how the ripple effect is used 64 | */ 65 | public static RippleEffect applyTo(final JComponent target) { 66 | final RippleEffect rippleEffect = new RippleEffect(target); 67 | target.addMouseListener(new MouseAdapter() { 68 | @Override 69 | public void mousePressed(MouseEvent e) { 70 | rippleEffect.addRipple(e.getPoint(), target.getWidth()); 71 | } 72 | }); 73 | return rippleEffect; 74 | } 75 | 76 | /** 77 | * Creates a ripple effect for the given component that is limited to the 78 | * component's size and will always start in the center. Each component is 79 | * responsible of calling {@link #paint(Graphics)} in order to display the 80 | * effect. Here's an example of how the ripple effect can be used: 81 | * 82 | * @param target target component 83 | * @return ripple effect for that component 84 | * @see MaterialButton for an example of how the ripple effect is used 85 | */ 86 | public static RippleEffect applyFixedTo(final JComponent target) { 87 | final RippleEffect rippleEffect = new RippleEffect(target); 88 | target.addMouseListener(new MouseAdapter() { 89 | @Override 90 | public void mousePressed(MouseEvent e) { 91 | rippleEffect.addRipple(new Point(24, 24), target.getWidth() / 2); 92 | } 93 | }); 94 | return rippleEffect; 95 | } 96 | 97 | /** 98 | * A ripple animation (one ripple circle after one click). 99 | */ 100 | private class RippleAnimation { 101 | 102 | private final Animator animator; 103 | private Point rippleCenter; 104 | private int maxRadius; 105 | private double rippleRadius; 106 | private double targetRippleRadius; 107 | private double rippleRadiusCrement; 108 | private double rippleOpacity; 109 | 110 | private RippleAnimation() { 111 | animator = new Animator(new AnimationListener() { 112 | @Override 113 | public void onStart() { 114 | rippleRadius = 0; 115 | targetRippleRadius = maxRadius; 116 | rippleRadiusCrement = +(double) (targetRippleRadius - rippleRadius); 117 | rippleOpacity = 0.5; 118 | } 119 | 120 | @Override 121 | public void onAnimation(double percent) { 122 | rippleRadius = rippleRadiusCrement * percent * percent; 123 | rippleOpacity = 0.5 * Math.sin(3.0 * percent * percent); 124 | target.repaint(); 125 | } 126 | 127 | @Override 128 | public void onEnd() { 129 | rippleRadius = 0; 130 | target.repaint(); 131 | } 132 | 133 | @Override 134 | public void onStop() { 135 | rippleRadius = 0; 136 | target.repaint(); 137 | } 138 | }) 139 | .setDelay(0) 140 | .setDuration(999); 141 | } 142 | 143 | void start() { 144 | animator.start(); 145 | } 146 | 147 | public void setRipple(Point rippleCenter, int maxRadius) { 148 | this.rippleCenter = rippleCenter; 149 | this.maxRadius = maxRadius; 150 | } 151 | 152 | public double getRippleOpacity() { 153 | return rippleOpacity; 154 | } 155 | 156 | public Point getRippleCenter() { 157 | return rippleCenter; 158 | } 159 | 160 | public double getRippleRadius() { 161 | return rippleRadius; 162 | } 163 | 164 | public boolean isRippling() { 165 | return animator.isRunning(); 166 | } 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/animation/AnimationListener.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign.animation; 2 | 3 | public interface AnimationListener { 4 | 5 | public void onStart(); 6 | 7 | public void onAnimation(double percent); 8 | 9 | public void onStop(); 10 | 11 | public void onEnd(); 12 | } 13 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/animation/Animator.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign.animation; 2 | 3 | import javax.swing.*; 4 | 5 | /** 6 | * 7 | * @author bilux (i.bilux@gmail.com) 8 | */ 9 | public class Animator { 10 | 11 | private final AnimationListener animationListener; 12 | private Timer animatorTimer; 13 | 14 | private int duration; 15 | private int takenTime; 16 | private long startTime; 17 | 18 | public Animator(AnimationListener listener) { 19 | this.animationListener = listener; 20 | 21 | animatorTimer = new Timer(1, e -> { 22 | takenTime = (int) (System.currentTimeMillis() - startTime); 23 | animationListener.onAnimation((double) takenTime / duration); 24 | if (takenTime >= duration) { 25 | SwingUtilities.invokeLater(() -> { 26 | animatorTimer.stop(); 27 | animationListener.onEnd(); 28 | }); 29 | } 30 | }); 31 | animatorTimer.setCoalesce(true); 32 | } 33 | 34 | public Animator setDelay(int delay) { 35 | animatorTimer.setInitialDelay(delay); 36 | return this; 37 | } 38 | 39 | public Animator setDuration(int duration) { 40 | this.duration = duration; 41 | return this; 42 | } 43 | 44 | public int getDuration() { 45 | return duration; 46 | } 47 | 48 | public void start() { 49 | animatorTimer.stop(); 50 | animationListener.onStart(); 51 | startTime = System.currentTimeMillis(); 52 | 53 | animatorTimer.start(); 54 | } 55 | 56 | public Animator stop() { 57 | if (animatorTimer != null && animatorTimer.isRunning()) { 58 | animationListener.onStop(); 59 | animatorTimer.stop(); 60 | } 61 | return this; 62 | } 63 | 64 | public boolean isRunning() { 65 | return animatorTimer != null && animatorTimer.isRunning(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/resource/MaterialColor.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign.resource; 2 | 3 | import java.awt.*; 4 | 5 | /** 6 | * Material Design Color palette. 7 | * 8 | * 9 | * @author bilux (i.bilux@gmail.com) 10 | */ 11 | public class MaterialColor { 12 | 13 | public static final Color RED__50 = Color.decode("#ffebee"); 14 | public static final Color RED__100 = Color.decode("#ffcdd2"); 15 | public static final Color RED__200 = Color.decode("#ef9a9a"); 16 | public static final Color RED_300 = Color.decode("#e57373"); 17 | public static final Color RED_400 = Color.decode("#ef5350"); 18 | public static final Color RED_500 = Color.decode("#f44336"); 19 | public static final Color RED_600 = Color.decode("#e53935"); 20 | public static final Color RED_700 = Color.decode("#d32f2f"); 21 | public static final Color RED_800 = Color.decode("#c62828"); 22 | public static final Color RED_900 = Color.decode("#b71c1c"); 23 | public static final Color REDA_100 = Color.decode("#ff8a80"); 24 | public static final Color REDA_200 = Color.decode("#ff5252"); 25 | public static final Color REDA_400 = Color.decode("#ff1744"); 26 | public static final Color REDA_700 = Color.decode("#d50000"); 27 | 28 | public static final Color PINK_50 = Color.decode("#fce4ec"); 29 | public static final Color PINK_100 = Color.decode("#f8bbd0"); 30 | public static final Color PINK_200 = Color.decode("#f48fb1"); 31 | public static final Color PINK_300 = Color.decode("#f06292"); 32 | public static final Color PINK_400 = Color.decode("#ec407a"); 33 | public static final Color PINK_500 = Color.decode("#e91e63"); 34 | public static final Color PINK_600 = Color.decode("#d81b60"); 35 | public static final Color PINK_700 = Color.decode("#c2185b"); 36 | public static final Color PINK_800 = Color.decode("#ad1457"); 37 | public static final Color PINK_900 = Color.decode("#880e4f"); 38 | public static final Color PINKA_100 = Color.decode("#ff80ab"); 39 | public static final Color PINKA_200 = Color.decode("#ff4081"); 40 | public static final Color PINKA_400 = Color.decode("#f50057"); 41 | public static final Color PINKA_700 = Color.decode("#c51162"); 42 | 43 | public static final Color PURPLE_50 = Color.decode("#f3e5f5"); 44 | public static final Color PURPLE_100 = Color.decode("#e1bee7"); 45 | public static final Color PURPLE_200 = Color.decode("#ce93d8"); 46 | public static final Color PURPLE_300 = Color.decode("#ba68c8"); 47 | public static final Color PURPLE_400 = Color.decode("#ab47bc"); 48 | public static final Color PURPLE_500 = Color.decode("#9c27b0"); 49 | public static final Color PURPLE_600 = Color.decode("#8e24aa"); 50 | public static final Color PURPLE_700 = Color.decode("#7b1fa2"); 51 | public static final Color PURPLE_800 = Color.decode("#6a1b9a"); 52 | public static final Color PURPLE_900 = Color.decode("#4a148c"); 53 | public static final Color PURPLEA_100 = Color.decode("#ea80fc"); 54 | public static final Color PURPLEA_200 = Color.decode("#e040fb"); 55 | public static final Color PURPLEA_400 = Color.decode("#d500f9"); 56 | public static final Color PURPLEA_700 = Color.decode("#aa00ff"); 57 | 58 | public static final Color DEEPPURPLE_50 = Color.decode("#ede7f6"); 59 | public static final Color DEEPPURPLE_100 = Color.decode("#d1c4e9"); 60 | public static final Color DEEPPURPLE_200 = Color.decode("#b39ddb"); 61 | public static final Color DEEPPURPLE_300 = Color.decode("#9575cd"); 62 | public static final Color DEEPPURPLE_400 = Color.decode("#7e57c2"); 63 | public static final Color DEEPPURPLE_500 = Color.decode("#673ab7"); 64 | public static final Color DEEPPURPLE_600 = Color.decode("#5e35b1"); 65 | public static final Color DEEPPURPLE_700 = Color.decode("#512da8"); 66 | public static final Color DEEPPURPLE_800 = Color.decode("#4527a0"); 67 | public static final Color DEEPPURPLE_900 = Color.decode("#311b92"); 68 | public static final Color DEEPPURPLEA_100 = Color.decode("#b388ff"); 69 | public static final Color DEEPPURPLEA_200 = Color.decode("#7c4dff"); 70 | public static final Color DEEPPURPLEA_400 = Color.decode("#651fff"); 71 | public static final Color DEEPPURPLEA_700 = Color.decode("#6200ea"); 72 | 73 | public static final Color INDIGO_50 = Color.decode("#e8eaf6"); 74 | public static final Color INDIGO_100 = Color.decode("#c5cae9"); 75 | public static final Color INDIGO_200 = Color.decode("#9fa8da"); 76 | public static final Color INDIGO_300 = Color.decode("#7986cb"); 77 | public static final Color INDIGO_400 = Color.decode("#5c6bc0"); 78 | public static final Color INDIGO_500 = Color.decode("#3f51b5"); 79 | public static final Color INDIGO_600 = Color.decode("#3949ab"); 80 | public static final Color INDIGO_700 = Color.decode("#303f9f"); 81 | public static final Color INDIGO_800 = Color.decode("#283593"); 82 | public static final Color INDIGO_900 = Color.decode("#1a237e"); 83 | public static final Color INDIGOA_100 = Color.decode("#8c9eff"); 84 | public static final Color INDIGOA_200 = Color.decode("#536dfe"); 85 | public static final Color INDIGOA_400 = Color.decode("#3d5afe"); 86 | public static final Color INDIGOA_700 = Color.decode("#304ffe"); 87 | 88 | public static final Color BLUE_50 = Color.decode("#e3f2fd"); 89 | public static final Color BLUE_100 = Color.decode("#bbdefb"); 90 | public static final Color BLUE_200 = Color.decode("#90caf9"); 91 | public static final Color BLUE_300 = Color.decode("#64b5f6"); 92 | public static final Color BLUE_400 = Color.decode("#42a5f5"); 93 | public static final Color BLUE_500 = Color.decode("#2196f3"); 94 | public static final Color BLUE_600 = Color.decode("#1e88e5"); 95 | public static final Color BLUE_700 = Color.decode("#1976d2"); 96 | public static final Color BLUE_800 = Color.decode("#1565c0"); 97 | public static final Color BLUE_900 = Color.decode("#0d47a1"); 98 | public static final Color BLUEA_100 = Color.decode("#82b1ff"); 99 | public static final Color BLUEA_200 = Color.decode("#448aff"); 100 | public static final Color BLUEA_400 = Color.decode("#2979ff"); 101 | public static final Color BLUEA_700 = Color.decode("#2962ff"); 102 | 103 | public static final Color LIGHTBLUE_50 = Color.decode("#e1f5fe"); 104 | public static final Color LIGHTBLUE_100 = Color.decode("#b3e5fc"); 105 | public static final Color LIGHTBLUE_200 = Color.decode("#81d4fa"); 106 | public static final Color LIGHTBLUE_300 = Color.decode("#4fc3f7"); 107 | public static final Color LIGHTBLUE_400 = Color.decode("#29b6f6"); 108 | public static final Color LIGHTBLUE_500 = Color.decode("#03a9f4"); 109 | public static final Color LIGHTBLUE_600 = Color.decode("#039be5"); 110 | public static final Color LIGHTBLUE_700 = Color.decode("#0288d1"); 111 | public static final Color LIGHTBLUE_800 = Color.decode("#0277bd"); 112 | public static final Color LIGHTBLUE_900 = Color.decode("#01579b"); 113 | public static final Color LIGHTBLUEA_100 = Color.decode("#80d8ff"); 114 | public static final Color LIGHTBLUEA_200 = Color.decode("#40c4ff"); 115 | public static final Color LIGHTBLUEA_400 = Color.decode("#00b0ff"); 116 | public static final Color LIGHTBLUEA_700 = Color.decode("#0091ea"); 117 | 118 | public static final Color CYAN_50 = Color.decode("#e0f7fa"); 119 | public static final Color CYAN_100 = Color.decode("#b2ebf2"); 120 | public static final Color CYAN_200 = Color.decode("#80deea"); 121 | public static final Color CYAN_300 = Color.decode("#4dd0e1"); 122 | public static final Color CYAN_400 = Color.decode("#26c6da"); 123 | public static final Color CYAN_500 = Color.decode("#00bcd4"); 124 | public static final Color CYAN_600 = Color.decode("#00acc1"); 125 | public static final Color CYAN_700 = Color.decode("#0097a7"); 126 | public static final Color CYAN_800 = Color.decode("#00838f"); 127 | public static final Color CYAN_900 = Color.decode("#006064"); 128 | public static final Color CYANA_100 = Color.decode("#84ffff"); 129 | public static final Color CYANA_200 = Color.decode("#18ffff"); 130 | public static final Color CYANA_400 = Color.decode("#00e5ff"); 131 | public static final Color CYANA_700 = Color.decode("#00b8d4"); 132 | 133 | public static final Color TEAL_50 = Color.decode("#e0f2f1"); 134 | public static final Color TEAL_100 = Color.decode("#b2dfdb"); 135 | public static final Color TEAL_200 = Color.decode("#80cbc4"); 136 | public static final Color TEAL_300 = Color.decode("#4db6ac"); 137 | public static final Color TEAL_400 = Color.decode("#26a69a"); 138 | public static final Color TEAL_500 = Color.decode("#009688"); 139 | public static final Color TEAL_600 = Color.decode("#00897b"); 140 | public static final Color TEAL_700 = Color.decode("#00796b"); 141 | public static final Color TEAL_800 = Color.decode("#00695c"); 142 | public static final Color TEAL_900 = Color.decode("#004d40"); 143 | public static final Color TEALA_100 = Color.decode("#a7ffeb"); 144 | public static final Color TEALA_200 = Color.decode("#64ffda"); 145 | public static final Color TEALA_400 = Color.decode("#1de9b6"); 146 | public static final Color TEALA_700 = Color.decode("#00bfa5"); 147 | 148 | public static final Color GREEN_50 = Color.decode("#e8f5e9"); 149 | public static final Color GREEN_100 = Color.decode("#c8e6c9"); 150 | public static final Color GREEN_200 = Color.decode("#a5d6a7"); 151 | public static final Color GREEN_300 = Color.decode("#81c784"); 152 | public static final Color GREEN_400 = Color.decode("#66bb6a"); 153 | public static final Color GREEN_500 = Color.decode("#4caf50"); 154 | public static final Color GREEN_600 = Color.decode("#43a047"); 155 | public static final Color GREEN_700 = Color.decode("#388e3c"); 156 | public static final Color GREEN_800 = Color.decode("#2e7d32"); 157 | public static final Color GREEN_900 = Color.decode("#1b5e20"); 158 | public static final Color GREENA_100 = Color.decode("#b9f6ca"); 159 | public static final Color GREENA_200 = Color.decode("#69f0ae"); 160 | public static final Color GREENA_400 = Color.decode("#00e676"); 161 | public static final Color GREENA_700 = Color.decode("#00c853"); 162 | 163 | public static final Color LIGHTGREEN_50 = Color.decode("#f1f8e9"); 164 | public static final Color LIGHTGREEN_100 = Color.decode("#dcedc8"); 165 | public static final Color LIGHTGREEN_200 = Color.decode("#c5e1a5"); 166 | public static final Color LIGHTGREEN_300 = Color.decode("#aed581"); 167 | public static final Color LIGHTGREEN_400 = Color.decode("#9ccc65"); 168 | public static final Color LIGHTGREEN_500 = Color.decode("#8bc34a"); 169 | public static final Color LIGHTGREEN_600 = Color.decode("#7cb342"); 170 | public static final Color LIGHTGREEN_700 = Color.decode("#689f38"); 171 | public static final Color LIGHTGREEN_800 = Color.decode("#558b2f"); 172 | public static final Color LIGHTGREEN_900 = Color.decode("#33691e"); 173 | public static final Color LIGHTGREENA_100 = Color.decode("#ccff90"); 174 | public static final Color LIGHTGREENA_200 = Color.decode("#b2ff59"); 175 | public static final Color LIGHTGREENA_400 = Color.decode("#76ff03"); 176 | public static final Color LIGHTGREENA_700 = Color.decode("#64dd17"); 177 | 178 | public static final Color LIME_50 = Color.decode("#f9fbe7"); 179 | public static final Color LIME_100 = Color.decode("#f0f4c3"); 180 | public static final Color LIME_200 = Color.decode("#e6ee9c"); 181 | public static final Color LIME_300 = Color.decode("#dce775"); 182 | public static final Color LIME_400 = Color.decode("#d4e157"); 183 | public static final Color LIME_500 = Color.decode("#cddc39"); 184 | public static final Color LIME_600 = Color.decode("#c0ca33"); 185 | public static final Color LIME_700 = Color.decode("#afb42b"); 186 | public static final Color LIME_800 = Color.decode("#9e9d24"); 187 | public static final Color LIME_900 = Color.decode("#827717"); 188 | public static final Color LIMEA_100 = Color.decode("#f4ff81"); 189 | public static final Color LIMEA_200 = Color.decode("#eeff41"); 190 | public static final Color LIMEA_400 = Color.decode("#c6ff00"); 191 | public static final Color LIMEA_700 = Color.decode("#aeea00"); 192 | 193 | public static final Color YELLOW_50 = Color.decode("#fffde7"); 194 | public static final Color YELLOW_100 = Color.decode("#fff9c4"); 195 | public static final Color YELLOW_200 = Color.decode("#fff59d"); 196 | public static final Color YELLOW_300 = Color.decode("#fff176"); 197 | public static final Color YELLOW_400 = Color.decode("#ffee58"); 198 | public static final Color YELLOW_500 = Color.decode("#ffeb3b"); 199 | public static final Color YELLOW_600 = Color.decode("#fdd835"); 200 | public static final Color YELLOW_700 = Color.decode("#fbc02d"); 201 | public static final Color YELLOW_800 = Color.decode("#f9a825"); 202 | public static final Color YELLOW_900 = Color.decode("#f57f17"); 203 | public static final Color YELLOWA_100 = Color.decode("#ffff8d"); 204 | public static final Color YELLOWA_200 = Color.decode("#ffff00"); 205 | public static final Color YELLOWA_400 = Color.decode("#ffea00"); 206 | public static final Color YELLOWA_700 = Color.decode("#ffd600"); 207 | 208 | public static final Color AMBER_50 = Color.decode("#fff8e1"); 209 | public static final Color AMBER_100 = Color.decode("#ffecb3"); 210 | public static final Color AMBER_200 = Color.decode("#ffe082"); 211 | public static final Color AMBER_300 = Color.decode("#ffd54f"); 212 | public static final Color AMBER_400 = Color.decode("#ffca28"); 213 | public static final Color AMBER_500 = Color.decode("#ffc107"); 214 | public static final Color AMBER_600 = Color.decode("#ffb300"); 215 | public static final Color AMBER_700 = Color.decode("#ffa000"); 216 | public static final Color AMBER_800 = Color.decode("#ff8f00"); 217 | public static final Color AMBER_900 = Color.decode("#ff6f00"); 218 | public static final Color AMBERA_100 = Color.decode("#ffe57f"); 219 | public static final Color AMBERA_200 = Color.decode("#ffd740"); 220 | public static final Color AMBERA_400 = Color.decode("#ffc400"); 221 | public static final Color AMBERA_700 = Color.decode("#ffab00"); 222 | 223 | public static final Color ORANGE_50 = Color.decode("#fff3e0"); 224 | public static final Color ORANGE_100 = Color.decode("#ffe0b2"); 225 | public static final Color ORANGE_200 = Color.decode("#ffcc80"); 226 | public static final Color ORANGE_300 = Color.decode("#ffb74d"); 227 | public static final Color ORANGE_400 = Color.decode("#ffa726"); 228 | public static final Color ORANGE_500 = Color.decode("#ff9800"); 229 | public static final Color ORANGE_600 = Color.decode("#fb8c00"); 230 | public static final Color ORANGE_700 = Color.decode("#f57c00"); 231 | public static final Color ORANGE_800 = Color.decode("#ef6c00"); 232 | public static final Color ORANGE_900 = Color.decode("#e65100"); 233 | public static final Color ORANGEA_100 = Color.decode("#ffd180"); 234 | public static final Color ORANGEA_200 = Color.decode("#ffab40"); 235 | public static final Color ORANGEA_400 = Color.decode("#ff9100"); 236 | public static final Color ORANGEA_700 = Color.decode("#ff6d00"); 237 | 238 | public static final Color DEEPORANGE_50 = Color.decode("#fbe9e7"); 239 | public static final Color DEEPORANGE_100 = Color.decode("#ffccbc"); 240 | public static final Color DEEPORANGE_200 = Color.decode("#ffab91"); 241 | public static final Color DEEPORANGE_300 = Color.decode("#ff8a65"); 242 | public static final Color DEEPORANGE_400 = Color.decode("#ff7043"); 243 | public static final Color DEEPORANGE_500 = Color.decode("#ff5722"); 244 | public static final Color DEEPORANGE_600 = Color.decode("#f4511e"); 245 | public static final Color DEEPORANGE_700 = Color.decode("#e64a19"); 246 | public static final Color DEEPORANGE_800 = Color.decode("#d84315"); 247 | public static final Color DEEPORANGE_900 = Color.decode("#bf360c"); 248 | public static final Color DEEPORANGEA_100 = Color.decode("#ff9e80"); 249 | public static final Color DEEPORANGEA_200 = Color.decode("#ff6e40"); 250 | public static final Color DEEPORANGEA_400 = Color.decode("#ff3d00"); 251 | public static final Color DEEPORANGEA_700 = Color.decode("#dd2c00"); 252 | 253 | public static final Color BROWN_50 = Color.decode("#efebe9"); 254 | public static final Color BROWN_100 = Color.decode("#d7ccc8"); 255 | public static final Color BROWN_200 = Color.decode("#bcaaa4"); 256 | public static final Color BROWN_300 = Color.decode("#a1887f"); 257 | public static final Color BROWN_400 = Color.decode("#8d6e63"); 258 | public static final Color BROWN_500 = Color.decode("#795548"); 259 | public static final Color BROWN_600 = Color.decode("#6d4c41"); 260 | public static final Color BROWN_700 = Color.decode("#5d4037"); 261 | public static final Color BROWN_800 = Color.decode("#4e342e"); 262 | public static final Color BROWN_900 = Color.decode("#3e2723"); 263 | 264 | public static final Color BLUEGREY_50 = Color.decode("#eceff1"); 265 | public static final Color BLUEGREY_100 = Color.decode("#cfd8dc"); 266 | public static final Color BLUEGREY_200 = Color.decode("#b0bec5"); 267 | public static final Color BLUEGREY_300 = Color.decode("#90a4ae"); 268 | public static final Color BLUEGREY_400 = Color.decode("#78909c"); 269 | public static final Color BLUEGREY_500 = Color.decode("#607d8b"); 270 | public static final Color BLUEGREY_600 = Color.decode("#546e7a"); 271 | public static final Color BLUEGREY_700 = Color.decode("#455a64"); 272 | public static final Color BLUEGREY_800 = Color.decode("#37474f"); 273 | public static final Color BLUEGREY_900 = Color.decode("#263238"); 274 | 275 | public static final Color GREY_50 = Color.decode("#fafafa"); 276 | public static final Color GREY_100 = Color.decode("#f5f5f5"); 277 | public static final Color GREY_200 = Color.decode("#eeeeee"); 278 | public static final Color GREY_300 = Color.decode("#e0e0e0"); 279 | public static final Color GREY_400 = Color.decode("#bdbdbd"); 280 | public static final Color GREY_500 = Color.decode("#9e9e9e"); 281 | public static final Color GREY_600 = Color.decode("#757575"); 282 | public static final Color GREY_700 = Color.decode("#616161"); 283 | public static final Color GREY_800 = Color.decode("#424242"); 284 | public static final Color GREY_850 = Color.decode("#313131"); 285 | public static final Color GREY_900 = Color.decode("#212121"); 286 | 287 | public static final Color BLACK = Color.BLACK; 288 | public static final Color WHITE = Color.WHITE; 289 | 290 | public static final Color TRANSPARENT = new Color(0, 0, 0, 0); 291 | public static final Color FULLBLACK = Color.BLACK; 292 | public static final Color DARK_BLACK = new Color(0, 0, 0, 0.87f); 293 | public static final Color LIGHT_BLACK = new Color(0, 0, 0, 0.54f); 294 | public static final Color MIN_BLACK = new Color(0, 0, 0, 0.26f); 295 | public static final Color FAINT_BLACK = new Color(0, 0, 0, 0.12f); 296 | public static final Color FULLWHITE = Color.WHITE; 297 | public static final Color DARK_WHITE = new Color(1, 1, 1, 0.87f); 298 | public static final Color LIGHT_WHITE = new Color(1, 1, 1, 0.54f); 299 | } 300 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/resource/MaterialIcons.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign.resource; 2 | 3 | import java.awt.Font; 4 | import java.awt.FontFormatException; 5 | import java.io.IOException; 6 | import java.io.InputStream; 7 | 8 | /** 9 | * Helper class for getting access to the Material Icon set as a TrueType font. 10 | * Both the Font and the known chars for each icon are available from here. 11 | * 12 | * @author DragShot 13 | * 14 | * @author bilux (i.bilux@gmail.com) 15 | */ 16 | public class MaterialIcons { 17 | 18 | public static final char A_3D_ROTATION = '\uE84D'; 19 | public static final char AC_UNIT = '\uEB3B'; 20 | public static final char ACCESS_ALARM = '\uE190'; 21 | public static final char ACCESS_ALARMS = '\uE191'; 22 | public static final char ACCESS_TIME = '\uE192'; 23 | public static final char ACCESSIBILITY = '\uE84E'; 24 | public static final char ACCESSIBLE = '\uE914'; 25 | public static final char ACCOUNT_BALANCE = '\uE84F'; 26 | public static final char ACCOUNT_BALANCE_WALLET = '\uE850'; 27 | public static final char ACCOUNT_BOX = '\uE851'; 28 | public static final char ACCOUNT_CIRCLE = '\uE853'; 29 | public static final char ADB = '\uE60E'; 30 | public static final char ADD = '\uE145'; 31 | public static final char ADD_A_PHOTO = '\uE439'; 32 | public static final char ADD_ALARM = '\uE193'; 33 | public static final char ADD_ALERT = '\uE003'; 34 | public static final char ADD_BOX = '\uE146'; 35 | public static final char ADD_CIRCLE = '\uE147'; 36 | public static final char ADD_CIRCLE_OUTLINE = '\uE148'; 37 | public static final char ADD_LOCATION = '\uE567'; 38 | public static final char ADD_SHOPPING_CART = '\uE854'; 39 | public static final char ADD_TO_PHOTOS = '\uE39D'; 40 | public static final char ADD_TO_QUEUE = '\uE05C'; 41 | public static final char ADJUST = '\uE39E'; 42 | public static final char AIRLINE_SEAT_FLAT = '\uE630'; 43 | public static final char AIRLINE_SEAT_FLAT_ANGLED = '\uE631'; 44 | public static final char AIRLINE_SEAT_INDIVIDUAL_SUITE = '\uE632'; 45 | public static final char AIRLINE_SEAT_LEGROOM_EXTRA = '\uE633'; 46 | public static final char AIRLINE_SEAT_LEGROOM_NORMAL = '\uE634'; 47 | public static final char AIRLINE_SEAT_LEGROOM_REDUCED = '\uE635'; 48 | public static final char AIRLINE_SEAT_RECLINE_EXTRA = '\uE636'; 49 | public static final char AIRLINE_SEAT_RECLINE_NORMAL = '\uE637'; 50 | public static final char AIRPLANEMODE_ACTIVE = '\uE195'; 51 | public static final char AIRPLANEMODE_INACTIVE = '\uE194'; 52 | public static final char AIRPLAY = '\uE055'; 53 | public static final char AIRPORT_SHUTTLE = '\uEB3C'; 54 | public static final char ALARM = '\uE855'; 55 | public static final char ALARM_ADD = '\uE856'; 56 | public static final char ALARM_OFF = '\uE857'; 57 | public static final char ALARM_ON = '\uE858'; 58 | public static final char ALBUM = '\uE019'; 59 | public static final char ALL_INCLUSIVE = '\uEB3D'; 60 | public static final char ALL_OUT = '\uE90B'; 61 | public static final char ANDROID = '\uE859'; 62 | public static final char ANNOUNCEMENT = '\uE85A'; 63 | public static final char APPS = '\uE5C3'; 64 | public static final char ARCHIVE = '\uE149'; 65 | public static final char ARROW_BACK = '\uE5C4'; 66 | public static final char ARROW_DOWNWARD = '\uE5DB'; 67 | public static final char ARROW_DROP_DOWN = '\uE5C5'; 68 | public static final char ARROW_DROP_DOWN_CIRCLE = '\uE5C6'; 69 | public static final char ARROW_DROP_UP = '\uE5C7'; 70 | public static final char ARROW_FORWARD = '\uE5C8'; 71 | public static final char ARROW_UPWARD = '\uE5D8'; 72 | public static final char ART_TRACK = '\uE060'; 73 | public static final char ASPECT_RATIO = '\uE85B'; 74 | public static final char ASSESSMENT = '\uE85C'; 75 | public static final char ASSIGNMENT = '\uE85D'; 76 | public static final char ASSIGNMENT_IND = '\uE85E'; 77 | public static final char ASSIGNMENT_LATE = '\uE85F'; 78 | public static final char ASSIGNMENT_RETURN = '\uE860'; 79 | public static final char ASSIGNMENT_RETURNED = '\uE861'; 80 | public static final char ASSIGNMENT_TURNED_IN = '\uE862'; 81 | public static final char ASSISTANT = '\uE39F'; 82 | public static final char ASSISTANT_PHOTO = '\uE3A0'; 83 | public static final char ATTACH_FILE = '\uE226'; 84 | public static final char ATTACH_MONEY = '\uE227'; 85 | public static final char ATTACHMENT = '\uE2BC'; 86 | public static final char AUDIOTRACK = '\uE3A1'; 87 | public static final char AUTORENEW = '\uE863'; 88 | public static final char AV_TIMER = '\uE01B'; 89 | public static final char BACKSPACE = '\uE14A'; 90 | public static final char BACKUP = '\uE864'; 91 | public static final char BATTERY_ALERT = '\uE19C'; 92 | public static final char BATTERY_CHARGING_FULL = '\uE1A3'; 93 | public static final char BATTERY_FULL = '\uE1A4'; 94 | public static final char BATTERY_STD = '\uE1A5'; 95 | public static final char BATTERY_UNKNOWN = '\uE1A6'; 96 | public static final char BEACH_ACCESS = '\uEB3E'; 97 | public static final char BEENHERE = '\uE52D'; 98 | public static final char BLOCK = '\uE14B'; 99 | public static final char BLUETOOTH = '\uE1A7'; 100 | public static final char BLUETOOTH_AUDIO = '\uE60F'; 101 | public static final char BLUETOOTH_CONNECTED = '\uE1A8'; 102 | public static final char BLUETOOTH_DISABLED = '\uE1A9'; 103 | public static final char BLUETOOTH_SEARCHING = '\uE1AA'; 104 | public static final char BLUR_CIRCULAR = '\uE3A2'; 105 | public static final char BLUR_LINEAR = '\uE3A3'; 106 | public static final char BLUR_OFF = '\uE3A4'; 107 | public static final char BLUR_ON = '\uE3A5'; 108 | public static final char BOOK = '\uE865'; 109 | public static final char BOOKMARK = '\uE866'; 110 | public static final char BOOKMARK_BORDER = '\uE867'; 111 | public static final char BORDER_ALL = '\uE228'; 112 | public static final char BORDER_BOTTOM = '\uE229'; 113 | public static final char BORDER_CLEAR = '\uE22A'; 114 | public static final char BORDER_COLOR = '\uE22B'; 115 | public static final char BORDER_HORIZONTAL = '\uE22C'; 116 | public static final char BORDER_INNER = '\uE22D'; 117 | public static final char BORDER_LEFT = '\uE22E'; 118 | public static final char BORDER_OUTER = '\uE22F'; 119 | public static final char BORDER_RIGHT = '\uE230'; 120 | public static final char BORDER_STYLE = '\uE231'; 121 | public static final char BORDER_TOP = '\uE232'; 122 | public static final char BORDER_VERTICAL = '\uE233'; 123 | public static final char BRANDING_WATERMARK = '\uE06B'; 124 | public static final char BRIGHTNESS_1 = '\uE3A6'; 125 | public static final char BRIGHTNESS_2 = '\uE3A7'; 126 | public static final char BRIGHTNESS_3 = '\uE3A8'; 127 | public static final char BRIGHTNESS_4 = '\uE3A9'; 128 | public static final char BRIGHTNESS_5 = '\uE3AA'; 129 | public static final char BRIGHTNESS_6 = '\uE3AB'; 130 | public static final char BRIGHTNESS_7 = '\uE3AC'; 131 | public static final char BRIGHTNESS_AUTO = '\uE1AB'; 132 | public static final char BRIGHTNESS_HIGH = '\uE1AC'; 133 | public static final char BRIGHTNESS_LOW = '\uE1AD'; 134 | public static final char BRIGHTNESS_MEDIUM = '\uE1AE'; 135 | public static final char BROKEN_IMAGE = '\uE3AD'; 136 | public static final char BRUSH = '\uE3AE'; 137 | public static final char BUBBLE_CHART = '\uE6DD'; 138 | public static final char BUG_REPORT = '\uE868'; 139 | public static final char BUILD = '\uE869'; 140 | public static final char BURST_MODE = '\uE43C'; 141 | public static final char BUSINESS = '\uE0AF'; 142 | public static final char BUSINESS_CENTER = '\uEB3F'; 143 | public static final char CACHED = '\uE86A'; 144 | public static final char CAKE = '\uE7E9'; 145 | public static final char CALL = '\uE0B0'; 146 | public static final char CALL_END = '\uE0B1'; 147 | public static final char CALL_MADE = '\uE0B2'; 148 | public static final char CALL_MERGE = '\uE0B3'; 149 | public static final char CALL_MISSED = '\uE0B4'; 150 | public static final char CALL_MISSED_OUTGOING = '\uE0E4'; 151 | public static final char CALL_RECEIVED = '\uE0B5'; 152 | public static final char CALL_SPLIT = '\uE0B6'; 153 | public static final char CALL_TO_ACTION = '\uE06C'; 154 | public static final char CAMERA = '\uE3AF'; 155 | public static final char CAMERA_ALT = '\uE3B0'; 156 | public static final char CAMERA_ENHANCE = '\uE8FC'; 157 | public static final char CAMERA_FRONT = '\uE3B1'; 158 | public static final char CAMERA_REAR = '\uE3B2'; 159 | public static final char CAMERA_ROLL = '\uE3B3'; 160 | public static final char CANCEL = '\uE5C9'; 161 | public static final char CARD_GIFTCARD = '\uE8F6'; 162 | public static final char CARD_MEMBERSHIP = '\uE8F7'; 163 | public static final char CARD_TRAVEL = '\uE8F8'; 164 | public static final char CASINO = '\uEB40'; 165 | public static final char CAST = '\uE307'; 166 | public static final char CAST_CONNECTED = '\uE308'; 167 | public static final char CENTER_FOCUS_STRONG = '\uE3B4'; 168 | public static final char CENTER_FOCUS_WEAK = '\uE3B5'; 169 | public static final char CHANGE_HISTORY = '\uE86B'; 170 | public static final char CHAT = '\uE0B7'; 171 | public static final char CHAT_BUBBLE = '\uE0CA'; 172 | public static final char CHAT_BUBBLE_OUTLINE = '\uE0CB'; 173 | public static final char CHECK = '\uE5CA'; 174 | public static final char CHECK_BOX = '\uE834'; 175 | public static final char CHECK_BOX_OUTLINE_BLANK = '\uE835'; 176 | public static final char CHECK_CIRCLE = '\uE86C'; 177 | public static final char CHEVRON_LEFT = '\uE5CB'; 178 | public static final char CHEVRON_RIGHT = '\uE5CC'; 179 | public static final char CHILD_CARE = '\uEB41'; 180 | public static final char CHILD_FRIENDLY = '\uEB42'; 181 | public static final char CHROME_READER_MODE = '\uE86D'; 182 | public static final char CLASS = '\uE86E'; 183 | public static final char CLEAR = '\uE14C'; 184 | public static final char CLEAR_ALL = '\uE0B8'; 185 | public static final char CLOSE = '\uE5CD'; 186 | public static final char CLOSED_CAPTION = '\uE01C'; 187 | public static final char CLOUD = '\uE2BD'; 188 | public static final char CLOUD_CIRCLE = '\uE2BE'; 189 | public static final char CLOUD_DONE = '\uE2BF'; 190 | public static final char CLOUD_DOWNLOAD = '\uE2C0'; 191 | public static final char CLOUD_OFF = '\uE2C1'; 192 | public static final char CLOUD_QUEUE = '\uE2C2'; 193 | public static final char CLOUD_UPLOAD = '\uE2C3'; 194 | public static final char CODE = '\uE86F'; 195 | public static final char COLLECTIONS = '\uE3B6'; 196 | public static final char COLLECTIONS_BOOKMARK = '\uE431'; 197 | public static final char COLOR_LENS = '\uE3B7'; 198 | public static final char COLORIZE = '\uE3B8'; 199 | public static final char COMMENT = '\uE0B9'; 200 | public static final char COMPARE = '\uE3B9'; 201 | public static final char COMPARE_ARROWS = '\uE915'; 202 | public static final char COMPUTER = '\uE30A'; 203 | public static final char CONFIRMATION_NUMBER = '\uE638'; 204 | public static final char CONTACT_MAIL = '\uE0D0'; 205 | public static final char CONTACT_PHONE = '\uE0CF'; 206 | public static final char CONTACTS = '\uE0BA'; 207 | public static final char CONTENT_COPY = '\uE14D'; 208 | public static final char CONTENT_CUT = '\uE14E'; 209 | public static final char CONTENT_PASTE = '\uE14F'; 210 | public static final char CONTROL_POINT = '\uE3BA'; 211 | public static final char CONTROL_POINT_DUPLICATE = '\uE3BB'; 212 | public static final char COPYRIGHT = '\uE90C'; 213 | public static final char CREATE = '\uE150'; 214 | public static final char CREATE_NEW_FOLDER = '\uE2CC'; 215 | public static final char CREDIT_CARD = '\uE870'; 216 | public static final char CROP = '\uE3BE'; 217 | public static final char CROP_16_9 = '\uE3BC'; 218 | public static final char CROP_3_2 = '\uE3BD'; 219 | public static final char CROP_5_4 = '\uE3BF'; 220 | public static final char CROP_7_5 = '\uE3C0'; 221 | public static final char CROP_DIN = '\uE3C1'; 222 | public static final char CROP_FREE = '\uE3C2'; 223 | public static final char CROP_LANDSCAPE = '\uE3C3'; 224 | public static final char CROP_ORIGINAL = '\uE3C4'; 225 | public static final char CROP_PORTRAIT = '\uE3C5'; 226 | public static final char CROP_ROTATE = '\uE437'; 227 | public static final char CROP_SQUARE = '\uE3C6'; 228 | public static final char DASHBOARD = '\uE871'; 229 | public static final char DATA_USAGE = '\uE1AF'; 230 | public static final char DATE_RANGE = '\uE916'; 231 | public static final char DEHAZE = '\uE3C7'; 232 | public static final char DELETE = '\uE872'; 233 | public static final char DELETE_FOREVER = '\uE92B'; 234 | public static final char DELETE_SWEEP = '\uE16C'; 235 | public static final char DESCRIPTION = '\uE873'; 236 | public static final char DESKTOP_MAC = '\uE30B'; 237 | public static final char DESKTOP_WINDOWS = '\uE30C'; 238 | public static final char DETAILS = '\uE3C8'; 239 | public static final char DEVELOPER_BOARD = '\uE30D'; 240 | public static final char DEVELOPER_MODE = '\uE1B0'; 241 | public static final char DEVICE_HUB = '\uE335'; 242 | public static final char DEVICES = '\uE1B1'; 243 | public static final char DEVICES_OTHER = '\uE337'; 244 | public static final char DIALER_SIP = '\uE0BB'; 245 | public static final char DIALPAD = '\uE0BC'; 246 | public static final char DIRECTIONS = '\uE52E'; 247 | public static final char DIRECTIONS_BIKE = '\uE52F'; 248 | public static final char DIRECTIONS_BOAT = '\uE532'; 249 | public static final char DIRECTIONS_BUS = '\uE530'; 250 | public static final char DIRECTIONS_CAR = '\uE531'; 251 | public static final char DIRECTIONS_RAILWAY = '\uE534'; 252 | public static final char DIRECTIONS_RUN = '\uE566'; 253 | public static final char DIRECTIONS_SUBWAY = '\uE533'; 254 | public static final char DIRECTIONS_TRANSIT = '\uE535'; 255 | public static final char DIRECTIONS_WALK = '\uE536'; 256 | public static final char DISC_FULL = '\uE610'; 257 | public static final char DNS = '\uE875'; 258 | public static final char DO_NOT_DISTURB = '\uE612'; 259 | public static final char DO_NOT_DISTURB_ALT = '\uE611'; 260 | public static final char DO_NOT_DISTURB_OFF = '\uE643'; 261 | public static final char DO_NOT_DISTURB_ON = '\uE644'; 262 | public static final char DOCK = '\uE30E'; 263 | public static final char DOMAIN = '\uE7EE'; 264 | public static final char DONE = '\uE876'; 265 | public static final char DONE_ALL = '\uE877'; 266 | public static final char DONUT_LARGE = '\uE917'; 267 | public static final char DONUT_SMALL = '\uE918'; 268 | public static final char DRAFTS = '\uE151'; 269 | public static final char DRAG_HANDLE = '\uE25D'; 270 | public static final char DRIVE_ETA = '\uE613'; 271 | public static final char DVR = '\uE1B2'; 272 | public static final char EDIT = '\uE3C9'; 273 | public static final char EDIT_LOCATION = '\uE568'; 274 | public static final char EJECT = '\uE8FB'; 275 | public static final char EMAIL = '\uE0BE'; 276 | public static final char ENHANCED_ENCRYPTION = '\uE63F'; 277 | public static final char EQUALIZER = '\uE01D'; 278 | public static final char ERROR = '\uE000'; 279 | public static final char ERROR_OUTLINE = '\uE001'; 280 | public static final char EURO_SYMBOL = '\uE926'; 281 | public static final char EV_STATION = '\uE56D'; 282 | public static final char EVENT = '\uE878'; 283 | public static final char EVENT_AVAILABLE = '\uE614'; 284 | public static final char EVENT_BUSY = '\uE615'; 285 | public static final char EVENT_NOTE = '\uE616'; 286 | public static final char EVENT_SEAT = '\uE903'; 287 | public static final char EXIT_TO_APP = '\uE879'; 288 | public static final char EXPAND_LESS = '\uE5CE'; 289 | public static final char EXPAND_MORE = '\uE5CF'; 290 | public static final char EXPLICIT = '\uE01E'; 291 | public static final char EXPLORE = '\uE87A'; 292 | public static final char EXPOSURE = '\uE3CA'; 293 | public static final char EXPOSURE_NEG_1 = '\uE3CB'; 294 | public static final char EXPOSURE_NEG_2 = '\uE3CC'; 295 | public static final char EXPOSURE_PLUS_1 = '\uE3CD'; 296 | public static final char EXPOSURE_PLUS_2 = '\uE3CE'; 297 | public static final char EXPOSURE_ZERO = '\uE3CF'; 298 | public static final char EXTENSION = '\uE87B'; 299 | public static final char FACE = '\uE87C'; 300 | public static final char FAST_FORWARD = '\uE01F'; 301 | public static final char FAST_REWIND = '\uE020'; 302 | public static final char FAVORITE = '\uE87D'; 303 | public static final char FAVORITE_BORDER = '\uE87E'; 304 | public static final char FEATURED_PLAY_LIST = '\uE06D'; 305 | public static final char FEATURED_VIDEO = '\uE06E'; 306 | public static final char FEEDBACK = '\uE87F'; 307 | public static final char FIBER_DVR = '\uE05D'; 308 | public static final char FIBER_MANUAL_RECORD = '\uE061'; 309 | public static final char FIBER_NEW = '\uE05E'; 310 | public static final char FIBER_PIN = '\uE06A'; 311 | public static final char FIBER_SMART_RECORD = '\uE062'; 312 | public static final char FILE_DOWNLOAD = '\uE2C4'; 313 | public static final char FILE_UPLOAD = '\uE2C6'; 314 | public static final char FILTER = '\uE3D3'; 315 | public static final char FILTER_1 = '\uE3D0'; 316 | public static final char FILTER_2 = '\uE3D1'; 317 | public static final char FILTER_3 = '\uE3D2'; 318 | public static final char FILTER_4 = '\uE3D4'; 319 | public static final char FILTER_5 = '\uE3D5'; 320 | public static final char FILTER_6 = '\uE3D6'; 321 | public static final char FILTER_7 = '\uE3D7'; 322 | public static final char FILTER_8 = '\uE3D8'; 323 | public static final char FILTER_9 = '\uE3D9'; 324 | public static final char FILTER_9_PLUS = '\uE3DA'; 325 | public static final char FILTER_B_AND_W = '\uE3DB'; 326 | public static final char FILTER_CENTER_FOCUS = '\uE3DC'; 327 | public static final char FILTER_DRAMA = '\uE3DD'; 328 | public static final char FILTER_FRAMES = '\uE3DE'; 329 | public static final char FILTER_HDR = '\uE3DF'; 330 | public static final char FILTER_LIST = '\uE152'; 331 | public static final char FILTER_NONE = '\uE3E0'; 332 | public static final char FILTER_TILT_SHIFT = '\uE3E2'; 333 | public static final char FILTER_VINTAGE = '\uE3E3'; 334 | public static final char FIND_IN_PAGE = '\uE880'; 335 | public static final char FIND_REPLACE = '\uE881'; 336 | public static final char FINGERPRINT = '\uE90D'; 337 | public static final char FIRST_PAGE = '\uE5DC'; 338 | public static final char FITNESS_CENTER = '\uEB43'; 339 | public static final char FLAG = '\uE153'; 340 | public static final char FLARE = '\uE3E4'; 341 | public static final char FLASH_AUTO = '\uE3E5'; 342 | public static final char FLASH_OFF = '\uE3E6'; 343 | public static final char FLASH_ON = '\uE3E7'; 344 | public static final char FLIGHT = '\uE539'; 345 | public static final char FLIGHT_LAND = '\uE904'; 346 | public static final char FLIGHT_TAKEOFF = '\uE905'; 347 | public static final char FLIP = '\uE3E8'; 348 | public static final char FLIP_TO_BACK = '\uE882'; 349 | public static final char FLIP_TO_FRONT = '\uE883'; 350 | public static final char FOLDER = '\uE2C7'; 351 | public static final char FOLDER_OPEN = '\uE2C8'; 352 | public static final char FOLDER_SHARED = '\uE2C9'; 353 | public static final char FOLDER_SPECIAL = '\uE617'; 354 | public static final char FONT_DOWNLOAD = '\uE167'; 355 | public static final char FORMAT_ALIGN_CENTER = '\uE234'; 356 | public static final char FORMAT_ALIGN_JUSTIFY = '\uE235'; 357 | public static final char FORMAT_ALIGN_LEFT = '\uE236'; 358 | public static final char FORMAT_ALIGN_RIGHT = '\uE237'; 359 | public static final char FORMAT_BOLD = '\uE238'; 360 | public static final char FORMAT_CLEAR = '\uE239'; 361 | public static final char FORMAT_COLOR_FILL = '\uE23A'; 362 | public static final char FORMAT_COLOR_RESET = '\uE23B'; 363 | public static final char FORMAT_COLOR_TEXT = '\uE23C'; 364 | public static final char FORMAT_INDENT_DECREASE = '\uE23D'; 365 | public static final char FORMAT_INDENT_INCREASE = '\uE23E'; 366 | public static final char FORMAT_ITALIC = '\uE23F'; 367 | public static final char FORMAT_LINE_SPACING = '\uE240'; 368 | public static final char FORMAT_LIST_BULLETED = '\uE241'; 369 | public static final char FORMAT_LIST_NUMBERED = '\uE242'; 370 | public static final char FORMAT_PAINT = '\uE243'; 371 | public static final char FORMAT_QUOTE = '\uE244'; 372 | public static final char FORMAT_SHAPES = '\uE25E'; 373 | public static final char FORMAT_SIZE = '\uE245'; 374 | public static final char FORMAT_STRIKETHROUGH = '\uE246'; 375 | public static final char FORMAT_TEXTDIRECTION_L_TO_R = '\uE247'; 376 | public static final char FORMAT_TEXTDIRECTION_R_TO_L = '\uE248'; 377 | public static final char FORMAT_UNDERLINED = '\uE249'; 378 | public static final char FORUM = '\uE0BF'; 379 | public static final char FORWARD = '\uE154'; 380 | public static final char FORWARD_10 = '\uE056'; 381 | public static final char FORWARD_30 = '\uE057'; 382 | public static final char FORWARD_5 = '\uE058'; 383 | public static final char FREE_BREAKFAST = '\uEB44'; 384 | public static final char FULLSCREEN = '\uE5D0'; 385 | public static final char FULLSCREEN_EXIT = '\uE5D1'; 386 | public static final char FUNCTIONS = '\uE24A'; 387 | public static final char G_TRANSLATE = '\uE927'; 388 | public static final char GAMEPAD = '\uE30F'; 389 | public static final char GAMES = '\uE021'; 390 | public static final char GAVEL = '\uE90E'; 391 | public static final char GESTURE = '\uE155'; 392 | public static final char GET_APP = '\uE884'; 393 | public static final char GIF = '\uE908'; 394 | public static final char GOLF_COURSE = '\uEB45'; 395 | public static final char GPS_FIXED = '\uE1B3'; 396 | public static final char GPS_NOT_FIXED = '\uE1B4'; 397 | public static final char GPS_OFF = '\uE1B5'; 398 | public static final char GRADE = '\uE885'; 399 | public static final char GRADIENT = '\uE3E9'; 400 | public static final char GRAIN = '\uE3EA'; 401 | public static final char GRAPHIC_EQ = '\uE1B8'; 402 | public static final char GRID_OFF = '\uE3EB'; 403 | public static final char GRID_ON = '\uE3EC'; 404 | public static final char GROUP = '\uE7EF'; 405 | public static final char GROUP_ADD = '\uE7F0'; 406 | public static final char GROUP_WORK = '\uE886'; 407 | public static final char HD = '\uE052'; 408 | public static final char HDR_OFF = '\uE3ED'; 409 | public static final char HDR_ON = '\uE3EE'; 410 | public static final char HDR_STRONG = '\uE3F1'; 411 | public static final char HDR_WEAK = '\uE3F2'; 412 | public static final char HEADSET = '\uE310'; 413 | public static final char HEADSET_MIC = '\uE311'; 414 | public static final char HEALING = '\uE3F3'; 415 | public static final char HEARING = '\uE023'; 416 | public static final char HELP = '\uE887'; 417 | public static final char HELP_OUTLINE = '\uE8FD'; 418 | public static final char HIGH_QUALITY = '\uE024'; 419 | public static final char HIGHLIGHT = '\uE25F'; 420 | public static final char HIGHLIGHT_OFF = '\uE888'; 421 | public static final char HISTORY = '\uE889'; 422 | public static final char HOME = '\uE88A'; 423 | public static final char HOT_TUB = '\uEB46'; 424 | public static final char HOTEL = '\uE53A'; 425 | public static final char HOURGLASS_EMPTY = '\uE88B'; 426 | public static final char HOURGLASS_FULL = '\uE88C'; 427 | public static final char HTTP = '\uE902'; 428 | public static final char HTTPS = '\uE88D'; 429 | public static final char IMAGE = '\uE3F4'; 430 | public static final char IMAGE_ASPECT_RATIO = '\uE3F5'; 431 | public static final char IMPORT_CONTACTS = '\uE0E0'; 432 | public static final char IMPORT_EXPORT = '\uE0C3'; 433 | public static final char IMPORTANT_DEVICES = '\uE912'; 434 | public static final char INBOX = '\uE156'; 435 | public static final char INDETERMINATE_CHECK_BOX = '\uE909'; 436 | public static final char INFO = '\uE88E'; 437 | public static final char INFO_OUTLINE = '\uE88F'; 438 | public static final char INPUT = '\uE890'; 439 | public static final char INSERT_CHART = '\uE24B'; 440 | public static final char INSERT_COMMENT = '\uE24C'; 441 | public static final char INSERT_DRIVE_FILE = '\uE24D'; 442 | public static final char INSERT_EMOTICON = '\uE24E'; 443 | public static final char INSERT_INVITATION = '\uE24F'; 444 | public static final char INSERT_LINK = '\uE250'; 445 | public static final char INSERT_PHOTO = '\uE251'; 446 | public static final char INVERT_COLORS = '\uE891'; 447 | public static final char INVERT_COLORS_OFF = '\uE0C4'; 448 | public static final char ISO = '\uE3F6'; 449 | public static final char KEYBOARD = '\uE312'; 450 | public static final char KEYBOARD_ARROW_DOWN = '\uE313'; 451 | public static final char KEYBOARD_ARROW_LEFT = '\uE314'; 452 | public static final char KEYBOARD_ARROW_RIGHT = '\uE315'; 453 | public static final char KEYBOARD_ARROW_UP = '\uE316'; 454 | public static final char KEYBOARD_BACKSPACE = '\uE317'; 455 | public static final char KEYBOARD_CAPSLOCK = '\uE318'; 456 | public static final char KEYBOARD_HIDE = '\uE31A'; 457 | public static final char KEYBOARD_RETURN = '\uE31B'; 458 | public static final char KEYBOARD_TAB = '\uE31C'; 459 | public static final char KEYBOARD_VOICE = '\uE31D'; 460 | public static final char KITCHEN = '\uEB47'; 461 | public static final char LABEL = '\uE892'; 462 | public static final char LABEL_OUTLINE = '\uE893'; 463 | public static final char LANDSCAPE = '\uE3F7'; 464 | public static final char LANGUAGE = '\uE894'; 465 | public static final char LAPTOP = '\uE31E'; 466 | public static final char LAPTOP_CHROMEBOOK = '\uE31F'; 467 | public static final char LAPTOP_MAC = '\uE320'; 468 | public static final char LAPTOP_WINDOWS = '\uE321'; 469 | public static final char LAST_PAGE = '\uE5DD'; 470 | public static final char LAUNCH = '\uE895'; 471 | public static final char LAYERS = '\uE53B'; 472 | public static final char LAYERS_CLEAR = '\uE53C'; 473 | public static final char LEAK_ADD = '\uE3F8'; 474 | public static final char LEAK_REMOVE = '\uE3F9'; 475 | public static final char LENS = '\uE3FA'; 476 | public static final char LIBRARY_ADD = '\uE02E'; 477 | public static final char LIBRARY_BOOKS = '\uE02F'; 478 | public static final char LIBRARY_MUSIC = '\uE030'; 479 | public static final char LIGHTBULB_OUTLINE = '\uE90F'; 480 | public static final char LINE_STYLE = '\uE919'; 481 | public static final char LINE_WEIGHT = '\uE91A'; 482 | public static final char LINEAR_SCALE = '\uE260'; 483 | public static final char LINK = '\uE157'; 484 | public static final char LINKED_CAMERA = '\uE438'; 485 | public static final char LIST = '\uE896'; 486 | public static final char LIVE_HELP = '\uE0C6'; 487 | public static final char LIVE_TV = '\uE639'; 488 | public static final char LOCAL_ACTIVITY = '\uE53F'; 489 | public static final char LOCAL_AIRPORT = '\uE53D'; 490 | public static final char LOCAL_ATM = '\uE53E'; 491 | public static final char LOCAL_BAR = '\uE540'; 492 | public static final char LOCAL_CAFE = '\uE541'; 493 | public static final char LOCAL_CAR_WASH = '\uE542'; 494 | public static final char LOCAL_CONVENIENCE_STORE = '\uE543'; 495 | public static final char LOCAL_DINING = '\uE556'; 496 | public static final char LOCAL_DRINK = '\uE544'; 497 | public static final char LOCAL_FLORIST = '\uE545'; 498 | public static final char LOCAL_GAS_STATION = '\uE546'; 499 | public static final char LOCAL_GROCERY_STORE = '\uE547'; 500 | public static final char LOCAL_HOSPITAL = '\uE548'; 501 | public static final char LOCAL_HOTEL = '\uE549'; 502 | public static final char LOCAL_LAUNDRY_SERVICE = '\uE54A'; 503 | public static final char LOCAL_LIBRARY = '\uE54B'; 504 | public static final char LOCAL_MALL = '\uE54C'; 505 | public static final char LOCAL_MOVIES = '\uE54D'; 506 | public static final char LOCAL_OFFER = '\uE54E'; 507 | public static final char LOCAL_PARKING = '\uE54F'; 508 | public static final char LOCAL_PHARMACY = '\uE550'; 509 | public static final char LOCAL_PHONE = '\uE551'; 510 | public static final char LOCAL_PIZZA = '\uE552'; 511 | public static final char LOCAL_PLAY = '\uE553'; 512 | public static final char LOCAL_POST_OFFICE = '\uE554'; 513 | public static final char LOCAL_PRINTSHOP = '\uE555'; 514 | public static final char LOCAL_SEE = '\uE557'; 515 | public static final char LOCAL_SHIPPING = '\uE558'; 516 | public static final char LOCAL_TAXI = '\uE559'; 517 | public static final char LOCATION_CITY = '\uE7F1'; 518 | public static final char LOCATION_DISABLED = '\uE1B6'; 519 | public static final char LOCATION_OFF = '\uE0C7'; 520 | public static final char LOCATION_ON = '\uE0C8'; 521 | public static final char LOCATION_SEARCHING = '\uE1B7'; 522 | public static final char LOCK = '\uE897'; 523 | public static final char LOCK_OPEN = '\uE898'; 524 | public static final char LOCK_OUTLINE = '\uE899'; 525 | public static final char LOOKS = '\uE3FC'; 526 | public static final char LOOKS_3 = '\uE3FB'; 527 | public static final char LOOKS_4 = '\uE3FD'; 528 | public static final char LOOKS_5 = '\uE3FE'; 529 | public static final char LOOKS_6 = '\uE3FF'; 530 | public static final char LOOKS_ONE = '\uE400'; 531 | public static final char LOOKS_TWO = '\uE401'; 532 | public static final char LOOP = '\uE028'; 533 | public static final char LOUPE = '\uE402'; 534 | public static final char LOW_PRIORITY = '\uE16D'; 535 | public static final char LOYALTY = '\uE89A'; 536 | public static final char MAIL = '\uE158'; 537 | public static final char MAIL_OUTLINE = '\uE0E1'; 538 | public static final char MAP = '\uE55B'; 539 | public static final char MARKUNREAD = '\uE159'; 540 | public static final char MARKUNREAD_MAILBOX = '\uE89B'; 541 | public static final char MEMORY = '\uE322'; 542 | public static final char MENU = '\uE5D2'; 543 | public static final char MERGE_TYPE = '\uE252'; 544 | public static final char MESSAGE = '\uE0C9'; 545 | public static final char MIC = '\uE029'; 546 | public static final char MIC_NONE = '\uE02A'; 547 | public static final char MIC_OFF = '\uE02B'; 548 | public static final char MMS = '\uE618'; 549 | public static final char MODE_COMMENT = '\uE253'; 550 | public static final char MODE_EDIT = '\uE254'; 551 | public static final char MONETIZATION_ON = '\uE263'; 552 | public static final char MONEY_OFF = '\uE25C'; 553 | public static final char MONOCHROME_PHOTOS = '\uE403'; 554 | public static final char MOOD = '\uE7F2'; 555 | public static final char MOOD_BAD = '\uE7F3'; 556 | public static final char MORE = '\uE619'; 557 | public static final char MORE_HORIZ = '\uE5D3'; 558 | public static final char MORE_VERT = '\uE5D4'; 559 | public static final char MOTORCYCLE = '\uE91B'; 560 | public static final char MOUSE = '\uE323'; 561 | public static final char MOVE_TO_INBOX = '\uE168'; 562 | public static final char MOVIE = '\uE02C'; 563 | public static final char MOVIE_CREATION = '\uE404'; 564 | public static final char MOVIE_FILTER = '\uE43A'; 565 | public static final char MULTILINE_CHART = '\uE6DF'; 566 | public static final char MUSIC_NOTE = '\uE405'; 567 | public static final char MUSIC_VIDEO = '\uE063'; 568 | public static final char MY_LOCATION = '\uE55C'; 569 | public static final char NATURE = '\uE406'; 570 | public static final char NATURE_PEOPLE = '\uE407'; 571 | public static final char NAVIGATE_BEFORE = '\uE408'; 572 | public static final char NAVIGATE_NEXT = '\uE409'; 573 | public static final char NAVIGATION = '\uE55D'; 574 | public static final char NEAR_ME = '\uE569'; 575 | public static final char NETWORK_CELL = '\uE1B9'; 576 | public static final char NETWORK_CHECK = '\uE640'; 577 | public static final char NETWORK_LOCKED = '\uE61A'; 578 | public static final char NETWORK_WIFI = '\uE1BA'; 579 | public static final char NEW_RELEASES = '\uE031'; 580 | public static final char NEXT_WEEK = '\uE16A'; 581 | public static final char NFC = '\uE1BB'; 582 | public static final char NO_ENCRYPTION = '\uE641'; 583 | public static final char NO_SIM = '\uE0CC'; 584 | public static final char NOT_INTERESTED = '\uE033'; 585 | public static final char NOTE = '\uE06F'; 586 | public static final char NOTE_ADD = '\uE89C'; 587 | public static final char NOTIFICATIONS = '\uE7F4'; 588 | public static final char NOTIFICATIONS_ACTIVE = '\uE7F7'; 589 | public static final char NOTIFICATIONS_NONE = '\uE7F5'; 590 | public static final char NOTIFICATIONS_OFF = '\uE7F6'; 591 | public static final char NOTIFICATIONS_PAUSED = '\uE7F8'; 592 | public static final char OFFLINE_PIN = '\uE90A'; 593 | public static final char ONDEMAND_VIDEO = '\uE63A'; 594 | public static final char OPACITY = '\uE91C'; 595 | public static final char OPEN_IN_BROWSER = '\uE89D'; 596 | public static final char OPEN_IN_NEW = '\uE89E'; 597 | public static final char OPEN_WITH = '\uE89F'; 598 | public static final char PAGES = '\uE7F9'; 599 | public static final char PAGEVIEW = '\uE8A0'; 600 | public static final char PALETTE = '\uE40A'; 601 | public static final char PAN_TOOL = '\uE925'; 602 | public static final char PANORAMA = '\uE40B'; 603 | public static final char PANORAMA_FISH_EYE = '\uE40C'; 604 | public static final char PANORAMA_HORIZONTAL = '\uE40D'; 605 | public static final char PANORAMA_VERTICAL = '\uE40E'; 606 | public static final char PANORAMA_WIDE_ANGLE = '\uE40F'; 607 | public static final char PARTY_MODE = '\uE7FA'; 608 | public static final char PAUSE = '\uE034'; 609 | public static final char PAUSE_CIRCLE_FILLED = '\uE035'; 610 | public static final char PAUSE_CIRCLE_OUTLINE = '\uE036'; 611 | public static final char PAYMENT = '\uE8A1'; 612 | public static final char PEOPLE = '\uE7FB'; 613 | public static final char PEOPLE_OUTLINE = '\uE7FC'; 614 | public static final char PERM_CAMERA_MIC = '\uE8A2'; 615 | public static final char PERM_CONTACT_CALENDAR = '\uE8A3'; 616 | public static final char PERM_DATA_SETTING = '\uE8A4'; 617 | public static final char PERM_DEVICE_INFORMATION = '\uE8A5'; 618 | public static final char PERM_IDENTITY = '\uE8A6'; 619 | public static final char PERM_MEDIA = '\uE8A7'; 620 | public static final char PERM_PHONE_MSG = '\uE8A8'; 621 | public static final char PERM_SCAN_WIFI = '\uE8A9'; 622 | public static final char PERSON = '\uE7FD'; 623 | public static final char PERSON_ADD = '\uE7FE'; 624 | public static final char PERSON_OUTLINE = '\uE7FF'; 625 | public static final char PERSON_PIN = '\uE55A'; 626 | public static final char PERSON_PIN_CIRCLE = '\uE56A'; 627 | public static final char PERSONAL_VIDEO = '\uE63B'; 628 | public static final char PETS = '\uE91D'; 629 | public static final char PHONE = '\uE0CD'; 630 | public static final char PHONE_ANDROID = '\uE324'; 631 | public static final char PHONE_BLUETOOTH_SPEAKER = '\uE61B'; 632 | public static final char PHONE_FORWARDED = '\uE61C'; 633 | public static final char PHONE_IN_TALK = '\uE61D'; 634 | public static final char PHONE_IPHONE = '\uE325'; 635 | public static final char PHONE_LOCKED = '\uE61E'; 636 | public static final char PHONE_MISSED = '\uE61F'; 637 | public static final char PHONE_PAUSED = '\uE620'; 638 | public static final char PHONELINK = '\uE326'; 639 | public static final char PHONELINK_ERASE = '\uE0DB'; 640 | public static final char PHONELINK_LOCK = '\uE0DC'; 641 | public static final char PHONELINK_OFF = '\uE327'; 642 | public static final char PHONELINK_RING = '\uE0DD'; 643 | public static final char PHONELINK_SETUP = '\uE0DE'; 644 | public static final char PHOTO = '\uE410'; 645 | public static final char PHOTO_ALBUM = '\uE411'; 646 | public static final char PHOTO_CAMERA = '\uE412'; 647 | public static final char PHOTO_FILTER = '\uE43B'; 648 | public static final char PHOTO_LIBRARY = '\uE413'; 649 | public static final char PHOTO_SIZE_SELECT_ACTUAL = '\uE432'; 650 | public static final char PHOTO_SIZE_SELECT_LARGE = '\uE433'; 651 | public static final char PHOTO_SIZE_SELECT_SMALL = '\uE434'; 652 | public static final char PICTURE_AS_PDF = '\uE415'; 653 | public static final char PICTURE_IN_PICTURE = '\uE8AA'; 654 | public static final char PICTURE_IN_PICTURE_ALT = '\uE911'; 655 | public static final char PIE_CHART = '\uE6C4'; 656 | public static final char PIE_CHART_OUTLINED = '\uE6C5'; 657 | public static final char PIN_DROP = '\uE55E'; 658 | public static final char PLACE = '\uE55F'; 659 | public static final char PLAY_ARROW = '\uE037'; 660 | public static final char PLAY_CIRCLE_FILLED = '\uE038'; 661 | public static final char PLAY_CIRCLE_OUTLINE = '\uE039'; 662 | public static final char PLAY_FOR_WORK = '\uE906'; 663 | public static final char PLAYLIST_ADD = '\uE03B'; 664 | public static final char PLAYLIST_ADD_CHECK = '\uE065'; 665 | public static final char PLAYLIST_PLAY = '\uE05F'; 666 | public static final char PLUS_ONE = '\uE800'; 667 | public static final char POLL = '\uE801'; 668 | public static final char POLYMER = '\uE8AB'; 669 | public static final char POOL = '\uEB48'; 670 | public static final char PORTABLE_WIFI_OFF = '\uE0CE'; 671 | public static final char PORTRAIT = '\uE416'; 672 | public static final char POWER = '\uE63C'; 673 | public static final char POWER_INPUT = '\uE336'; 674 | public static final char POWER_SETTINGS_NEW = '\uE8AC'; 675 | public static final char PREGNANT_WOMAN = '\uE91E'; 676 | public static final char PRESENT_TO_ALL = '\uE0DF'; 677 | public static final char PRINT = '\uE8AD'; 678 | public static final char PRIORITY_HIGH = '\uE645'; 679 | public static final char PUBLIC = '\uE80B'; 680 | public static final char PUBLISH = '\uE255'; 681 | public static final char QUERY_BUILDER = '\uE8AE'; 682 | public static final char QUESTION_ANSWER = '\uE8AF'; 683 | public static final char QUEUE = '\uE03C'; 684 | public static final char QUEUE_MUSIC = '\uE03D'; 685 | public static final char QUEUE_PLAY_NEXT = '\uE066'; 686 | public static final char RADIO = '\uE03E'; 687 | public static final char RADIO_BUTTON_CHECKED = '\uE837'; 688 | public static final char RADIO_BUTTON_UNCHECKED = '\uE836'; 689 | public static final char RATE_REVIEW = '\uE560'; 690 | public static final char RECEIPT = '\uE8B0'; 691 | public static final char RECENT_ACTORS = '\uE03F'; 692 | public static final char RECORD_VOICE_OVER = '\uE91F'; 693 | public static final char REDEEM = '\uE8B1'; 694 | public static final char REDO = '\uE15A'; 695 | public static final char REFRESH = '\uE5D5'; 696 | public static final char REMOVE = '\uE15B'; 697 | public static final char REMOVE_CIRCLE = '\uE15C'; 698 | public static final char REMOVE_CIRCLE_OUTLINE = '\uE15D'; 699 | public static final char REMOVE_FROM_QUEUE = '\uE067'; 700 | public static final char REMOVE_RED_EYE = '\uE417'; 701 | public static final char REMOVE_SHOPPING_CART = '\uE928'; 702 | public static final char REORDER = '\uE8FE'; 703 | public static final char REPEAT = '\uE040'; 704 | public static final char REPEAT_ONE = '\uE041'; 705 | public static final char REPLAY = '\uE042'; 706 | public static final char REPLAY_10 = '\uE059'; 707 | public static final char REPLAY_30 = '\uE05A'; 708 | public static final char REPLAY_5 = '\uE05B'; 709 | public static final char REPLY = '\uE15E'; 710 | public static final char REPLY_ALL = '\uE15F'; 711 | public static final char REPORT = '\uE160'; 712 | public static final char REPORT_PROBLEM = '\uE8B2'; 713 | public static final char RESTAURANT = '\uE56C'; 714 | public static final char RESTAURANT_MENU = '\uE561'; 715 | public static final char RESTORE = '\uE8B3'; 716 | public static final char RESTORE_PAGE = '\uE929'; 717 | public static final char RING_VOLUME = '\uE0D1'; 718 | public static final char ROOM = '\uE8B4'; 719 | public static final char ROOM_SERVICE = '\uEB49'; 720 | public static final char ROTATE_90_DEGREES_CCW = '\uE418'; 721 | public static final char ROTATE_LEFT = '\uE419'; 722 | public static final char ROTATE_RIGHT = '\uE41A'; 723 | public static final char ROUNDED_CORNER = '\uE920'; 724 | public static final char ROUTER = '\uE328'; 725 | public static final char ROWING = '\uE921'; 726 | public static final char RSS_FEED = '\uE0E5'; 727 | public static final char RV_HOOKUP = '\uE642'; 728 | public static final char SATELLITE = '\uE562'; 729 | public static final char SAVE = '\uE161'; 730 | public static final char SCANNER = '\uE329'; 731 | public static final char SCHEDULE = '\uE8B5'; 732 | public static final char SCHOOL = '\uE80C'; 733 | public static final char SCREEN_LOCK_LANDSCAPE = '\uE1BE'; 734 | public static final char SCREEN_LOCK_PORTRAIT = '\uE1BF'; 735 | public static final char SCREEN_LOCK_ROTATION = '\uE1C0'; 736 | public static final char SCREEN_ROTATION = '\uE1C1'; 737 | public static final char SCREEN_SHARE = '\uE0E2'; 738 | public static final char SD_CARD = '\uE623'; 739 | public static final char SD_STORAGE = '\uE1C2'; 740 | public static final char SEARCH = '\uE8B6'; 741 | public static final char SECURITY = '\uE32A'; 742 | public static final char SELECT_ALL = '\uE162'; 743 | public static final char SEND = '\uE163'; 744 | public static final char SENTIMENT_DISSATISFIED = '\uE811'; 745 | public static final char SENTIMENT_NEUTRAL = '\uE812'; 746 | public static final char SENTIMENT_SATISFIED = '\uE813'; 747 | public static final char SENTIMENT_VERY_DISSATISFIED = '\uE814'; 748 | public static final char SENTIMENT_VERY_SATISFIED = '\uE815'; 749 | public static final char SETTINGS = '\uE8B8'; 750 | public static final char SETTINGS_APPLICATIONS = '\uE8B9'; 751 | public static final char SETTINGS_BACKUP_RESTORE = '\uE8BA'; 752 | public static final char SETTINGS_BLUETOOTH = '\uE8BB'; 753 | public static final char SETTINGS_BRIGHTNESS = '\uE8BD'; 754 | public static final char SETTINGS_CELL = '\uE8BC'; 755 | public static final char SETTINGS_ETHERNET = '\uE8BE'; 756 | public static final char SETTINGS_INPUT_ANTENNA = '\uE8BF'; 757 | public static final char SETTINGS_INPUT_COMPONENT = '\uE8C0'; 758 | public static final char SETTINGS_INPUT_COMPOSITE = '\uE8C1'; 759 | public static final char SETTINGS_INPUT_HDMI = '\uE8C2'; 760 | public static final char SETTINGS_INPUT_SVIDEO = '\uE8C3'; 761 | public static final char SETTINGS_OVERSCAN = '\uE8C4'; 762 | public static final char SETTINGS_PHONE = '\uE8C5'; 763 | public static final char SETTINGS_POWER = '\uE8C6'; 764 | public static final char SETTINGS_REMOTE = '\uE8C7'; 765 | public static final char SETTINGS_SYSTEM_DAYDREAM = '\uE1C3'; 766 | public static final char SETTINGS_VOICE = '\uE8C8'; 767 | public static final char SHARE = '\uE80D'; 768 | public static final char SHOP = '\uE8C9'; 769 | public static final char SHOP_TWO = '\uE8CA'; 770 | public static final char SHOPPING_BASKET = '\uE8CB'; 771 | public static final char SHOPPING_CART = '\uE8CC'; 772 | public static final char SHORT_TEXT = '\uE261'; 773 | public static final char SHOW_CHART = '\uE6E1'; 774 | public static final char SHUFFLE = '\uE043'; 775 | public static final char SIGNAL_CELLULAR_4_BAR = '\uE1C8'; 776 | public static final char SIGNAL_CELLULAR_CONNECTED_NOINTERNET_4BAR = '\uE1CD'; 777 | public static final char SIGNAL_CELLULAR_NO_SIM = '\uE1CE'; 778 | public static final char SIGNAL_CELLULAR_NULL = '\uE1CF'; 779 | public static final char SIGNAL_CELLULAR_OFF = '\uE1D0'; 780 | public static final char SIGNAL_WIFI_4_BAR = '\uE1D8'; 781 | public static final char SIGNAL_WIFI_4_BAR_LOCK = '\uE1D9'; 782 | public static final char SIGNAL_WIFI_OFF = '\uE1DA'; 783 | public static final char SIM_CARD = '\uE32B'; 784 | public static final char SIM_CARD_ALERT = '\uE624'; 785 | public static final char SKIP_NEXT = '\uE044'; 786 | public static final char SKIP_PREVIOUS = '\uE045'; 787 | public static final char SLIDESHOW = '\uE41B'; 788 | public static final char SLOW_MOTION_VIDEO = '\uE068'; 789 | public static final char SMARTPHONE = '\uE32C'; 790 | public static final char SMOKE_FREE = '\uEB4A'; 791 | public static final char SMOKING_ROOMS = '\uEB4B'; 792 | public static final char SMS = '\uE625'; 793 | public static final char SMS_FAILED = '\uE626'; 794 | public static final char SNOOZE = '\uE046'; 795 | public static final char SORT = '\uE164'; 796 | public static final char SORT_BY_ALPHA = '\uE053'; 797 | public static final char SPA = '\uEB4C'; 798 | public static final char SPACE_BAR = '\uE256'; 799 | public static final char SPEAKER = '\uE32D'; 800 | public static final char SPEAKER_GROUP = '\uE32E'; 801 | public static final char SPEAKER_NOTES = '\uE8CD'; 802 | public static final char SPEAKER_NOTES_OFF = '\uE92A'; 803 | public static final char SPEAKER_PHONE = '\uE0D2'; 804 | public static final char SPELLCHECK = '\uE8CE'; 805 | public static final char STAR = '\uE838'; 806 | public static final char STAR_BORDER = '\uE83A'; 807 | public static final char STAR_HALF = '\uE839'; 808 | public static final char STARS = '\uE8D0'; 809 | public static final char STAY_CURRENT_LANDSCAPE = '\uE0D3'; 810 | public static final char STAY_CURRENT_PORTRAIT = '\uE0D4'; 811 | public static final char STAY_PRIMARY_LANDSCAPE = '\uE0D5'; 812 | public static final char STAY_PRIMARY_PORTRAIT = '\uE0D6'; 813 | public static final char STOP = '\uE047'; 814 | public static final char STOP_SCREEN_SHARE = '\uE0E3'; 815 | public static final char STORAGE = '\uE1DB'; 816 | public static final char STORE = '\uE8D1'; 817 | public static final char STORE_MALL_DIRECTORY = '\uE563'; 818 | public static final char STRAIGHTEN = '\uE41C'; 819 | public static final char STREETVIEW = '\uE56E'; 820 | public static final char STRIKETHROUGH_S = '\uE257'; 821 | public static final char STYLE = '\uE41D'; 822 | public static final char SUBDIRECTORY_ARROW_LEFT = '\uE5D9'; 823 | public static final char SUBDIRECTORY_ARROW_RIGHT = '\uE5DA'; 824 | public static final char SUBJECT = '\uE8D2'; 825 | public static final char SUBSCRIPTIONS = '\uE064'; 826 | public static final char SUBTITLES = '\uE048'; 827 | public static final char SUBWAY = '\uE56F'; 828 | public static final char SUPERVISOR_ACCOUNT = '\uE8D3'; 829 | public static final char SURROUND_SOUND = '\uE049'; 830 | public static final char SWAP_CALLS = '\uE0D7'; 831 | public static final char SWAP_HORIZ = '\uE8D4'; 832 | public static final char SWAP_VERT = '\uE8D5'; 833 | public static final char SWAP_VERTICAL_CIRCLE = '\uE8D6'; 834 | public static final char SWITCH_CAMERA = '\uE41E'; 835 | public static final char SWITCH_VIDEO = '\uE41F'; 836 | public static final char SYNC = '\uE627'; 837 | public static final char SYNC_DISABLED = '\uE628'; 838 | public static final char SYNC_PROBLEM = '\uE629'; 839 | public static final char SYSTEM_UPDATE = '\uE62A'; 840 | public static final char SYSTEM_UPDATE_ALT = '\uE8D7'; 841 | public static final char TAB = '\uE8D8'; 842 | public static final char TAB_UNSELECTED = '\uE8D9'; 843 | public static final char TABLET = '\uE32F'; 844 | public static final char TABLET_ANDROID = '\uE330'; 845 | public static final char TABLET_MAC = '\uE331'; 846 | public static final char TAG_FACES = '\uE420'; 847 | public static final char TAP_AND_PLAY = '\uE62B'; 848 | public static final char TERRAIN = '\uE564'; 849 | public static final char TEXT_FIELDS = '\uE262'; 850 | public static final char TEXT_FORMAT = '\uE165'; 851 | public static final char TEXTSMS = '\uE0D8'; 852 | public static final char TEXTURE = '\uE421'; 853 | public static final char THEATERS = '\uE8DA'; 854 | public static final char THUMB_DOWN = '\uE8DB'; 855 | public static final char THUMB_UP = '\uE8DC'; 856 | public static final char THUMBS_UP_DOWN = '\uE8DD'; 857 | public static final char TIME_TO_LEAVE = '\uE62C'; 858 | public static final char TIMELAPSE = '\uE422'; 859 | public static final char TIMELINE = '\uE922'; 860 | public static final char TIMER = '\uE425'; 861 | public static final char TIMER_10 = '\uE423'; 862 | public static final char TIMER_3 = '\uE424'; 863 | public static final char TIMER_OFF = '\uE426'; 864 | public static final char TITLE = '\uE264'; 865 | public static final char TOC = '\uE8DE'; 866 | public static final char TODAY = '\uE8DF'; 867 | public static final char TOLL = '\uE8E0'; 868 | public static final char TONALITY = '\uE427'; 869 | public static final char TOUCH_APP = '\uE913'; 870 | public static final char TOYS = '\uE332'; 871 | public static final char TRACK_CHANGES = '\uE8E1'; 872 | public static final char TRAFFIC = '\uE565'; 873 | public static final char TRAIN = '\uE570'; 874 | public static final char TRAM = '\uE571'; 875 | public static final char TRANSFER_WITHIN_A_STATION = '\uE572'; 876 | public static final char TRANSFORM = '\uE428'; 877 | public static final char TRANSLATE = '\uE8E2'; 878 | public static final char TRENDING_DOWN = '\uE8E3'; 879 | public static final char TRENDING_FLAT = '\uE8E4'; 880 | public static final char TRENDING_UP = '\uE8E5'; 881 | public static final char TUNE = '\uE429'; 882 | public static final char TURNED_IN = '\uE8E6'; 883 | public static final char TURNED_IN_NOT = '\uE8E7'; 884 | public static final char TV = '\uE333'; 885 | public static final char UNARCHIVE = '\uE169'; 886 | public static final char UNDO = '\uE166'; 887 | public static final char UNFOLD_LESS = '\uE5D6'; 888 | public static final char UNFOLD_MORE = '\uE5D7'; 889 | public static final char UPDATE = '\uE923'; 890 | public static final char USB = '\uE1E0'; 891 | public static final char VERIFIED_USER = '\uE8E8'; 892 | public static final char VERTICAL_ALIGN_BOTTOM = '\uE258'; 893 | public static final char VERTICAL_ALIGN_CENTER = '\uE259'; 894 | public static final char VERTICAL_ALIGN_TOP = '\uE25A'; 895 | public static final char VIBRATION = '\uE62D'; 896 | public static final char VIDEO_CALL = '\uE070'; 897 | public static final char VIDEO_LABEL = '\uE071'; 898 | public static final char VIDEO_LIBRARY = '\uE04A'; 899 | public static final char VIDEOCAM = '\uE04B'; 900 | public static final char VIDEOCAM_OFF = '\uE04C'; 901 | public static final char VIDEOGAME_ASSET = '\uE338'; 902 | public static final char VIEW_AGENDA = '\uE8E9'; 903 | public static final char VIEW_ARRAY = '\uE8EA'; 904 | public static final char VIEW_CAROUSEL = '\uE8EB'; 905 | public static final char VIEW_COLUMN = '\uE8EC'; 906 | public static final char VIEW_COMFY = '\uE42A'; 907 | public static final char VIEW_COMPACT = '\uE42B'; 908 | public static final char VIEW_DAY = '\uE8ED'; 909 | public static final char VIEW_HEADLINE = '\uE8EE'; 910 | public static final char VIEW_LIST = '\uE8EF'; 911 | public static final char VIEW_MODULE = '\uE8F0'; 912 | public static final char VIEW_QUILT = '\uE8F1'; 913 | public static final char VIEW_STREAM = '\uE8F2'; 914 | public static final char VIEW_WEEK = '\uE8F3'; 915 | public static final char VIGNETTE = '\uE435'; 916 | public static final char VISIBILITY = '\uE8F4'; 917 | public static final char VISIBILITY_OFF = '\uE8F5'; 918 | public static final char VOICE_CHAT = '\uE62E'; 919 | public static final char VOICEMAIL = '\uE0D9'; 920 | public static final char VOLUME_DOWN = '\uE04D'; 921 | public static final char VOLUME_MUTE = '\uE04E'; 922 | public static final char VOLUME_OFF = '\uE04F'; 923 | public static final char VOLUME_UP = '\uE050'; 924 | public static final char VPN_KEY = '\uE0DA'; 925 | public static final char VPN_LOCK = '\uE62F'; 926 | public static final char WALLPAPER = '\uE1BC'; 927 | public static final char WARNING = '\uE002'; 928 | public static final char WATCH = '\uE334'; 929 | public static final char WATCH_LATER = '\uE924'; 930 | public static final char WB_AUTO = '\uE42C'; 931 | public static final char WB_CLOUDY = '\uE42D'; 932 | public static final char WB_INCANDESCENT = '\uE42E'; 933 | public static final char WB_IRIDESCENT = '\uE436'; 934 | public static final char WB_SUNNY = '\uE430'; 935 | public static final char WC = '\uE63D'; 936 | public static final char WEB = '\uE051'; 937 | public static final char WEB_ASSET = '\uE069'; 938 | public static final char WEEKEND = '\uE16B'; 939 | public static final char WHATSHOT = '\uE80E'; 940 | public static final char WIDGETS = '\uE1BD'; 941 | public static final char WIFI = '\uE63E'; 942 | public static final char WIFI_LOCK = '\uE1E1'; 943 | public static final char WIFI_TETHERING = '\uE1E2'; 944 | public static final char WORK = '\uE8F9'; 945 | public static final char WRAP_TEXT = '\uE25B'; 946 | public static final char YOUTUBE_SEARCHED_FOR = '\uE8FA'; 947 | public static final char ZOOM_IN = '\uE8FF'; 948 | public static final char ZOOM_OUT = '\uE900'; 949 | public static final char ZOOM_OUT_MAP = '\uE56B'; 950 | 951 | public static final Font ICON_FONT = loadFont("MaterialIcons-Regular.ttf"); 952 | 953 | private static Font loadFont(String resourceName) { 954 | try (InputStream inputStream = MaterialIcons.class.getResourceAsStream("/resources/fonts/" + resourceName)) { 955 | return Font.createFont(Font.TRUETYPE_FONT, inputStream); 956 | } catch (IOException | FontFormatException e) { 957 | throw new RuntimeException("Could not load " + resourceName, e); 958 | } 959 | } 960 | 961 | } 962 | -------------------------------------------------------------------------------- /src/com/hq/swingmaterialdesign/materialdesign/resource/Roboto.java: -------------------------------------------------------------------------------- 1 | package com.hq.swingmaterialdesign.materialdesign.resource; 2 | 3 | import java.awt.*; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | 7 | /** 8 | * The Roboto font. 9 | * 10 | * 11 | * @author bilux (i.bilux@gmail.com) 12 | */ 13 | public class Roboto { 14 | 15 | public static final Font BLACK = loadFont("Roboto-Black.ttf").deriveFont(Font.BOLD); 16 | public static final Font BLACK_ITALIC = loadFont("Roboto-BlackItalic.ttf").deriveFont(Font.BOLD | Font.ITALIC); 17 | public static final Font BOLD_ITALIC = loadFont("Roboto-BoldItalic.ttf").deriveFont(Font.BOLD | Font.ITALIC); 18 | public static final Font ITALIC = loadFont("Roboto-Italic.ttf").deriveFont(Font.ITALIC); 19 | public static final Font LIGHT_ITALIC = loadFont("Roboto-LightItalic.ttf").deriveFont(Font.ITALIC); 20 | public static final Font MEDIUM = loadFont("Roboto-Medium.ttf").deriveFont(Font.PLAIN); 21 | public static final Font MEDIUM_ITALIC = loadFont("Roboto-MediumItalic.ttf").deriveFont(Font.ITALIC); 22 | public static final Font REGULAR = loadFont("Roboto-Regular.ttf").deriveFont(Font.PLAIN); 23 | public static final Font BOLD = loadFont("Roboto-Bold.ttf").deriveFont(Font.BOLD); 24 | public static final Font THIN = loadFont("Roboto-Thin.ttf").deriveFont(Font.PLAIN); 25 | public static final Font LIGHT = loadFont("Roboto-Light.ttf").deriveFont(Font.PLAIN); 26 | public static final Font THIN_ITALIC = loadFont("Roboto-ThinItalic.ttf").deriveFont(Font.ITALIC); 27 | 28 | private static Font loadFont(String resourceName) { 29 | try (InputStream inputStream = Roboto.class.getResourceAsStream("/resources/fonts/" + resourceName)) { 30 | return Font.createFont(Font.TRUETYPE_FONT, inputStream); 31 | } catch (IOException | FontFormatException e) { 32 | throw new RuntimeException("Could not load " + resourceName, e); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/resources/fonts/MaterialIcons-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/MaterialIcons-Regular.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-Black.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-BlackItalic.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-Bold.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-BoldItalic.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-Italic.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-Light.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-LightItalic.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-MediumItalic.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-Regular.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-Thin.ttf -------------------------------------------------------------------------------- /src/resources/fonts/Roboto-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ibilux/SwingMaterialDesign/7340ff977e1cdf947132416a95360a941e6969f0/src/resources/fonts/Roboto-ThinItalic.ttf --------------------------------------------------------------------------------