• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDesktopPane

 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Can i add an internal frame into a JPanel? Why does the following code not compile?


Thanks in advance.
Cheers
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The compiler tells you why it can't compile your file ... did you read the error message it gave you? I'm guessing that it said that JPanel doesn't have a setContentPane method. How about using a JFrame instead? Everything else you're doing would be correct, if you were using a JFrame instead of JPanel.
 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you are right Nathaniel. Compiler complains that JPanel does not have a setContentPane method. I tried to use JFrame but it does not work too because i use the class Study in a JTabbedPane.
It seems that i have to replan the structure of application.
I have a main class, which has an instance of JTabbedPane(has 6 tabs and one of them is Study class)
I want to use internal frames in Study class.
Do you have any suggestions that i can do it without changing the whole structure?
Thanks a lot again for your help.
Cheers
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change setContentPane(desktop) to add(desktop) and it will (probably) work.
 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. I tried add method and it works.


And the Declarations class :


I have no compile errors, but when i run it i can not see any internal frame. Did i forget a method? What is my mistake?
Cheers
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
desktop.setLayout(null)

See if that helps.
 
Kudret Serin
Ranch Hand
Posts: 167
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gregg,
I added desktop.setLayout(null) but i still have no internal frame on desktop?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!