splitting gui defining files

From: lillwikki (loosetops_at_yahoo.co.uk)
Date: 03/30/04


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



Relevant Pages

  • Re: Starting a JFrame
    ... In the main method of your Launcher class, ... > The Launcher.java parses command line arguements, and calls the GUI. ... However, if I create a mainmethod in MorvenGUI to test it, ... > public class MorvenGUI extends JFrame ...
    (comp.lang.java.help)
  • Starting a JFrame
    ... The Launcher.java parses command line arguements, and calls the GUI. ... MorvenGUI lGUI = new MorvenGUI; ... public class MorvenGUI extends JFrame ...
    (comp.lang.java.help)
  • Re: import java on cli
    ... public class {... ... but how do i deploy this code to another db-instance via script. ... so is there a way to get the java-code from a commandline (without a gui) in the database. ... (calling the code is no prob, since i can call functions or procedures that call the java from sqlplus) ...
    (comp.databases.oracle.tools)
  • Re: Closing a running Gui
    ... > I have one Java Gui ... > which opens another Gui ... > public class Gui2 which also extends JFrame, ...
    (comp.lang.java.gui)
  • Closing a running Gui
    ... I have one Java Gui ... which opens another Gui ... public class Gui2 which also extends JFrame, ...
    (comp.lang.java.gui)