Netbeans 7.1 lost support for Swing Application Framework? How to transfer form 7.0 to 7.1?

Last week, I am very depressed, I have three large applications in production and many others using the Swing Application Framework. Later, when I started migrating to Netbeans 7.1, BOOM !, SAF was no longer supported.

So what can I do, any ideas on porting to Netbeans 7.1?

I would be grateful for your help.

PS: Netbeans Team, please do not add frameworks without warning, which is just a Java Specification Request - JSR specification. When I started using SAF, it looks like it will never be discontinued.

PS2: For us to hear that we are using SAF, vote https://netbeans.org/bugzilla/show_bug.cgi?id=204661

+6
source share
4 answers

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

I also have a SAF application for which I now need java 1.7, so I switched to netbeans 7.1 and cannot edit forms in nb7.0. I switch between nb7.0 to edit screens, and then use nb7.1 to compile and run.

If I create a form in nb7.1, it works fine with my application, and I looked at the generated code and .properties nb7.0 and nb7.1 files, creating, say, JPanel, they look the same.

I did not understand how to "convert" JPNel with nb7.0 to those 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 7.0 to form 7.1. Icons get lost - NetBeans error, and code gets lost, in general, an expensive and error prone process.

There may be some kind of flag in the project that indicates whether the JPanel is "SAF" or not. If so, the search for this will facilitate migration.

+2
source
+4
source

I managed to open the SAF form in Netbeans 7.2. after using some forum tips: http://forums.netbeans.org/topic43775-0-asc-30.html :

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

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

If Netbeans displays some errors or warnings, read these messages and try to find out what is wrong - perhaps you, for example, have deleted too much.

+1
source

The instructions from the guy who managed to submit the SAF form in Netbeans 7.2 got me started. There is more than porting to Netbeans 7.3. I recommend starting with a simple form in which nothing is created in Netbeans 6.9, then make the same form in 7.3 and compare the generated .java and .form code. This will show you all the differences associated with form wrapping. Once you get a simple form, try the same addition in the example of the types of components that you use, for example, with tabs, buttons, check boxes, etc. Compare the file again so you can see how each type of component is different. Each component type in SAF forms contains some abstraction of a text property resource associated with a line in the property file for the class, and you should break this link and simply put the actual value in the Netbeans 7.3 form. If you skip one parameter associated with a resource in the form, you will receive the same error message until everything is fixed. I managed to complete this exercise for an extremely complex frame, and it took me a couple of days, partially studying the curve. Only 15 more frames to make the most difficult, but not the same as the main view that I did in the first place.

+1
source

Source: https://habr.com/ru/post/909200/


All Articles