Java frames

B

Big - Goofy

Hello ,

I have done a game (a scrabble game) and the way I did it is in two
frames! One for the menu and one for the game. SO when you click on
new Game then is opening another frame! The thing is that now I did a
menubar so I want to call somehow the frame of the game in the current
frame or otherwise I would like to do the same thing in an
InternalFrame .... I know that it is possible but nothing coming out
of my head at the momment.Please Help :)

Thanks a lot in advance.
 
A

Andrew Thompson

I have done a game (a scrabble game) and the way I did it is in two
frames!

Do you mean java.awt.Frame, javax.swing.JFame,
or said:
...One for the menu and one for the game. SO when you click on
new Game then is opening another frame! The thing is that now I did a
menubar ..

java.awt.MenuBar? javax.swing.JMenuBar?
<ul class='menubar'>
<li><a href='game.htm'>Game</a>
<li><a href='help.htm'>Help</a>
...so I want to call somehow the frame of the game in the current
frame or otherwise I would like to do the same thing in an
InternalFrame ..

<iframe>? javax.swing.JInternalFrame?

Andrew T.
 
B

Big - Goofy

Thanks for your reply . everything is in Swing JFrame JMenuBar
JInternalFrame !

Thanks
 
A

Andrew Thompson

Thanks for your reply .

Your future lack of top-posting, will be thanks enough.
(rest of top-post corrected).
On 24 Jan 2007 19:05:29 -0800, "Andrew Thompson"
...everything is in Swing JFrame JMenuBar
JInternalFrame !
...
...
OK. I am still a little confused as to why you have
two JFrame's at all.

Why not have..
- a single JFrame with a single JMenuBar and a
blank 'playfield' area below that.
- When the users selects New Game from the menu,
either add the game (coded in a JPanel) into the
'playfield' area, or clear it to a 'new game' (if it
is already there).

The JPanel for the game could be ..
- Added once to the JFrame, as it is created,
but left in a 'blank' state to start with.
- Added to a java.awt.CardLayout (which would
allow the user to have multiple games going at once,
once you figure a way to allow them to switch
between current games.
- Added to a JTabbedPane (much the same deal
as the CardLayout)

Andrew T.
 
B

Big - Goofy

Your future lack of top-posting, will be thanks enough.
(rest of top-post corrected).


..
OK. I am still a little confused as to why you have
two JFrame's at all.

Why not have..
- a single JFrame with a single JMenuBar and a
blank 'playfield' area below that.
- When the users selects New Game from the menu,
either add the game (coded in a JPanel) into the
'playfield' area, or clear it to a 'new game' (if it
is already there).

The JPanel for the game could be ..
- Added once to the JFrame, as it is created,
but left in a 'blank' state to start with.
- Added to a java.awt.CardLayout (which would
allow the user to have multiple games going at once,
once you figure a way to allow them to switch
between current games.
- Added to a JTabbedPane (much the same deal
as the CardLayout)

Andrew T.

Thanks fro your reply!
The thing is that I have done too much work and I dont want to edit it
like this. I just want to find a way to load the frame from the one
class in the frame of the current class. So when I click on the menu
-> new game and choose the name of the players, the game makes a call
to the other class and it shows up a new frame! instead of that I
would like to load this new frame in the internal frame. In this way I
will have only one window and not two as before! One more thing for
you to know , is that I cannot load the game class from the beginning
coz first I need to give the number of the players , the names and the
playing order before load it.
 
O

Oliver Wong

Big - Goofy said:
Hello ,

I have done a game (a scrabble game) and the way I did it is in two
frames! One for the menu and one for the game. SO when you click on
new Game then is opening another frame! The thing is that now I did a
menubar so I want to call somehow the frame of the game in the current
frame or otherwise I would like to do the same thing in an
InternalFrame .... I know that it is possible but nothing coming out
of my head at the momment.Please Help :)

Thanks a lot in advance.

Try using a CardLayout:

http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html

- Oliver
 
B

Big - Goofy

Thanks for the previous help.
Now I ve got a new proble. 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??
 
O

Oliver Wong

Big - Goofy said:
Thanks for the previous help.
Now I ve got a new proble. 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??

Can you post an SSCCE demonstrating the problem?
http://mindprod.com/jgloss/sscce.html

- Oliver
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top