• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem about Card Layout

 
adachi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have aready develop a frame with card layout, but it has some problem which is the frame first appear with all of the panel. The code as following:

ps:
Welcome to the ranch. While posting source code, please use the [ code ] opening and closing tags without the spaces. To use other tags please refer to the UBB Code link while posting a message.
Thanks for your cooperation.
regds.
- satya

[This message has been edited by Madhav Lakkapragada (edited June 26, 2001).]
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

"adachi"
javaranch has a lot of visitors daily and some with surprisingly similar names. Your name does not confirm to the guidelines of javaranch. Could you please take a moment and re-register yourself with a proper name according to the javaranch name guidelines
Thanks for your cooperation.
- satya
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi adachi,
If you are going to use Swing then use it. Don't mix and match.

It is generally a bad idea to mix AWT and Swing components in the same program. You are strongly discouraged from doing so.
There are a few compatibility issues that appear when you mix the two types of components. Heavyweight components are always rendered on top of lightweight components.

In your case, the TextFields (heavyweight) are being rendered on top of the JTabbedPane (lightweight) instead of inside each panel. Just change your TextFields to JTextFields and the problem disappears!
Regards,
Manfred.
 
Samuel Chan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Madhav Lakkapragada,
I have the problem like this too.
I've change all component to be swings, that seems ok, but when I have a JComboBox, when I click on it, there are exception occurs, like this:
Exception occurred during event dispatching:
java.lang.IllegalArgumentException: cannot add to layout: constraints must be a string
Hope anyone can help me!!
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Samuel:
Are you trying to mix JTabbedPane and CardLayout like the
code originally posted?
From what I know we use either or, not mixing both.
Also, not just JComboBox, adding even a JPanel can produce
the error you got. Its got nothing to do with JComboBox.
Its the way you use the Card Layout manager.
Please refer to the Card Layout tutorial. I found it very
easy and helpful. Sorry I don't have a lot of time to review
and solve your problem. Hope this helps.
regds.
- satya

 
Samuel Chan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot satya!!
I've solved the problem because of your help.
Thank you very much
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!