j2gl
j2gl

Reputation: 726

Netbeans 7.1 dropped Swing Application Framework support? How can I migrate form 7.0 to 7.1?

Last week, I get very depressed, I have three big apps in production and many more using Swing Application Framework. Later, when I started to migrate to Netbeans 7.1, BOOM!, no more support for SAF.

So what can I do, any ideas how to migrate to Netbeans 7.1?

I will appreciate your help.

PS: Netbeans team, please don't add frameworks without a warning that are just an Java Specification Request - JSR. When I started to use SAF, it looks like it will be never discontinued.

PS2: To make us hear we are using SAF, vote at https://netbeans.org/bugzilla/show_bug.cgi?id=204661

Upvotes: 6

Views: 8017

Answers (4)

Lukasz Czerwinski
Lukasz Czerwinski

Reputation: 15432

I have succeeded in opening SAF form in Netbeans 7.2. after using some of tips from the forum: http://forums.netbeans.org/topic43775-0-asc-30.html:

  1. Delete comments // <editor-fold defaultstate="collapsed" desc="Generated Code"> arround initComponents() in the code of your form
  2. Get rid of all @Action annotations - instead use componentObject.addActionListener() or similar
  3. Get rid of all org.jdesktop.application and ...getActionMap()
  4. From .form file delete all tags starting with <Property name="action" type="javax.swing.Action".

I don't guarantee that in your case it will make your form work in 100%, but for me it worked - my form could be opened in Netbeans 7.2.

If Netbeans displays you some errors or warnings, read those messages and try to find out what's wrong - maybe you have for example deleted too much.

Upvotes: 1

joseph paladin
joseph paladin

Reputation: 11

The instructions from the guy who managed to port a SAF form into Netbeans 7.2 got me started. There is more to it porting into Netbeans 7.3. I recommend starting with a simple form with nothing in it created in Netbeans 6.9 then make the same form in 7.3 and compare the .java and .form code that is generated. That will show you all the differences that have to deal with porting the form. Once you get a simple form in try doing the same adding in an example of the component types you use like tabbed panes, buttons, check boxes, etc. Once again do a file compare so you can see how each component type is different. Every component type in SAF forms contains some kind of text property resource abstraction linked to a line in the properties file for the class and you have to break that link and just put an actually value in the Netbeans 7.3 Form. If you miss a single resource related parameter in the form then you will get that same error message until you have fixed everything. I managed to go through that exercise for an extremely complex frame and it took me a couple solid days partially learning curve. Only 15 more Frames to do most fairly complex but not as much as the main view which I did first.

Upvotes: 1

LorDefiX
LorDefiX

Reputation: 49

I found SAF as a plugin for newer NetBeans: http://plugins.netbeans.org/plugin/43853/swing-application-framework-support

Upvotes: 4

Mary
Mary

Reputation: 572

I don't have a good answer, but this may give other people more ideas (and it would be more useful to include the info here than to post a separate question)...

I also have a SAF app that I now need java 1.7 for, so have switched to netbeans 7.1, and can't edit the forms in nb7.0. I switch between nb7.0 to edit screens, then use nb7.1 to compile and run.

If I create a form in nb7.1, it works ok with my app, and I've looked at the generated code and the .properties files nb7.0 and nb7.1 create for, say, a JPanel, they look identical.

I haven't figured out how to "convert" the nb7.0-generated JPanels to ones that work with nb7.1, but I can create an empty JPanel in 7.1, then run 7.0 and copy all the controls from the 7.0 form to the 7.1 form. Icons get lost--a NetBeans bug, and code gets lost, in general, a costly and error-prone process.

There may be some flag somewhere in the project that tells if a JPanel is "SAF" or not. If so, finding it would make migration much easier.

Upvotes: 2

Related Questions