splitting gui defining files
From: lillwikki (loosetops_at_yahoo.co.uk)
Date: 03/30/04
- Next message: Rex Guo: "Re: appending paths"
- Previous message: Andrew Thompson: "Re: Can't compile a java file."
- Next in thread: Andrew Thompson: "Re: splitting gui defining files"
- Reply: Andrew Thompson: "Re: splitting gui defining files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Mar 2004 17:41:23 -0800
hi all,
First of all like to state that am relatively new to java but i have
good enough experience with OOP in c++.
Am working on a simple board game application and still touching up on
the GUI.
The file/class that is responsible for setting up the gui was becoming
too big and confusing and i decide to seperate the part that creates
the menu bar and make it a class of its own.
The Menubar nolonger appears in the gui after seperating the classes.
Here is a snippet of the code of what i am doing.
this is the constructor of the Board class that sets up the gui
-------------------------------------
public class Board extends JFrame implements MouseListener
{
private ------
private ------
public Board()
{
super("Eso - the holes game");
BoardMenu gameMenu = new BoardMenu(); //new line
'
'
'
'
}
-------------------------------------
this is the boardmenu class
-------------------------------------
public class BoardMenu extends JFrame
{
public BoardMenu()
{
//set up File Menu and its menu items
JMenu fileMenu = new JMenu("File");
fileMenu.setMnemonic('F');
'
'
'
}
------------------------------------
Before all the code(no changes at all) in the BoardMenu constructed
replaced
was in the place of
BoardMenu gameMenu = new BoardMenu(); //new line
and everything worked fine. However now it compiles both files but the
menubar does not appear on the gui.
i can post more code if needed but i think that should show what i am
doing wrong.
thanx
lillwikki
- Next message: Rex Guo: "Re: appending paths"
- Previous message: Andrew Thompson: "Re: Can't compile a java file."
- Next in thread: Andrew Thompson: "Re: splitting gui defining files"
- Reply: Andrew Thompson: "Re: splitting gui defining files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|