• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Show images on the screen without using JFrame

 
Devasia Manuel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am dying to know how you can show images and swing components on the screen without putting in all in a Jframe first. I know there is a way of doing it, I just dont know how.

Thanks
--Devasia
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that you have to use some root container but that it doesn't have to be a JFrame. You could use a JDialog, a JOptionPane, or a JWindow. You could set your app to have no "decorations", no titlebar, or resize/exit buttons if desired. I suggest that you study the Sun Swing tutorials for more detail. Good luck.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49793
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pete Stein is correct, but the actual list of top-level containers is (I think) Window Frame Applet and Dialog. Frame includes JFrame (as a subclass) (etc), and what you get from JOptionPane is actually a Dialog.
 
Rob Spoor
Sheriff
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically there is only one top-level container class: Window. Frame, Dialog and JWindow are subclasses of Window.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49793
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you're right, Rob. But what about Applets? Don't they count as top-level too?
 
Rob Spoor
Sheriff
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, they are still in a Frame. I've retrieved it for showing modal dialogs.

Of course you should treat Applets as top-level as far as creating components goes (i.e. you don't add it to anything yourself), but it certainly is not a top-level component in the same way as Frame or Dialog are.
[ October 23, 2008: Message edited by: Rob Prime ]
 
Campbell Ritchie
Sheriff
Pie
Posts: 49793
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.
 
Devasia Manuel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well then in that case, how do I take off the tilte bar and the border?
 
Campbell Ritchie
Sheriff
Pie
Posts: 49793
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either use a JWindow or find the thread from the end of March last year about how to take buttons off a JFrame.
 
Rob Spoor
Sheriff
Pie
Posts: 20608
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setUndecorated(true) is the other way to do it.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49793
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that post did mention setUndecorated, but I could remember when it was posted, better than I could remember setUndecorated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic