Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

Java GUI Lesson 6 | Menus

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
6,189
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Mar 30, 2010

making a program with a menu bar containing colors which can be selected to change the color of the window

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (macheads101)

  • Hi,

    JMenuBar is undefined (??) in my java eclipse platform, even if I imported javax.swing and the two other ones. What do you think is the problem?

    thank you!

  • @linoush95 try typing javax.swing.JMenuBar instead of just JMenuBar.

see all

All Comments (18)

Sign In or Sign Up now to post a comment!
  • This video is a favorite on Ottawa

  • Still having trouble with the color showing up, I tried getContentPane().setBackground­(Color.RED); as I did have to do this for other tutorials and I also tried doing the; this.getContent..... and neither work if someone finds a solution please let me know. thanks.

  • @musicinsane666 nvm i fixed this problem now when i run it i just get a blank screen labeled colors

  • Hey, this tutorial is wonderful but i have run into a couple problems im hoping you can help me with.

    1. On the JMenuBar it says it can't convert JMenuBar to JMenu

    2. All the curly brackets match up but it tells me the last one is a syntax error

    I would really appreciate help with this issue

  • @ciberiada01 I don't know if you are still having trouble... but what you have to use is:

    this.getContentPane().setBackg­round(Color.GREEN); // this is will the background colour to green

    I know I may be way too late but I hope this helps anyone having trouble

  • i know that already!

  • sucks

  • @ciberiada01 same things here

  • @ciberiada01 same things here

  • Hi, macheads101,

    My problem is:

    the line:

    setBackground(Color.BLUE);

    in the actionPerformed method doesn't display the desired result (the backgroung is still light grey). It's interesting that if I do:

    JOptionPane.showMessageDialog(­null, getBackground());

    I get the following:

    java.awt.Color[r=0,g=0,b=255]

    So, the color is OK, just I don't see it displayed. Any suggestions?

    I'm kinda new on Java and I'm using Win XP SP3.

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more