Skip to content

Commit ace905c

Browse files
committed
DarkMonkey - Added Yellow-Two and Manual Theme. Improved GLSL Highlighting (you need the GLSL Plugin) and added some MenuBarUI Stub (the idea is to override the MenuBarUI so it works like native mac apps. Unfortunately this code doesn't compile and would need heavy refactoring)
1 parent ddf0d5c commit ace905c

3 files changed

Lines changed: 103 additions & 11 deletions

File tree

jme3-dark-laf/src/org/jme3/netbeans/plaf/darkmonkey/DarkMonkeyLookAndFeel.java

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import com.nilo.plaf.nimrod.NimRODTheme;
99
import java.awt.Color;
1010
import java.awt.Font;
11+
import java.util.prefs.Preferences;
1112
import javax.swing.UIDefaults;
12-
import javax.swing.UIManager;
1313
import org.openide.util.NbPreferences;
1414

1515
/**
@@ -49,6 +49,27 @@ public DarkMonkeyLookAndFeel(){
4949
case "yellow":
5050
setCurrentTheme(getYellowTheme());
5151
break;
52+
53+
case "yellow-two":
54+
setCurrentTheme(getYellowTwoTheme());
55+
break;
56+
57+
case "manual":
58+
NimRODTheme nt = new NimRODTheme();
59+
Preferences pref = NbPreferences.root().node("laf");
60+
nt.setBlack(Color.decode(pref.get("darkmonkey.color.black", "#E8EAE0")));
61+
nt.setWhite(Color.decode(pref.get("darkmonkey.color.white", "#373737")));
62+
nt.setPrimary1(Color.decode(pref.get("darkmonkey.color.primary1", "#1A28BD")));
63+
nt.setPrimary2(Color.decode(pref.get("darkmonkey.color.primary2", "#233FB0")));
64+
nt.setPrimary3(Color.decode(pref.get("darkmonkey.color.primary3", "#3AA5F2")));
65+
nt.setSecondary1(Color.decode(pref.get("darkmonkey.color.secondary1", "#303030")));
66+
nt.setSecondary2(Color.decode(pref.get("darkmonkey.color.secondary2", "#3A3A3A")));
67+
nt.setSecondary3(Color.decode(pref.get("darkmonkey.color.secondary3", "#515151")));
68+
nt.setFrameOpacity(180);
69+
nt.setMenuOpacity(219);
70+
nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));
71+
setCurrentTheme(nt);
72+
break;
5273

5374
case "legacy":
5475
setCurrentTheme(getLegacyTheme());
@@ -64,7 +85,6 @@ public DarkMonkeyLookAndFeel(){
6485
} catch (Exception e) {
6586
setCurrentTheme(getBlueTheme());
6687
}
67-
6888
}
6989

7090
/**
@@ -90,7 +110,7 @@ public String getName() {
90110

91111
/**
92112
* This method override, getDescription() returns the String
93-
* "Look and Feel DarkMonkey - 2015, based on NimROD 2007" for
113+
* "Look and Feel DarkMonkey - 2016, based on NimROD 2007" for
94114
* instances of future programming that might use it as a tool tip or
95115
* small descriptor in their Look and Feel modules.
96116
* @return String "Look and Feel DarkMonkey - 2016, based on NimROD 2007"
@@ -104,6 +124,7 @@ public String getDescription() {
104124
@Override
105125
protected void initClassDefaults( UIDefaults table) {
106126
super.initClassDefaults( table);
127+
// MenuBarUI currently doesn't compile table.put("MenuBarUI", "org.jme3.netbeans.plaf.darkmonkey.components.MenuBarUI");
107128
/*
108129
for( Enumeration en = table.keys(); en.hasMoreElements(); ) {
109130
System.out.println( "[" + en.nextElement() + "]");
@@ -166,6 +187,24 @@ private NimRODTheme getYellowTheme() {
166187
return nt;
167188
}
168189

190+
private NimRODTheme getYellowTwoTheme() {
191+
NimRODTheme nt = new NimRODTheme();
192+
193+
nt.setBlack(Color.decode("#F3C802")); // Font Foreground
194+
nt.setWhite(Color.decode("#262626")); // Font Background
195+
nt.setPrimary1(Color.decode("#2040D0")); // Surrounds Bars and Shortcuts
196+
nt.setPrimary2(Color.decode("#1D3DBF")); // mainly used for bars
197+
nt.setPrimary3(Color.decode("#1D3DBF")); // e.g. for open tabs (Application)
198+
nt.setSecondary1(Color.decode("#000000")); // Outlines, some decoration and tooltips for disabled buttons
199+
nt.setSecondary2(Color.decode("#A6A086")); // Selected inactive things (and disabled text)
200+
nt.setSecondary3(Color.decode("#323232")); // Unselected Frames (and general background color)
201+
nt.setFrameOpacity(180);
202+
nt.setMenuOpacity(219);
203+
nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));
204+
205+
return nt;
206+
}
207+
169208
/**
170209
* This is the Legacy Theme. It's the one that DarkMonkey had before alpha-4
171210
* @return
@@ -200,9 +239,9 @@ private NimRODTheme getDebugTheme() {
200239
nt.setPrimary1(Color.decode("#FF0000")); // Surrounds Bars and Shortcuts
201240
nt.setPrimary2(Color.decode("#00FF00")); // mainly used for bars
202241
nt.setPrimary3(Color.decode("#0000FF")); // e.g. for open tabs (Application)
203-
nt.setSecondary1(Color.decode("#00FF00")); // Selected Things
204-
nt.setSecondary2(Color.decode("#FF0000")); // Selected inactive Things
205-
nt.setSecondary3(Color.decode("#0000FF")); // Unselected Frames
242+
nt.setSecondary1(Color.decode("#FFFF00")); // Outlines, some decoration and tooltips for disabled buttons
243+
nt.setSecondary2(Color.decode("#FF00FF")); // Selected inactive things (and disabled text)
244+
nt.setSecondary3(Color.decode("#00FFFF")); // Unselected Frames
206245
nt.setFrameOpacity(180);
207246
nt.setMenuOpacity(219);
208247
nt.setFont(Font.decode("DejaVu Sans Condensed-PLAIN-12"));
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*package org.jme3.netbeans.plaf.darkmonkey.components;
2+
3+
import com.apple.laf.AquaMenuBarUI;
4+
import java.awt.*;
5+
import java.lang.reflect.InvocationTargetException;
6+
import java.lang.reflect.Method;
7+
import java.util.logging.Level;
8+
import java.util.logging.Logger;
9+
import javax.swing.*;
10+
import javax.swing.plaf.*;
11+
import org.jme3.netbeans.plaf.darkmonkey.DarkMonkeyLookAndFeel;
12+
13+
public class MenuBarUI extends AquaMenuBarUI {
14+
public static ComponentUI createUI( JComponent x) {
15+
MenuBarUI a = new MenuBarUI();
16+
a.ProcessAppleControl(null);
17+
return a;
18+
}
19+
20+
// Thanks to bloodwalker for this
21+
private void ProcessAppleControl(JMenuBar j)
22+
{
23+
try {
24+
Class<?> clazz = Class.forName("com.apple.eawt.Application");
25+
Method method = clazz.getMethod("getApplication");
26+
Object obj = method.invoke(null);
27+
method = clazz.getMethod("setDefaultMenuBar", JMenuBar.class);
28+
method.invoke(obj, j); //Your custom MenuBar
29+
method = clazz.getMethod("enableSuddenTermination");
30+
method.invoke(obj);
31+
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
32+
Logger.getLogger(DarkMonkeyLookAndFeel.class.getName()).log(Level.SEVERE, null, ex);
33+
}
34+
}
35+
36+
public void paint( Graphics g, JComponent c) {
37+
super.paint( g, c);
38+
}
39+
40+
@Override
41+
public void update(Graphics g, JComponent c) {
42+
super.update(g, c);
43+
if (c instanceof JMenuBar) {
44+
ProcessAppleControl((JMenuBar)c); // For this to work, we HAVE TO extend AquaMenuBarUI
45+
}
46+
}
47+
48+
/* Doesn't work since AquaMenuBarUI isn't found by the default Compiler
49+
@Override
50+
boolean setScreenMenuBar(final JFrame jframe) {
51+
return false;
52+
}*/
53+
//}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!DOCTYPE fontscolors PUBLIC "-//NetBeans//DTD Editor Fonts and Colors settings 1.1//EN" "http://www.netbeans.org/dtds/EditorFontsColors-1_1.dtd">
33
<fontscolors>
4-
<fontcolor default="preprocessor" foreColor="ffc46200" name="preprocessor"/>
4+
<fontcolor default="preprocessor" foreColor="ffE67300" name="preprocessor"/>
55
<fontcolor default="error" foreColor="white" name="error" waveUnderlined="ffff3300"/>
6-
<fontcolor default="basictype" foreColor="ff4b9393" name="basictype"/>
6+
<fontcolor default="basictype" foreColor="ff46EBEB" name="basictype"/>
77
<fontcolor default="builtinvar" foreColor="ff8080ff" name="builtinvar"/>
8-
<fontcolor default="string" foreColor="ff808000" name="string"/>
9-
<fontcolor default="keyword" foreColor="ff0080ff" name="keyword"/>
8+
<fontcolor default="string" foreColor="ffFADD00" name="string"/>
9+
<fontcolor default="keyword" foreColor="ff004CFF" name="keyword"/>
1010
<fontcolor default="whitespace" foreColor="black" name="whitespace"/>
1111
<fontcolor default="number" foreColor="magenta" name="number"/>
1212
<fontcolor default="comment" foreColor="ff00934a" name="comment"/>
13-
<fontcolor default="identifier" foreColor="lightGray" name="identifier"/>
13+
<fontcolor default="identifier" foreColor="white" name="identifier"/>
1414
<fontcolor default="builtinfunc" foreColor="ffff8040" name="builtinfunc"/>
1515
<fontcolor default="operator" foreColor="white" name="operator"/>
1616
</fontscolors>

0 commit comments

Comments
 (0)