JInternalFrame and JMenuBar

Discussion in 'Java' started by Big - Goofy, Jan 28, 2007.

  1. Big - Goofy

    Big - Goofy Guest

    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
     
    Big - Goofy, Jan 28, 2007
    #1
    1. Advertising

  2. Big - Goofy wrote:
    > 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?

    --

    Knute Johnson
    email s/nospam/knute/
     
    Knute Johnson, Jan 28, 2007
    #2
    1. Advertising

  3. On Jan 29, 7:37 am, Big - Goofy <> wrote:
    ....
    > 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.
     
    Andrew Thompson, Jan 28, 2007
    #3
  4. Big - Goofy

    Big - Goofy Guest

    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
     
    Big - Goofy, Jan 28, 2007
    #4
  5. Big - Goofy

    Badshah Guest

    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.
     
    Badshah, Jan 29, 2007
    #5
  6. Big - Goofy

    Big - Goofy Guest

    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

    On 28 Jan 2007 21:50:42 -0800, "Badshah" <>
    wrote:

    > setContentPane(desktopPane)
     
    Big - Goofy, Jan 29, 2007
    #6
  7. On Jan 29, 11:14 pm, Big - Goofy <> wrote:

    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.
     
    Andrew Thompson, Jan 29, 2007
    #7
  8. Big - Goofy

    Big - Goofy Guest

    On 29 Jan 2007 04:32:56 -0800, "Andrew Thompson"
    <> wrote:

    >
    >On Jan 29, 11:14 pm, Big - Goofy <> wrote:
    >
    >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
     
    Big - Goofy, Jan 29, 2007
    #8
  9. On Jan 30, 7:54 am, Big - Goofy <> wrote:
    > On 29 Jan 2007 04:32:56 -0800, "Andrew Thompson"
    >
    > <> wrote:
    >
    > >On Jan 29, 11:14 pm, Big - Goofy <> wrote:

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

    >
    > 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.
     
    Andrew Thompson, Jan 30, 2007
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Niederberger

    Handle JMenuBar with visible glass pane

    Simon Niederberger, May 18, 2004, in forum: Java
    Replies:
    2
    Views:
    1,052
  2. Ajay

    JMenuBar and JPanel

    Ajay, Sep 23, 2005, in forum: Java
    Replies:
    1
    Views:
    15,718
  3. Replies:
    0
    Views:
    397
  4. Jason Cavett

    Add Listeners to JMenuBar

    Jason Cavett, Oct 4, 2006, in forum: Java
    Replies:
    1
    Views:
    1,450
    Shawn
    Oct 4, 2006
  5. Dan Polansky

    Listening to lost focus of JMenuBar

    Dan Polansky, Aug 16, 2007, in forum: Java
    Replies:
    0
    Views:
    364
    Dan Polansky
    Aug 16, 2007
Loading...

Share This Page