Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8720373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:01:35+00:00 2026-06-13T07:01:35+00:00

Firstly, add ActionListeners to each of the JMenuItem objects. For example, when you select

  • 0

“Firstly, add ActionListeners to each of the JMenuItem objects. For
example, when you select “Square” from the menu, the ActionListener
attached to the ‘Square’ menu item must create an instance of your
‘Square’ class. These ActionListeners will be added as code within the
constructor of your MyFrame class.”

Could someone please walk me through how to do this?

Once the square is selected i need to then use my Jslider to some how work the area of the square, (given that the jslider value is one side of the square)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:01:36+00:00Added an answer on June 13, 2026 at 7:01 am

    Seeing as though this looks like homework, I won’t give you the specifics, but just a guide…

    Following through your instructions, you’ll first need to create a class that implements ActionListener, and implement the ‘actionPerformed()’ method as described in the documentation at http://docs.oracle.com/javase/6/docs/api/java/awt/event/ActionListener.html

    Then you’re instructed that this should detect what was clicked, and then create the appropriate Object. So, as per the Square instruction of your question, your actionPerformed() method would do something like this…

    JMenuItem clickedMenu = (JMenuItem)e.getSource();
    if (clickedMenu.getText().equals("Square")){
        Square square = new Square();
    }
    

    You would need to add additional if-else statements for the different menu items.

    Finally, it says that you need to add the ActionListeners to your MyFrame class, so it should be something like this…

    JMenuItem menuItem = new JMenuItem("Square");
    menuItem.addActionListener(new MyActionListener());
    

    Its just a matter of following through your instructions 1 piece at a time. If you get stuck at any point, try referring to the Java API documentation, or search for help here on StackOverflow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Firstly, is there a command for getting help and parameters for each sos command
Firstly I add markers to the overlay: private MapOverlay itemizedOverlay; Cursor items = mDbHelper.fetchAllItems();
I'm various issues getting CocoaPods dependencies to work in RubyMotion. Firstly, if I add
I need to add a context-sensitive menu to file icons in the finder. So
Firstly what views should I use in order to be able to add ads
Firstly, I draw lots of circles and they are moving slightly because I add
Firstly, I am no Javascript expert. I'd like to add a feature to a
Firstly , I am a freshmen to outlook add-in development,Recently I read some learning
So firstly here's my query: ( NOTE:I know SELECT * is bad practice I
Linq-to-Xml contains lots of methods that allow you to add arbitrary objects to an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.