Change splash image, add custom coloring to progress bar

master
skylarmt 9 years ago
parent 248087b45e
commit 2cbfa3daa0

@ -42,6 +42,8 @@ import java.util.Date;
import javax.swing.ImageIcon;
import javax.swing.JInternalFrame;
import javax.swing.ListModel;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
/**
* This class is like the Force: A light theme, a dark theme, and it binds the
@ -744,7 +746,7 @@ public class MainGUI extends javax.swing.JFrame {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
UIManager.setLookAndFeel(info.getClassName());
break;
}
}

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Form version="1.9" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
@ -32,6 +32,7 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,84,0,0,1,-112"/>
</AuxValues>
<Layout>
@ -54,7 +55,6 @@
<SubComponents>
<Component class="javax.swing.JProgressBar" name="progBar">
<Properties>
<Property name="indeterminate" type="boolean" value="true"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32767, 20]"/>
</Property>
@ -71,7 +71,7 @@
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/net/apocalypselabs/symat/anim-splash.gif"/>
<Image iconType="3" name="/net/apocalypselabs/symat/splash.gif"/>
</Property>
</Properties>
</Component>

@ -27,8 +27,15 @@
*/
package net.apocalypselabs.symat;
import java.awt.Color;
import java.awt.Graphics2D;
import javax.swing.ImageIcon;
import javax.swing.JProgressBar;
import javax.swing.Painter;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.ColorUIResource;
/**
*
@ -41,10 +48,36 @@ public class SplashScreen extends javax.swing.JFrame {
*/
public SplashScreen() {
initComponents();
setIconImage((new ImageIcon(getClass().getResource("icon.png"))).getImage());
UIDefaults defaults = new UIDefaults();
defaults.put("ProgressBar[Enabled].backgroundPainter", new ProgressPainter(false));
defaults.put("ProgressBar[Enabled].foregroundPainter", new ProgressPainter(true));
progBar.putClientProperty("Nimbus.Overrides.InheritDefaults", Boolean.TRUE);
progBar.putClientProperty("Nimbus.Overrides", defaults);
setIconImage((new ImageIcon(
getClass().getResource("icon.png"))).getImage());
setLocationRelativeTo(null);
}
class ProgressPainter implements Painter<JProgressBar> {
private final Color color;
public ProgressPainter(boolean foreground) {
if (foreground) {
this.color = new Color(86, 161, 243);
} else {
this.color = new Color(59, 127, 243);
}
}
@Override
public void paint(Graphics2D gd, JProgressBar t, int width, int height) {
gd.setColor(color);
gd.fillRect(0, 0, width, height);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
@ -69,14 +102,13 @@ public class SplashScreen extends javax.swing.JFrame {
}
});
progBar.setIndeterminate(true);
progBar.setMaximumSize(new java.awt.Dimension(32767, 20));
progBar.setMinimumSize(new java.awt.Dimension(10, 20));
progBar.setPreferredSize(new java.awt.Dimension(146, 20));
progBar.setString("");
progBar.setStringPainted(true);
jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/anim-splash.gif"))); // NOI18N
jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/splash.gif"))); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
@ -125,7 +157,7 @@ public class SplashScreen extends javax.swing.JFrame {
// Get editor going too
CodeEditor edit = new CodeEditor();
}
setProgress(85, "Loading main interface...");
new MainGUI().setVisible(true);
setProgress(100, "Done!");

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 KiB

Loading…
Cancel
Save