How can I change the menubar depeneding on the panel selected?

Hi,
I am having the[b] AppMain.java extends JFrame and the Navigator extends AppMain.
There is a perspective.java interface which has a getMenu() method as follows
public JMenubar getMenu()
There are 2 panels which are being interchenged depending on the button selected in the navigator.
THey are the Admin and the Config which implements Perspective extends JPanel
and they also have the method for getmenu()as follows.
public JMenuBar getMenu()
return Navigator.getInstance().getJMenuBar();
in the Navigator I have the code for the setJMenuBar as follows
String xmlFile = "/metadata/guidef.xml";
//Parse the xml file that represents the gui menus, toolbars, actions, icons
try
ErrorFactory.getInstance().parse();
GuiFactory.getInstance().setInputSource(xmlFile);
GuiFactory.getInstance().parse();
this.setIconImage(IconFactory.getInstance().getIcon("appicon").getImage());
this.setJMenuBar(createMenuBar());
catch (Exception e)
e.printStackTrace();
But what I need to do is I need to change the menubar depending on panel selected ?
Thanks in advance.

public class MQENavigator extends ApplicationMain {
/** Main Content panel for the application Frame */
public JPanel mainContentJPanel_;
     public JPanel mainViewPanel = null;
     JPanel perspectiveButtonBar = new JPanel();
public JPanel perspectiveViewPanel = new JPanel();
public JPanel configViewPanel = new JPanel();
public JPanel commandStatPanel = new JPanel();
private Hashtable panelsHash = null;
static private final String mqenterpriseKey = "application.title";
static private final String guidefKey = "ldmkxml.guidef.text";
     static private final String initmqKey = "ldmkxml.mqelayout.text";
     static private final String toolbarKey = "ldmkxml.create.toolbars.text";
     static private final String statusKey = "ldmkxml.create.statusbars.text";
     static private final String mainappKey = "ldmkxml.create.mainapp.view.text";
     static private final String launchKey = "ldmkxml.launch.mqenterprise.text";
     static private final String imgfnfKey = "ldmkxml.imgfile.notfound.text";
     //ints to keep track of heights of various components
int iHeight_;
//Splash window for updating status
SplashWindow _splash = null;
* Constructor for the main application frame
public MQENavigator()
super();
try
initComponent();
initGUI();
soleInstance_ = this;
catch(Exception e)
e.printStackTrace();
* This will initialize the component defaults
* @param None
* @return None
* @exception <{Exception}>
protected void initComponent() throws Exception
setAppKeyName("mqe");
setIniFile("mqe");
Locale.setDefault(SupportedLanguages.getLocale(
Integer.parseInt(getIniFile().getProperty("selected.language", "0"))));
          String key = StringFactory.getString(mqenterpriseKey);
setAppName(key);
Log.init();
Log.log(Log.NOTICE, this, Utilities.getResource("/metadata/version.info").trim());
super.initComponent() ;
          String hs = getIniFile().getProperty("helpset.name");
          GuiResource.initializeHelp(hs);
* This will initialize this components GUI
* @param None
* @return None
* @exception Exception
private void initGUI() throws Exception
          String guidefkey = StringFactory.getString(guidefKey);
          String initmqkey = StringFactory.getString(initmqKey);
          String toolkey = StringFactory.getString(toolbarKey);
          String statuskey = StringFactory.getString(statusKey);
          String mainappkey = StringFactory.getString(mainappKey);
          String launchkey = StringFactory.getString(launchKey);
// Start the splash screen
_splash = displaySplashScreen(createSplashPanel());
// Create the Menu Bar
_splash.incrementProgressTo(10, guidefkey);
String xmlFile = "/metadata/guidef.xml";
createJMenuBar(xmlFile);
/**String configxmlFile = "/metadata/configguidef.xml";
//Parse the xml file that represents the gui menus, toolbars, actions, icons
try
ErrorFactory.getInstance().parse();
GuiFactory.getInstance().setInputSource(xmlFile);
GuiFactory.getInstance().parse();
this.setIconImage(IconFactory.getInstance().getIcon("appicon").getImage());
this.setJMenuBar(createMenuBar());
catch (Exception e)
e.printStackTrace();
// Set the main content panel for all the GUI components
_splash.incrementProgressTo(15, initmqkey);
mainContentJPanel_ = (JPanel) this.getContentPane();
mainContentJPanel_.setLayout(new BorderLayout());
mainContentJPanel_.setSize(new Dimension (800,600));
//Lets create the panels that we need
//Keep track of the height of the toolbar and status so we now the max
//real estate we can use for the actual "guts" display of the application
//ToolBar
_splash.incrementProgressTo(20, toolkey);
//Status Bar
_splash.incrementProgressTo(30, statuskey);
JPanel statusBarPanel = createStatusBar();
iHeight_ += statusBarPanel.getHeight();
/**commandStatPanel = new JPanel();
     commandStatPanel.setLayout(new BoxLayout(commandStatPanel, BoxLayout.Y_AXIS));
          CommandStatsPanel commands = new CommandStatsPanel();
          ApplicationMain.getInstance().setCommandPanel(commands);
String shouldOpen = MQEPreferencesDialog.getPreferenceValue("enable.trace.commands");
          if (shouldOpen != null)
               Boolean traceOn = new Boolean (shouldOpen);
               if (traceOn.booleanValue())
                    AbstractAction action = LandMarkMQActions.getInstance().getActionForName("viewcommand");
                    action.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "enabled"));
                    //splitPane.setBottomComponent(commands);
                    commandStatPanel.add(commands);
          commandStatPanel.add(statusBarPanel);*/
//MainView
_splash.incrementProgressTo(40, mainappkey);
mainViewPanel = new AdminPerspectivePanel();
          perspectiveViewPanel.setLayout(new BorderLayout());
          perspectiveViewPanel.add(mainViewPanel,BorderLayout.CENTER);
          perspectiveButtonBar.setLayout(new BoxLayout(perspectiveButtonBar, BoxLayout.Y_AXIS));
          perspectiveButtonBar.setBorder(BorderFactory.createRaisedBevelBorder());
          JButton adminPerspectiveButton = ComponentFactory.getInstance().createImageButton(IconFactory.getInstance().getIcon("navigator"));
          JButton configPerspectiveButton = ComponentFactory.getInstance().createImageButton(IconFactory.getInstance().getIcon("addicon"));
          JButton monitoringPerspectiveButton = ComponentFactory.getInstance().createImageButton(IconFactory.getInstance().getIcon("staricon"));
          configViewPanel = new ConfigPerspectivePanel();
          perspectiveButtonBar.add(adminPerspectiveButton);
          adminPerspectiveButton.addActionListener(new ActionListener()
               public void actionPerformed (ActionEvent ae)
                    setPerspectivePane(mainViewPanel);
          perspectiveButtonBar.add(configPerspectiveButton);
          configPerspectiveButton.addActionListener(new ActionListener()
               public void actionPerformed (ActionEvent ae)
                    setPerspectivePane(configViewPanel);
          // Done adding perspectiveButtonBar, perspectiveViewPanel and statusBarPanel to content pane
          mainContentJPanel_.add(perspectiveViewPanel, BorderLayout.CENTER);
mainContentJPanel_.add(perspectiveButtonBar, BorderLayout.WEST);
//mainContentJPanel_.add(commandStatPanel, BorderLayout.SOUTH);
mainContentJPanel_.add(statusBarPanel, BorderLayout.SOUTH);
//Launch the application
_splash.incrementProgressTo(100, launchkey);
launch(getAppName(), false) ;
//To get around a swing bug set the locations of the splitpanes here
setSplitDividers();
validate();
//This seems to fix the problem of the details panel split going to the correct location
setSplitDividers();
_splash.closeSplashWindow();
setVisible(true);
public void setPerspectivePane(JPanel panel)
          perspectiveViewPanel.removeAll();
          perspectiveViewPanel.add(panel);
          perspectiveViewPanel.revalidate();
          perspectiveViewPanel.repaint();
public void setSplitDividers()
double dividerLoc = .40;
//The main split pane you want a 90 /10 split
ApplicationMain.getInstance().getTreeDetailSplit().setDividerLocation(dividerLoc);
ApplicationMain.getInstance().getTreeDetailSplit().setResizeWeight (dividerLoc);
dividerLoc = .80;
ApplicationMain.getInstance().getTreeCommandSplit().setResizeWeight (dividerLoc);
ApplicationMain.getInstance().getTreeCommandSplit().setDividerLocation(dividerLoc);
dividerLoc = .50;
ApplicationMain.getInstance().getDetailEventSplit().setResizeWeight (dividerLoc);
ApplicationMain.getInstance().getDetailEventSplit().setDividerLocation(dividerLoc);
((DetailPanel)ApplicationMain.getInstance().getDetailsPanel()).resetTableColumns();
((EventPanel)ApplicationMain.getInstance().getEventPanel()).resetTableColumns();
//((CommandStatsPanel)ApplicationMain.getInstance().getCommandPanel()).resetTableColumns();
public void createJMenuBar(String xmlFile)
          //Parse the xml file that represents the gui menus, toolbars, actions, icons
          try
               ErrorFactory.getInstance().parse();
               GuiFactory.getInstance().setInputSource(xmlFile);
               GuiFactory.getInstance().parse();
               this.setIconImage(IconFactory.getInstance().getIcon("appicon").getImage());
               this.setJMenuBar(createMenuBar());
               validate();
               repaint();
          catch (Exception e)
               e.printStackTrace();
private JPanel createSplashPanel()
String imagekey = StringFactory.getString(imgfnfKey);
JPanel splashPanel = new JPanel(new BorderLayout());
splashPanel.setBackground(Color.white);
JLabel l = null;
ImageIcon img = Utilities.getImage("/images/MQENavigator.jpg");
if (img != null)
l = new JLabel(img);
else
l = new JLabel(imagekey);
l.setBackground(Color.white);
l.setBorder(BorderFactory.createCompoundBorder());
splashPanel.add(l, BorderLayout.CENTER);
splashPanel.setPreferredSize(new Dimension ((int) l.getPreferredSize().getWidth(),
(int) l.getPreferredSize().getHeight()));
return splashPanel;
static public void main (String[] args) throws Exception
MQENavigator landMarkApp = new MQENavigator();
Here in the code there is a setPerspectivePane() when the button are created and the admin and config are two different panels I meant to say.

Similar Messages

  • I cant remember my password to logon to my mac, how can i change it with out needing the old one?

    i cant remember my password to logon to my mac, how can i change it with out needing the old one?

    http://support.apple.com/kb/HT1274

  • HT1349 how can I change an email for authorization, the email address we used years back, is no longer a valid email address

    how can I change an email for authorization, the email address we used years back, is no longer a valid email address

    SfromW wrote: ... how can I change an email for authorization, the email address we used years back, is no longer a valid email address
    How to change account here: http://support.apple.com/kb/PH1641
    If you need more help, start here: http://www.apple.com/support/itunes/
    SfromW wrote: ... we can't remember the password from the old email address (for authorization)...
    Help Retrieving and changing passwords here: http://support.apple.com/kb/HT1911
    If you need more help, from iTunes for Windows, click  iTunes > iTunes Store > Support
    SfromW wrote: ... apple should make it easier to transfer authorization authority....I would think anyways.
    You might want to rethink your thoughts about making transferring authority easier.  Making it too easy would certainly degrade your account's security.  If you still believe it should be easier, you can send feedback directly to Apple via http://www.apple.com/feedback/itunesapp.html
    You will not get a response, but you can be certain that the responsible Apple people will see your input for consideration in FaceTime product development.
    As a new user, please understand that you are NOT directly addressing Apple here.  For more info about Apple discussions, start here: http://discussions.apple.com/static/apple/tutorial/etiquette.html 
    Message was edited by: EZ Jim
    Mac OSX 10.7.4

  • My apple id is different to my icloud id how can i change my icloud id to the same as my apple id

    My apple id is different to my icloud id how can i change my icloud id to the same as my apple id

    Delete the iCloud Account
    I mean Delete Account on your iPad iPhone.

  • HT1766 HOW CAN I CHANGE MY BACKUP FOLDER FROM THE C DRIVE TO ANOTHER?????

    HOW CAN I CHANGE MY BACKUP FOLDER FROM THE C DRIVE TO ANOTHER????? because my c drive in the windows computer gets filled and i need to back up my ipod to a portable hard disk.. bt i dont know how to do it.. plz help

    you can't change the backup folder as far as I know, but you can choose to move backups. The information you need can be found in this article: http://support.apple.com/kb/ht4946
    Where iTunes backups are stored on your computer
    The folder where your backup data are stored varies depending on the computer's operating system.   Make sure the backup folder is included in your periodic data-backup routine.
    iTunes places the backup files in the following places:
    Mac:  ~/Library/Application Support/MobileSync/Backup/
    Windows XP:  \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
    Note: To quickly access the Application Data folder, click Start, and choose Run. Type %appdata% and click OK.
    Windows Vista and Windows 7:  \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
    Note: To quickly access the AppData folder, click Start. In the search bar, type %appdata% and press the Return key.
    Hope this helps
    Regards,
    Stijn

  • How can I change colour or design to the folder icons in Mail ?

    How can I change colour or design to the folder icons in Mail ?

    Apple doesn’t routinely monitor the discussions.
    Send Apple feedback. They won't answer, but at least will know there is a problem. If enough people send feedback, it may get the problem solved sooner.
    Mail/Provide Mail Feedback

  • My ipad is syncing notes to an old phone with a different apple id how can I change it to sync to the new iphone icloud is off and so is home sharing

    my ipad is syncing notes to an old phone with a different apple id how can I change it to sync to the new iphone icloud is off and so is home sharing

    Apps and Music are not from iCloud. Are from iTunes and App Store.
    You can change this from: Settings>iTunes and App Stores>Sign out and sign in with new ID, but you will have to pay again to download apps that you already have in your old account. Or leave it as it is to share purchases with your son.

  • How can I change my apple address from the US to the Philippines to make my credit card work?

    How can I change my apple address from the US to the Philippines to make my credit card work?

    Change App Store
    1. Tap "Settings"
    2. Tap "iTunes & App Stores"
    3.Tap "View Apple ID"
    4. Enter your user name and password.
    5. Tap "Country/Region."
    6. Tap "Change Country/Region"
    7. Select the region where you will be located.
    8. Tap "Done".

  • How can i change my security question on the latest ios?

    how can i change my security question on the latest ios?

    This can be done by clicking here and picking a method, or if your country isn't listed, filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (110138)

  • I have five iPads, four for my classroom and one that is personal. How can I change my Apple ID on the personal iPad and still keep the apps?  Thank you!

    I have five ipad ii products. Four of them I use in my classroom and one is for personal use.  How can I change my apple ID on my personal iPad and keep all of the apps (i.e. Kindle).  I do not want it connected to my school iPads. 

    All app purchases are permanently tied to their Apple ID. You will have to delete and repurchase the apps with a new ID. I would recommend wiping that iPad and setting it up with another ID.
    ~Lyssa

  • My Apple ID is registered in wrong email address. How can i change it or else when the server reply me to check my email that i can't check due to they sent to wrong email address...

    Please give advice of how can i change my Apple ID (email address) as it is wrong address. Like i just update my iPhone to latest version 6.0, and get the new app, iCloud which need me to key in my Apple ID and Password. I have no choice to use the wrong email address as it is already registerd since from 1st day i use my iPhone. Then i received the reply that tell me to check my email for verifing but the problem is i can't check my gmail as they sent to the email is not my actual gmail address....
    How can i solve this problem?

    You may change your Apple ID to any email address that is not already used as another Apple ID, or that is not already associated with another Apple ID.
    In other words, if I have an Apple ID [email protected], and have alternate email addresses of [email protected] and [email protected], none of them may be used by me or anyone else for an Apple ID, Rescue Email, alternate email, or anything Apple-related.
    If the Apple ID link above indicates your email is already in use then it is. Use https://iforgot.apple.com, select Forgot your Apple ID? and provide the information requested. If the email address is one you created and can still access, you may be able to retrieve it. If it is one someone else created, you will not.

  • All my PDF forms are automatically transformed in Word forms,how can I change that and only choose the PDF I want to transform

    All my PDF forms are automatically transformed in word forms,how can I change that and only decide which PDF to be transformed in word

    Hi Ulfsch,
    Thank you for posting on the Adobe Forums, kindly try the step mentioned below.
    1) Right click on any of the PDF file and choose the option open with
    2) Select choose default program
    3) Select Adobe Reader/Acrobat from the list
    5) Check the box "always open this type of file with selected program" (not the exact same wording)
    6) Click OK
    If you are on Mac, CTRL+Click on the file.
    Go to Get info
    Go to Open with
    Change it to Adobe Reader/Acrobat and click change all.
    Thanks,
    Vikrantt Singh

  • How can I change my birth date to the correct one

    My birth date is wrong on my iPad how can I change it to the correct one

    Where are you seeing your date of birth ?
    You can change the birthdate on your iTunes account by logging into your account by clicking the 'manage your Apple id' button on http://appleid.apple.com, selecting the Password And Security section on the left-hand side of your account's screen, and then answering the security questions - you should then get a screen where you can change your date of birth

  • How can I change between different JRE in the Same PC

    I have two systems.A system can only run in JRE 1.3 and B system can only run in JRE 1.5 enviroment.But I have to run both in one desktop(which use WinXP SP2),how can I do it . I tried to edit the system config using the cmd of regedit , edited some like these.But it did not work .Could anybody tell me how to do? Thanks a lot in advantage.
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{08B0E5C0-4FCB-11CF-AAA5-00401C608501}\TreatAs]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8AD9C840-044E-11D1-B3E9-00805F499D93}]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8AD9C840-044E-11D1-B3E9-00805F499D93}\InprocServer32]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\JavaPlugin\CLSID]
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit]CurrentVersion="1.X"
    [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment] CurrentVersion="1.X"
    The information of operation system is omitted.
    Message was edited by:
    daiwill
    Operation System is WinXP SP2
    Message was edited by:
    daiwill

    I found some clues last week in these linkes.
    http://forum.java.sun.com/thread.jspa?threadID=657406&tstart=150
    http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/jcp.html#java
    Which has the contents like the below:
    Example:
    Assume you are running on Microsoft Windows with Microsoft Internet Explorer, have first installed version 1.4.2, then version 5.0, and you want to run 1.4.2.
    Go to the j2re1.4.2\bin directory where JRE 1.4.2 was installed. On a Windows default installation, this would be here: C:\Program Files\Java\j2re1.4.2\bin
    Double-click the jpicpl32.exe file located there. It will launch the control panel for 1.4.2.
    Select the Browser tab. Microsoft Internet Explorer might still appear to be set (checked). However, when 5.0 was installed, the registration of the 1.4.2 JRE with Internet Explorer was overwritten by the 5.0 JRE.
    If Microsoft Internet Explorer is shown as checked, uncheck it and click Apply. You will see a confirmation dialog stating that browser settings have changed.
    Check Microsoft Internet Explorer and click Apply. You should see a confirmation dialog.
    Restart the browser. It should now use the 1.4.2 JRE for conventional APPLET tags.
    I tried the method of change the control panel but they did not work either.
    Any other helps?
    Thanks in advantage.
    Message was edited by:
    daiwill

  • How can I change and pause songs on the locked itouch with the iOS 7 update?

    With the previous update I used to be able to pause and play songs or change songs when the itouch was locked but I can't with the new update. How am I able to?

    Go to Settings>Control Center. Is Access on Lock Screen Turned on? When on, just pull up the Conrol Center from the lock screen

Maybe you are looking for