Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Question on Frames.

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Thanked 0 Times in 0 Posts

    Default Question on Frames.

    I will come out and say it: this is a project for school. I am not asking for source code to be given to me. Just general help.

    I already did one assignment where i had to populate a menu bar using JFrames. Okie Dokie!

    Second assignment asks me to use Frames and basically do the same thing by adding a menu bar and subItems to it.

    I have emailed the professor on my misunderstanding between the two, and he just reiterated that one you use JFrames, the other assignment just use Frames.

    I can't find any information on building a menu bar using Frames, just JFrames. My question to this community:

    1.) What is the difference between the two? I know JFrames is backwards compatible and Frames are not. (The bulk of the information I have learned from 'googling' quite some time.)

    2.) How is adding a menu bar and the subsequent items different from adding them to a Frame?

    Thank you to everybody in advance.

  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 833 Times in 772 Posts
    Blog Entries

    Default Re: Question on Frames.

    Take a look at the API for JFrame
    JFrame (Java Platform SE 6)
    First, note at the top of the page the inheritance hierarchy, in particular that JFrame extends Frame. In short, JFrame is a subclass of Frame. Within that API you can also find a multitude of methods that you have access to for building a Frame or JFrame (note the setMenuBar method of Frame, and setJMenuBar method for JFrame). Technically, Frame is AWT and JFrame is Swing, two architectures for building GUI's (they actually are quite related, Swing being the currently preferred method - see Swing (Java) - Wikipedia, the free encyclopedia ). Get to know that API, because it contains a wealth of information for standard java classes.

  3. #3
    Join Date
    Mar 2012
    United States
    My Mood
    Thanked 33 Times in 31 Posts

    Default Re: Question on Frames.

    It would seem that the first assignment is designed to use Swing while the second is designed to use awt. I say this because Frame is a part of java.awt.* and JFrame is part of javax.swing.* (Which is an extension of java.awt.Frame). However, without the exact wording of the assignment that is still only an assumption. If, however, I am correct then this will help you out: Short Course

Similar Threads

  1. How do dockable Frames (as an eclipse UI views)
    By Farrukhjon in forum AWT / Java Swing
    Replies: 1
    Last Post: September 12th, 2011, 04:28 AM
  2. Frames - Using and creating (+another question)
    By 12sea21 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: September 1st, 2011, 01:24 AM
  3. Creating subsequent frames in java with Jframe
    By bondage in forum AWT / Java Swing
    Replies: 3
    Last Post: April 11th, 2011, 07:28 AM
  4. Switching between frames from a seperate class
    By kurt-hardy in forum AWT / Java Swing
    Replies: 4
    Last Post: February 14th, 2011, 04:19 AM
  5. GIF frames
    By vsector in forum AWT / Java Swing
    Replies: 0
    Last Post: April 15th, 2010, 05:25 PM