• Post Reply Bookmark Topic Watch Topic
  • New Topic

JInternalFrames, fault in code

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,

I recently posted a question about getting a JInternalFrame so you can
see through it, but it doesn't seem to work when I apply to a card layout.

My code is something like this:


Then I add the 'jdtp' to the JFrames ContentPane.
The JInternalFrame displays properly, but the JPanels I added to 'cards'
won't display, and the screen is blue.

I don't see why it doesn't work, can anyone help.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems only JInternalFrames can be added to JDesktopPanes which explains why only the JIntenalFrame shows.

I guess I'll have to create a JPanel 'cards' with CardLayout,
which I can add 2 objects that extend JDesktopPane.

Thats probably best.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm, I can't get this to work, can anyone help.

Basically I need a JPanel(CardLayout) with a JInternalFrame lying on top,

OR

A JPanel(CardLayout) where two JDesktopPanes(each having their own JInternalFrame) are added.

I tried both approaches, but I can't get it to work, is there any way to do this?

Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
works OK like this

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats great thanks!

I fiddled with it, and put an image in there too.
I realise why I was couldn't get the colour to work right
inside the JInternalFrames,
I assumed new Colour(a,b,c,d) had the alpha component first,
but alpha is last, which explains my odd results.

Thanks again.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!