Skip to content

Commit

Permalink
looks
Browse files Browse the repository at this point in the history
  • Loading branch information
fireduck64 committed Jul 12, 2019
1 parent 12c3fbc commit 27bfdb4
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 4 deletions.
4 changes: 2 additions & 2 deletions iceleaf/src/BasePanel.java
Expand Up @@ -67,11 +67,11 @@ public BasePanel(IceLeaf ice_leaf)
status_box = new JTextArea();
message_box = new JTextArea();

if (ice_leaf.getFixedFont() != null)
/*if (ice_leaf.getFixedFont() != null)
{
status_box.setFont(ice_leaf.getFixedFont().deriveFont(0,12));
message_box.setFont(ice_leaf.getFixedFont().deriveFont(0,12));
}
}*/

}

Expand Down
9 changes: 9 additions & 0 deletions iceleaf/src/IceLeaf.java
Expand Up @@ -45,6 +45,7 @@ public static void main(String args[]) throws Exception
protected AddressPanel address_panel;
protected NetworkParams params;
protected SettingsPanel settings_panel;
protected IceLeaf ice_leaf;

public Preferences getPrefs() { return ice_leaf_prefs;}
public NetworkParams getParams() { return params; }
Expand All @@ -53,17 +54,21 @@ public static void main(String args[]) throws Exception
public SendPanel getSendPanel(){return send_panel;}

public Color getBGColor(){return new Color(204,204,255);}
public Color getTextAreaBGColor(){return new Color(220,220,220);}

private Font fixed_font;
private Font var_font;

public Font getFixedFont(){return fixed_font;}
public Font getVariableFont(){return var_font;}


public IceLeaf(NetworkParams params, Preferences prefs)
throws Exception
{
this.params = params;
this.ice_leaf_prefs = prefs;
this.ice_leaf = this;
if (ice_leaf_prefs == null)
{
ice_leaf_prefs = Preferences.userNodeForPackage(this.getClass());
Expand Down Expand Up @@ -92,6 +97,8 @@ public void run()
{
fixed_font = Font.createFont(Font.TRUETYPE_FONT,
IceLeaf.class.getResourceAsStream("/iceleaf/resources/font/Hack-Regular.ttf"));
var_font = new Font("Verdana", 0, 12);

//IceLeaf.setUIFont(new Font("Verdana", 0, 12));
//UIManager.setLookAndFeel(new javax.swing.plaf.nimbus.NimbusLookAndFeel());
}
Expand Down Expand Up @@ -158,6 +165,8 @@ public void run()
tab_pane.add("Node Selection", node_select_panel.getPanel());
tab_pane.add("Node", node_panel.getPanel());
tab_pane.add("Settings", settings_panel.getPanel());

UIUtil.applyLook(f, ice_leaf);

}

Expand Down
1 change: 1 addition & 0 deletions iceleaf/src/NodePanel.java
Expand Up @@ -8,6 +8,7 @@
import javax.swing.SwingUtilities;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Dimension;
import java.util.prefs.Preferences;

import snowblossom.node.SnowBlossomNode;
Expand Down
4 changes: 2 additions & 2 deletions iceleaf/src/SendPanel.java
Expand Up @@ -86,7 +86,7 @@ public void setupPanel()
c.gridwidth = GridBagConstraints.REMAINDER;

dest_field = new JTextField();
dest_field.setColumns(30);
dest_field.setColumns(50);
panel.add(dest_field, c);


Expand All @@ -95,7 +95,7 @@ public void setupPanel()
c.gridwidth = GridBagConstraints.REMAINDER;

send_amount_field = new JTextField();
send_amount_field.setColumns(10);
send_amount_field.setColumns(15);
panel.add(send_amount_field, c);

send_bar = new JProgressBar(0, SEND_DELAY);
Expand Down
53 changes: 53 additions & 0 deletions iceleaf/src/UIUtil.java
@@ -0,0 +1,53 @@
package snowblossom.iceleaf;

import java.awt.Component;
import java.awt.Container;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;

public class UIUtil
{
public static void applyLook(Component comp, IceLeaf ice_leaf)
{

if (comp instanceof Container)
{
Container ct = (Container) comp;
for(Component c : ct.getComponents())
{
applyLook(c, ice_leaf);
}
}

if (comp instanceof JTextArea)
{
JTextArea e = (JTextArea)comp;
if (!e.isEditable())
{
comp.setBackground(ice_leaf.getTextAreaBGColor());
}
comp.setFont(ice_leaf.getFixedFont().deriveFont(0,12));
}
else if (comp instanceof JTextField)
{
comp.setFont(ice_leaf.getFixedFont().deriveFont(0,12));
}
else if (comp instanceof JLabel)
{
//int size = comp.getFont().getSize();
//comp.setFont(ice_leaf.getVariableFont().deriveFont(0,size));

}
else if (comp instanceof JTabbedPane)
{
//int size = comp.getFont().getSize();
//comp.setFont(ice_leaf.getVariableFont().deriveFont(0,size));

}


}

}

0 comments on commit 27bfdb4

Please sign in to comment.