JInternalFrame and JMenuBar

B

Big - Goofy

Hey all,

I have a JFrame and a JMenuBar at the top
from which I call the method New Game and the new Game opens in a new
JInternalFrame. Everything working perfect except from the menuBar.
Without the internalFrame I can see all the menuItems , with the
internalFrame I can see only the first menuItems coz the internal
frame overwrites the last ones.
What can i do to have the menuBar over the JInternalFrame??

thanks
 
K

Knute Johnson

Big said:
Hey all,

I have a JFrame and a JMenuBar at the top
from which I call the method New Game and the new Game opens in a new
JInternalFrame. Everything working perfect except from the menuBar.
Without the internalFrame I can see all the menuItems , with the
internalFrame I can see only the first menuItems coz the internal
frame overwrites the last ones.
What can i do to have the menuBar over the JInternalFrame??

thanks

Can you post a simple example that shows this problem? What OS are you
using?
 
A

Andrew Thompson

I have a JFrame and a JMenuBar at the top.. ...
What can i do to have the menuBar over the JInternalFrame??
<http://java.sun.com/docs/books/tutorial/uiswing/components/
internalframe.html>
From the JavaDocs for JInternalFrame
"Generally, you add JInternalFrames to a JDesktopPane."
You might be able to successfully add a JInternalPane
to a JFrame, but you would need some expertise
with Swing painting, to make it work 'right'.

I put that in inverted commas because from your
past threads, I understand you are attempting to
misuse a JInternalFrame, in order to avoid learning
how to use layouts such as CardLayout, or components
like JTabbedPane's.

Maybe someone will be willing to help you
further with your current strategy, but my take
is that I don't have enough time to help people
figure how to make *bad* GUI's.

Andrew T.
 
B

Big - Goofy

Mate I really dont wanna use bad GUI . I also liked the idea of having
tabs in my game but the thing is that this is a project for my second
year (University) I need to deliver it on this tuesday (I have no more
time left) and as much as I tried I couldnt find a way to implement
the tab layout. it doesnt working . The thing is that the excercise
was almost ready and they asked to use only one frame. I did it with
JInternalFrame but also I tried to put all the panels in one and then
put the last panel in a tab.It didnt word!!!!!!!
Thanks
 
B

Badshah

Hi,

You do this :

1) add JDesktopPane object on the JFrame.

JDesktopPane desktopPane = new JDesktopPane();
setContentPane(desktopPane)

2) add JMenuBar object on the JFrame

3) Add internalFrame on desktopPane.

JInternalFrame fr = new JInternalFrame();
desktopPane.add(fr);

Hope this will help.
 
B

Big - Goofy

Thanks a lot for your help , it is better now but still the menu is
not full , the last menuItem is hiding behinf the InternalFrame. Any
ideas? Also How can I implement the tabbedPane in my game?

thanks
 
A

Andrew Thompson

Please refrain from top-posting. I find it most confusing.
..How can I implement the tabbedPane in my game?

Add the JTabbedPane (JTP) in place of the JDesktopPane.

The Java tutorial has a section devoted to JTP's..
<http://java.sun.com/docs/books/tutorial/uiswing/components/
tabbedpane.html>

Also handy is the opening paragraphs in the
JavaDocs for the JTP.

Note that when I initially suggested a JTP, I
was thinking it would be best if the game needed
to open any number of instances of the game
playing area. If it does *not* make sense to
have a number of game play areas open at
one time, it might be better to use a CardLayout
or add the game (in a JPanel - would be best)
directly to the content pane.

The question you need to anwser with the
second approach is, what do you do if the
user wants to play '10 games in a row - one
after the other'?

One way is to add a new game each time
to a CardLayout (or JTP - though that makes
less sense to the user), or alternately to entirely
remove the cureent game compoenent, and
add a new one, or the strategy I would probably
take, to devise a 'reset()' method for the game
play area that takes it back to the initial state
(ready for a new game).

Andrew T.
 
B

Big - Goofy

Please refrain from top-posting. I find it most confusing.

What do you mean by that?

Anyway , I solved my problem and now my game is working with tabs :D
thanks a lot. BAsically , my problem now is that the layout is not
working like before but i think i can handle it. But , there is still
one more question , many applications have menu which are disabled
(you can see them but you cannt click on them) . I tried to do the
same thing but once i give the command menu.disable(); then the menu
is disappearing . I want to see it and not be able to click on it!!!!
is it possible?

Thomas.K
 
A

Andrew Thompson

What do you mean by that?

Posting a reply 'on-top of' or above the text on which
you are replying. If not replying to a section of text,
it is best trimmed, and if replying to it, best put
the reply directly after/below the section.

Ironically, between the post in which I asked you not
to top-post, and your next one, you had changed the
order to bottom-post.

Andrew T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top