David Coldrick's Weblog

     
 
Reverting Swing Application to Java SE 1.5
Got bored with running my home-grown bookmarker application in a Windows virtual machine on my Mac: decided to regress from Java SE 6 to JDK1.5 so it would run directly on the Mac between now and October's Leopard release. :-( Moved the NetBeans project files across, opened the project in NetBeans, and, of course, had lots of errors, mostly due to the references to GroupLayout stuff that had been generated by the NetBeans Matisse capability. So how do I get nb to regenerate the code for the layout to use the swing-layout library? Turns out to be easy … once you know how. For each form, with the Inspector, choose Properties, then change the Layout Generation Style from "Standard Java 6 code" to "Swing Layout Extensions Library". Clean and build, and you're done.
@ 03:25 PM EST    Permalink [ Comments [13] ]
 
 
 
 
Trackback URL: http://blogs.sun.com/coldrick/entry/reverting_swing_application_to_java
Comments:

Had the same thing myself, surprisingly also on a Mac ;-) I wish there was a wizard to fix this globally rather than locating every single form in the application which was a pain.

Posted by Shai Almog on July 11, 2007 at 03:46 AM EST #

nice

Posted by 61.246.161.66 on July 11, 2007 at 02:52 PM EST #

Thanks! This is exactly what I was trying to find out. I wanted to give my Java application to people who run OSX, but I developed it using JDK6 & Netbeans. I'll try this properties solution in the next couple of nights. Fingers crossed!

Posted by Stodge on July 11, 2007 at 10:44 PM EST #

Hmm I don't see this option anywhere. I'm using NB 6 M10 on WinXP. My properties window looks nothing like yours - I don't have any of those options.

Posted by Stodge on July 12, 2007 at 10:25 AM EST #

Hey Stodge.

So you need to be in the Design tab for the form (not the source), then you need to click on "Form whatever-your-form-is-called" in the Inspector window (by default, on the left at the bottom). The properties window should be as shown in the link

Posted by David Coldrick on July 12, 2007 at 11:25 AM EST #

Thanks I found it - I was looking in the wrong place!

Posted by Stodge on July 13, 2007 at 11:01 AM EST #

java

Posted by mahdy on August 04, 2007 at 06:05 PM EST #

Don't understand a word of this but if David was once a snow-shoveller I'd love to hear from him.

Posted by ANDREW MCNEILL on August 06, 2007 at 01:17 PM EST #

Yeah, but it's better than being a sheep-hustler, you old kiwi, you :-) Email addresses at Sun are firstname.lastname@sun.com, and I'm in the Berry St (North Sydney) office Still enjoying Leonard Cohen?

Posted by David Coldrick on August 06, 2007 at 01:29 PM EST #

Anyone know of a way to regenerate the .java file for a form from the .form file? The IDE crashed on me, and when I restarted, the .java file was blank, but the .form file is still intact.

TIA,
J.D.

Posted by J.D. on August 28, 2007 at 07:15 AM EST #

Soryy, JD, don't know of a way

Posted by David Coldrick on August 28, 2007 at 10:38 AM EST #

JD found an answer elsewhere that's worth posting:

1. move your .form file to a safe place.
2. create a new, blank form with the same name as the original. This
creates a new .form file and a new .java file with the required codegen
tags.
3. copy the original .form file over the newly created one.
4. touch the .form file, to update its date to after the java file was
created.
5. open the form in netbeans, and change some property of one of the
existing controls.

The .java file should be regenerated from the .form file.

Thanks JD!

Posted by David Coldrick on August 31, 2007 at 09:24 AM EST #

Thanks for this, spent a while figuring out how to do this.

Posted by Mike Weller on October 30, 2007 at 11:23 PM EST #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed
 
« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today

[RSS Newsfeed]

Valid XHTML or CSS?

[This is a Roller site]
Theme by Rowell Sotto.
 
© David Coldrick's Weblog