It is currently 27 Apr 2024, 12:49
   
Text Size

Substance

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Substance

Postby Arch » 01 Dec 2009, 21:21

GUI improvement proposal. Substance is one way to make swing applications look less like swing applications (which should generally be considered a good thing).

I tried adding it to forge just to see how it looks and I would say it's pretty nice. Here are some screenshots with different look-and-feels for your viewing pleasure:

http://i48.tinypic.com/97qmpd.jpg
http://i50.tinypic.com/w6utk4.jpg
http://i48.tinypic.com/10gxk5c.jpg

To add it I just commented out the first try-catch block in main in Gui_NewGame.java and added the following around the new Gui_NewGame(); call. The substance.jar of course needs to be in your classpath.

Code: Select all
JFrame.setDefaultLookAndFeelDecorated(true);
SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try {
                UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceDustLookAndFeel");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
           
SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new Gui_NewGame();
        }
    });
It did as I mentioned above interfer with the original implementation, had to comment some things out, but it's not something that would be hard to fix. There does however appear to be a few hardcoded areas. See the "resizable game area" in the second screenshot for instance. (It's whiter, you'll see it very clearly with a darker look-and-feel.) But again not that hard to fix.

One of the nice things is that the dependecy is resolved at runtime and could always fall back to the original design. Which means that anyone who would want this could simply download the substance.jar and place it in the classpath. For everyone else the application would work as usual.

It would take a bit more work but you could have it changeable at runtime as well. (Instead of a hardcoded string or something to that extent.) Have a look at the webstart demo on this page to see what I'm taking about.

Anyways, proposal submitted for your consideration.
User avatar
Arch
Programmer
 
Posts: 206
Joined: 04 Jul 2009, 09:35
Has thanked: 0 time
Been thanked: 15 times

Re: Substance

Postby DennisBergkamp » 01 Dec 2009, 21:43

Wow, I think this looks awesome, thanks for sharing Arch!
What do you guys think?
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Substance

Postby silly freak » 01 Dec 2009, 22:11

i think it's nice. runtime configuration should be easy, just like the Look & Feel chooser already in Gui_NewGame, so why not also for skins?
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: Substance

Postby DennisBergkamp » 01 Dec 2009, 22:27

Yeah, curious name though, I think "Style" would suit it much better :roll:
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Substance

Postby mtgrares » 03 Dec 2009, 18:49

Substance over style, ha.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: Substance

Postby DennisBergkamp » 04 Jan 2010, 23:36

I messed around with this, but I haven't succeeded in getting different skins to show up. I keep getting the following error:

java.lang.ClassCastException: org.jvnet.substance.skin.ChallengerDeepSkin cannot be cast to javax.swing.LookAndFeel
at javax.swing.UIManager.setLookAndFeel(Unknown Source)
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Substance

Postby DennisBergkamp » 05 Jan 2010, 04:24

Never mind, got it working now. I'll add a bunch of skins to the next version :)
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Substance

Postby DennisBergkamp » 05 Jan 2010, 18:36

I've added all of the Substance skins... some of them look great, thanks for sharing, Arch!!!
My favorite "look and feel" is this one (it's called Napkin Look And Feel, and it's actually not in Substance). I mean, how baddass is that? It looks like someone drew all of the stuff on a napkin :mrgreen:
Attachments
NapkinLAF.jpg
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Substance

Postby Arch » 05 Jan 2010, 22:09

It's easily one of the best skins out there. The novelty wears off pretty quickly though.
User avatar
Arch
Programmer
 
Posts: 206
Joined: 04 Jul 2009, 09:35
Has thanked: 0 time
Been thanked: 15 times

Re: Substance

Postby Chris H. » 06 Jan 2010, 01:36

I updated my local copy and followed the instructions that were included in the log message. I tried out most of the skins, some look good and other are hard to read. :)

Several time I had an exception while trying out the various skins. I also noticed that instructions for adding the external JARs results in a change in my local classpath file. Eclipse wanted to merge this into our SVN.

I deleted my local copy and re-imported the entire SVN. I still have a new classpath file after adding the External Archives and Eclipse wants to merge this new classpath file into our SVN. :?
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Substance

Postby DennisBergkamp » 06 Jan 2010, 20:05

I got a few exceptions also, but this only seems to happen after multiple changes of skins...
Hmm, what kind of classpath file is this by the way? For me, whenever I commit stuff, there's a lot of files eclipse wants to include... I just uncheck them.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Substance

Postby Chris H. » 06 Jan 2010, 22:49

DennisBergkamp wrote:I got a few exceptions also, but this only seems to happen after multiple changes of skins...
`
Yes, that is the same problem that I noticed

Hmm, what kind of classpath file is this by the way?
`
The Build Path -> etc command is modifying my classpath file. The Remote File BASE has this:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
   <classpathentry kind="src" path="src"/>
   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
   <classpathentry kind="output" path="bin"/>
</classpath>
`
After using the Build Path -> etc command I get this:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
   <classpathentry kind="src" path="src"/>
   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
   <classpathentry kind="lib" path="/Users/chrish******/workspace/ForgeSVN/res/lib/jdom-1.0.jar"/>
   <classpathentry kind="lib" path="/Users/chrish******/workspace/ForgeSVN/res/lib/jl1.0.1.jar"/>
   <classpathentry kind="lib" path="/Users/chrish******/workspace/ForgeSVN/res/lib/napkinlaf-1.2.jar"/>
   <classpathentry kind="lib" path="/Users/chrish******/workspace/ForgeSVN/res/lib/napkinlaf-swingset-1.2.jar"/>
   <classpathentry kind="lib" path="/Users/chrish******/workspace/ForgeSVN/res/lib/nimrodlf.jar"/>
   <classpathentry kind="lib" path="/Users/chrish******/workspace/ForgeSVN/res/lib/substance.jar"/>
   <classpathentry kind="output" path="bin"/>
</classpath>
`
Looking at the diff of these two files I can see the diff being the hard drive path to the jar files included in the recent SVN update.
`

For me, whenever I commit stuff, there's a lot of files eclipse wants to include... I just uncheck them.
`
I have not yet found a way to uncheck this file and I am concerned. I do not want to merge this classpath file. It may cause problems. Maybe Silly Freak knows something about this and can explain this to me. :D
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Substance

Postby Chris H. » 06 Jan 2010, 23:40

I have not yet found a way to uncheck this file and I am concerned. I do not want to merge this classpath file. It may cause problems.
`
OK, I finally figured out how to uncheck this one file when I merge my work with the SVN. Cool.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 83 guests


Who is online

In total there are 83 users online :: 0 registered, 0 hidden and 83 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 83 guests

Login Form