I want to ask about my vision for the GUI. I'm using NetBeans IDE to make it. My idea is something like this, we have a few JPanels with JLabels, and JButtons. First JPanel it's a menu and it is only visible JPanel at the application starts. When we click on the one of the buttons (let's say "Information") we change Menu JPanel Visibility to false, and the JPanel which include the "Information" is now Visible. The JPanel "Information" also has got JLabels and JButtons, and one of JButtons is a "Main Menu" which (when clicked) sets the Menu JPanel visibility as true, and set Information JPanel visibility as false.
My second idea (which is just stupid ;>) is to remove all components on JButton click, and create new components. So in Menu JPanel we got JButton information. When we click it, we remove all components that are in Menu JPanel, and we create new components, that are needed in Information JPanel.
I think that both ideas are terrible, but I have no other idea how to make it. I was thinking about web app, but I don't have such knowledge to create it.
Ever heard of CardLayout? And I do hope you're not using the NetBeans visual designer (aka Matisse); it's not a beginners' tool and you're more than likely to end up with code you can't comprehend and a design you can't figure out how to change.
I'm moving this from Beginning Java to the GUIs forum, which is where we usually discuss Swing related questions.
There are no new questions, but there may be new answers.
Joined: Jun 10, 2011
Sorry for posting in wrong forum..
I read something about CardLayout in documentation (here exactly: http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html ), This is what I was looking for, so now I have to check in in practise , and yes im using netbeans ide to create gui. Why it's not beginner tool? I understand most of the generated code, maybe not all but mostly all..
I don't have any issues with using an IDE, NetBeans or another. Using a visual designer without having first learned to hand-code a Swing GUI can come back to bite you when you need to add any advanced customizations or functionality.
IMHO it's only worthwhile for someone who plans to make a living designing GUIs to take the effort to learn the advanced features of the designer. For us mere mortals, learning hand-coding is easier, and the code is maintainable.
Another point is that upgrades to the designer can make your earlier designs useless. Recently I read a thread where the only 'solution' was for the programmer to revert to using NetBeans 5.5, losing a lot of bug fixes and enhancements subsequently added to the IDE.