Author Topic: JGoodies  (Read 3868 times)

0 Members and 1 Guest are viewing this topic.

Offline Camel

  • Hero Member
  • *****
  • Posts: 1705
    • View Profile
    • BNU Bot
JGoodies
« on: November 15, 2007, 04:42:44 PM »
Just started playing round with JGoodies, and I liked it to much I added support for pluggable look and feels to my bot.



I did everything through reflection because I do not require the end-user or the developer to have the JGoodies JAR.
Code: [Select]
try {
// Initialize the JGoodies Look and Feels
String[] lafs = {
"com.jgoodies.looks.windows.WindowsLookAndFeel",
"com.jgoodies.looks.plastic.PlasticLookAndFeel",
"com.jgoodies.looks.plastic.Plastic3DLookAndFeel",
"com.jgoodies.looks.plastic.PlasticXPLookAndFeel",
};
Class<?> PlasticLookAndFeel = null;
for(String c : lafs) {
PlasticLookAndFeel = JARLoader.forName(c);
LookAndFeel laf = (LookAndFeel)PlasticLookAndFeel.newInstance();
UIManager.installLookAndFeel(laf.getName(), PlasticLookAndFeel.getName());
}

// getInstalledThemes()
Method getInstalledThemes = PlasticLookAndFeel.getMethod("getInstalledThemes");
List<?> themes = (List<?>)getInstalledThemes.invoke(null);
LinkedList<String> themes2 = new LinkedList<String>();
for(Object theme : themes)
themes2.add(theme.getClass().getSimpleName());
lookAndFeelThemes = themes2.toArray(new String[themes2.size()]);

// setPlasticTheme(PlasticTheme)
Class<?> PlasticTheme = JARLoader.forName("com.jgoodies.looks.plastic.PlasticTheme");
setPlasticTheme = PlasticLookAndFeel.getMethod("setPlasticTheme", PlasticTheme);
} catch(Exception e) {
Out.exception(e);
}

<Camel> i said what what
<Blaze> in the butt
<Camel> you want to do it in my butt?
<Blaze> in my butt
<Camel> let's do it in the butt
<Blaze> Okay!

Offline Dale

  • Hero Member
  • *****
  • Posts: 660
  • LOL IM COOL
    • View Profile
Re: JGoodies
« Reply #1 on: November 16, 2007, 11:04:04 AM »
Cute. :-*
Quote
[1:53:54 PM] Ersan: i could've written iago's code in 20 minutes
Quote
Joetheodd: I just gave myself the right arm workout of the century.
DMSyph: Uh ew?
Joetheodd: Oh my God.. I just realized what that probably could mean..
Quote
Kitty: Well honey, Canadians don't matter.
Dude, peanutbutter and jelly is like...1000000x more intense than a Volvo.

Offline Sidoh

  • Moderator
  • Hero Member
  • *****
  • Posts: 17668
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: JGoodies
« Reply #2 on: November 16, 2007, 12:32:07 PM »
Huh, that's pretty neat.  I haven't done anything with GUI programming in a while, but I'll definitely keep this in mind.