I am attempting to generate the GUI for some simple components that I can reuse in the palette manager of NetBeans. I have written the simple JPanel component manually and it works fine and now trying to convert it in to NetBeans GUI. While the code may not be identical, one portion is driving be bonkers as I can not determine where to make the change.
The manual code is:
The GUI builder is generating:
The ADD statement is the concern. There is no option that I am able to locate that allows me to modify the ADD function. I selected the parent panel and child component, but to no avail on locating anything that will modify the ADD statement.
Since your question is related to the use of the NetBeans IDE, rather than Swing per se, I'm moving it to a more appropriate section.
I will remark, though, that a visual designer isn't a beginner's tool and IMO is only worthwhile learning if you intend to make a career of GUI design. Straightforward Swing coding I find an order of magnitude easier.
There are no new questions, but there may be new answers.
Joined: Mar 09, 2012
Having been developing other languages for years, Java itself is new. As you mentioned, IDE's are not a beginner's tool (nor new to me) though I did only focus on using it for Java after messing with the manual code for a few weeks now. Much to my liking and dismay (because I posted this), I think I have figured it out. To assist others that might have this issue...
The parent container was still defined as Flow Layout. Once updating the parent container, the component properties now displayed a section for "Layout" that enabled me to choose the direction. Now the IDE generated code shows.
Robert Haynes wrote:Having been developing other languages for years, Java itself is new
Since you are someone experienced with other languages, here is my big tip: don't waste much time with the Java GUI stuff.
The Java GUI code was quickly slapped onto Java back in ancient times. Its not a good interface. Its not used much, either. Most folks
either write Web applications, so the browser does the GUI stuff, or they use a more specialized toolkit (like for Android).
Frankly, the Java GUI tools are crude, and the IDE support for them is crude, mostly IMHO because not many people rely upon them.
The whole "layout" design and karma tried to do a useful thing, let the presentation be controlled by the device, so it could be device, screen, resolution, etc. independent. But like many "cross platform" ideas, its better in theory than in practice.
Its not just in Java. Listen to the IOS developer now that the newest IPAD has a totally different screen resolution.