Can i call a JMenuBar in a number of JFrame(s) ?

Hi ,
I've a program with a number of JFrames.
I wanted to add a JMenuBar for each frame of my program, this menu bar has the same design code and the same events code in all the program frames, so is there a way to create this JMenuBar once only & call it some how in every JFrame to load it directly instead of writing its same code a lot of times for every JFrame ?
Thanks ,
Hesham

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
class Test{
     public static void main( String[] argv ) throws Throwable {
          for(int i=0; i<10; i++){
               SuperFrame f = new SuperFrame();
               f.setLocation(i*10,i*10);
               f.setSize(400,300);
               f.setVisible(true);
class SuperFrame extends JFrame{
     private static final long serialVersionUID = 1L;
      * All the menu item goes here
     JMenuBar mbar = new JMenuBar();
     JMenu menu = new JMenu("Menu");
     JMenuItem menuItem1  = new JMenuItem("Close");
     JMenuItem menuItem2  = new JMenuItem("Exit");
     public SuperFrame(){
          super("Testing");
          this.menu.add(menuItem1);
          this.menu.add(menuItem2);
          this.mbar.add(menu);
          this.setJMenuBar(mbar);
          menuItem1.addActionListener(new ActionListener(){
               @Override
               public void actionPerformed(ActionEvent arg0) {
                    dispose();
          menuItem2.addActionListener(new ActionListener(){
               @Override
               public void actionPerformed(ActionEvent arg0) {
                    System.exit(0);
}

Similar Messages

  • Can I call any network's provider number in Cyprus...

    Can I call any network's provider number in Cyprus by buying Pay monthly package?! Like MTN, Cytamobile-Vodafone, PrimeTel, Mobee and etc. ?! And if I can is it the same rate for every network mentioned? 
    Thanks for your time
    Solved!
    Go to Solution.

    Hi,
    Yes, you should be able to call any landline or mobile number in Cyprus with the subscriptions that we have on our website.
    If you have a subscription, you will not be charged a per minute rate. The duration will simply be deducted from your available minutes.
    To check our available subscripitons to Cyprus, please visit this link: http://www.skype.com/en/rates/
    In the searchbox, type in the country of your choice and the list will be displayed. You may also find our per minute rates (distinct for landlines and mobiles) on the same page.
    Hope this helps.
    Did my reply answer your question? Mark it as a solution to help others, Thanks.

  • Can you call these regular US numbers from Skype? ...

    Can you call these regular US based number's from Skype without being blocked why or why not?
    Number's are  from (removed).
    They are considered "free telephone chat line's" only long distance or regular fee's would apply.
    So are these allowed by the Skype system etc?
    Some example's of the phone number's incase you can't visit the site are: (removed)
                                                                              Thanks in advance.

    playdoughfigure wrote:
    1. They are considered "free telephone chat line's" only long distance or regular fee's would apply.
    2. So are these allowed by the Skype system etc?
    Hello,
    I've made a test call to one of these #s.
    1. Yes. That statement is correct.
    2.  Yes they are allowed.
    I've had to edit your post a little as we don't allow third party sites being posted.
    TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
    I recommend that you always run the latest Skype version: Windows & Mac
    If my advice helped to fix your issue please mark it as a solution to help others.
    Please note that I generally don't respond to unsolicited Private Messages. Thank you.

  • Is there a phone number where I can call someone? The phone number in your web page is missing a num

    Is there a phone number where I can call someone? The phone number in your web page is missing a number. it is listed as 1-800-426-570? One number missing. I just paid with my credit card online for photoshop and it is not allowing me to log in in order to download.

    If I click on the adobe.ly link Rajshree gave you, above, there is a phone number at the bottom of the Customer Support contact webpage.
    This is the number I see when logged in with an AdobeID associated with the US is:
    800-833-6687
    It is possible that you are somewhere else in the world and the webpage is smart enough to give a different phone number, so the number I see may or may not be applicable to where you are.
    It also may be advisable to use the Chat instead of the phone, because it may be easier to understand what someone is typing than trying to interpret their English through whatever accent they are speaking with.

  • I cant call to a mobile number since yesterday, but can receive call from the same number. I am using iphone 4s. Is there any setting error?

    I can't call to a mobile number since yesterday, but still can receive call from the same number. I am using iphone 4s. Is there any setting error?

    you have to make sure that CFWD Bridge Mode under the Line tab of the SPA9000 where the SPA400 is registered is set to ALL...include VMSP Bridge and XFER Bridge Mode as well..power cycle then check if you are still getting one-way audio
    | isolate! isolate! isolate! |

  • Can't call mobile number

    hi, 
    I am trying to call my boyfriend. He has a dutch mobile number but is living in Anguilla. I would like to be able to call him using my skype credit, but everytime I try it just hangs up before ringing? Can anyone give me a reason as to why this is happening? 

    There seems to be a general issue with this network in Poland. http://community.skype.com/t5/Windows-desktop-client/Dzwonienie-na-telefony-kom%C3%B3rkowe-i-stacjonarne/m-p/4047271#M355735 http://community.skype.com/t5/Windows-desktop-client/Mobile-phone-calls-from-skype-quot-Sorry-You-can-not-call-this/m-p/4060561/highlight/true#M357913 http://community.skype.com/t5/Rates-and-subscriptions/Unable-to-call-mobile-phone-numbers-Play-mobile-network-Poland/m-p/4060492/highlight/true#M44126 http://community.skype.com/t5/Android/Sorry-you-cannot-call-this-number-Always-was-able-to-call-mom/m-p/4032839#M49717 http://community.skype.com/t5/Android/Skype-to-polish-mobile-quot-the-number-you-dialled-is-wrong-quot/m-p/3988973/highlight/true#M48837 

  • I cannot change my "show caller ID". Under my number it says "Unknown", and I cannot change it. Under "shoe my caller ID" I cannot turn it on and off. Can you help me? THanks

    I cannot change my "show caller ID". Under my number it says "Unknown", and I cannot change it. Under "shoe my caller ID" I cannot turn it on and off. Can you help me? THanks

    Hello,
    Tried rebooting and updating, doesn't work. There is no problem with calling and receiving calls, but my number is blocked, and I cannot turn it on or change it in settings. Can this be fixed?
    Thanks

  • Can you call mobile numbers with an online number

    I set up an online number in England.  I am calling from US.  Can I call a mobile England number from my online number?

    kellyo820 wrote:
    I set up an online number in England.  I am calling from US.  Can I call a mobile England number from my online number?
    Online Numbers are for inbound calls from phones. Outbound calling to phones requires a call plan or Skype credit.
    More here:
    http://www.skype.com/intl/en/prices/pay-monthly
    http://www.skype.com/intl/en/prices/payg-rates
    http://www.skype.com/intl/en/prices
    About Me You can also use a IP Camera as your camera for Skype video Example Instructions

  • Can you Disable the emergency call (911) or change the number.

    Can you Disable the emergency call (911) or change the number. When my phone is locked I keep calling it when the phone is in my pocket.
    Even if I could change the number that would help but I think 911 is starting to hate me.
    Im running  XP pro
    Palm Desktop Version 4.1.4
    Treo 680 (Rogers)
    Post relates to: Treo 680 (Rogers)

    Hi Evtek,
    I'm afraid that there does not appear to be any way to disable the autocomplete of the LabVIEW combo box.  If this is a real problem the best suggestion I could give you would be to try the .net combo box.  This does allow you to disable the autocomplete mode although obivously the programming would be slightly more complex than the built in combo box.
    Otherwise you could use the update value on every key and use a different event to trigger the movement or if it isnt the enter key that is pressed do nothing in the event case.
    Regards,
    James Mc
    ========
    CLA and cRIO Fanatic
    wiresmithtech.com/blog

  • I wanna change the Questions, but the support will call me in a wrong number and it won't let me change the number unless i change the country, and i can't change the country because i have a money in my account.. what should i do??

    I wanna change the Questions, but the support will call me in a wrong number and it won't let me change the number unless i change the country, and i can't change the country because i have a money in my account.. what should i do??

    You will need to call tech support or have them call you at http://expresslane.apple.com
    Diana

  • How can i call Apple in usa from Egypt to buy an iPhone from Apple store please who khnow the contacting number answer me :)

    how can i call Apple in usa from Egypt to buy an iPhone from Apple store please who khnow the contacting number answer me

    http://www.apple.com/eg/buy/
    There are three companies linked to towards the bottom right to purchase an iPhone from. Above those three is Arab Business Machine. Choose one, or check each one out.

  • What phone number can i call for help?

    what phone number can I call for help on installing and registering PS Elements 13?

    I have absolutely no idea who Ari is
    It appears you do not know how to use this forum
    To reply back to Ari, you should have done that on the same thread so that he can see it
    Yes, you can call Apple if you are willing to pay for it
    Allan

  • How can i block an unwanted 12 digit number that has been constantly calling me?

    how can i block an unwanted 12 digit number that has been constantly calling me? The number is >Number deleted<
    Message was edited by: Verizon Moderator

        Hi there irock2! I know how pesky those unwanted calls can become. Since the calls are not coming from a normal 10-digit American number, it may be someone international attempting to reach you. Our Usage Controls http://bit.ly/plz3pA feature offers the ability to block international calls, and even calls from private and restricted numbers. We also offer the option to change your number at no charge through My Verizon http://bit.ly/WJbRNG if you'd like.
    Thank you
    JenniferH_VZW
    Please follow us on Twitter @vzwsupport

  • I can't call to phone number during i have subscri...

    Hi, I've have from today subscription for international free calls and calls to my country and i still can't call ... Already show me this error "You nee skype credit or subscription to call landlines and mobiles fom skype" ... Please any help? Thanks
    Attachments:
    skype.png ‏22 KB

    now i send next money for SKype credit and calls works fine but my credit falling down ... Why dont works my subscration? Thanks

  • Can I make skype calls to landlines or mobile numb...

    I recently subscribed to a free 30 day trial and I do not see the Bahamas listed as one of the places that can be called. Is the Bahamas a location that is included in this trial?

    Currently Unlimited World subscription doesn't include Bahamas:
    www.skype.com/intl/en/prices/pay-monthly/#UnlimitedWorld
    If you wish to call Bahamas then you can subscribe here:
    www.skype.com/intl/en-us/prices/pay-monthly/#BS
    Andre
    If answer was helpful please mark it with Kudos and if issue is resolved mark it with solution. This will help other users find this answer more easily. Thanks in advance!

Maybe you are looking for