ActionListener in other package change menuItem

hiya,
I have a class MenuBuild and within i specify ActionListeners to the items.
now when i receive an action it goes to the set Listener, now from the Listener i want to be able to change an item in the menu.
the two files are both in a diffrent package but i dont think that should be a problem at all.
when i try to get an int from the menu ( menu.getItem() )
it returns a NullPointerException.
while i already create this menu.
is there anyway i can retreive this info?
thnx in advance
public class MenuBuild {
     public JMenuBar bar = new JMenuBar();
     public JMenuItem item;
     public JMenu menu;
     HelpMe help;
     AboutMe about;
     FormBuild frame;     
     public JMenuBar menuBouw(String menu1[], String menu2[], String[] menu3) {
          menu = new JMenu(menu1[0]);
          for (int i = 1; i < menu1.length; i++) {
               if (menu1[i] == "Seperator") {
                    menu.addSeparator();
               else {
                    item = new JMenuItem(menu1);
                    item.addActionListener(new BestandMenuListener());
                    menu.add(item);
          bar.add(menu);
          menu = new JMenu(menu2[0]);          
          for (int i = 1; i < menu2.length; i++) {
               if (menu2[i] == "Seperator") {
                    menu.addSeparator();
               else {
                    item = new JMenuItem(menu2[i]);
                    item.addActionListener(new ExtraMenuListener());
                    menu.add(item);
          bar.add(menu);     
          return bar;
public class ExtraMenuListener implements ActionListener {
     MenuBuild menuCall;
     HelpMe help;
     AboutMe about;
     public void actionPerformed (ActionEvent e) {
          menuCall = new MenuBuild();
          if (e.getActionCommand() == "Wetenschappelijk") {
          System.out.println(menuCall.menu.getItemCount());     
          if (e.getActionCommand() == "Simpel") {
          if (e.getActionCommand() == "Help") {
               help = new HelpMe();
               help.help();
          if (e.getActionCommand() == "About...") {
               about = new AboutMe();
               about.about();

import nl.rekenmachine.gui.forms.FormBuild;
import nl.rekenmachine.gui.forms.MenuBuild;
class RekenMachine_v3 {
     FormBuild frame;
     MenuBuild menu;
     String[] menu1;
     String[] menu2;
     public static void main (String args[]) {
          new RekenMachine_v3();
     public RekenMachine_v3() {
          String menu1[]={"Bestand", "Nieuw", "Openen", "Opslaan", "Afsluiten"};
          String menu2[]={"Extra", "Wetenschappelijk", "Help", "Seperator", "About..."};
frame = new FormBuild();
frame.BuildFrame("RekenMachine", 300, 300, 50, 50, menu1, menu2);               
package nl.rekenmachine.gui.forms;
import javax.swing.JFrame;
public class FormBuild extends JFrame {
     private static final long serialVersionUID = -2092267704264962405L;
     JFrame frame;
     JFrame frame2;
     JFrame frame3;
     MenuBuild menu;
     public JFrame BuildFrame(String titel, int breedte , int hoogte, int x, int y, String[] menu1, String[] menu2) {
          menu = new MenuBuild();
          frame = new JFrame();
          frame.setJMenuBar(menu.menuBouw(menu1, menu2));          
          frame.setTitle(titel);
          frame.setSize(breedte, hoogte);
          frame.setLocation(x, y);
          frame.setName(titel);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setVisible(true);          
          return frame;
     public JFrame BuildFrameNoMenu(String titel, int breedte, int hoogte, int x, int y, String image ) {
          frame2 = new JFrame();
          frame2.setTitle(titel);
          frame2.setSize(breedte, hoogte);
          frame2.setLocation(x, y);
          frame2.setName(titel);
          frame2.setVisible(true);          
          return frame2;
package nl.rekenmachine.gui.forms;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import nl.rekenmachine.gui.listeners.BestandMenuListener;
import nl.rekenmachine.gui.listeners.ExtraMenuListener;
public class MenuBuild {
     public JMenuBar bar = new JMenuBar();
     public JMenuItem item;
     public JMenu menu;
     public JMenuBar menuBouw(String menu1[], String menu2[]) {
          menu = new JMenu(menu1[0]);
          for (int i = 1; i < menu1.length; i++) {
               if (menu1.equals("Seperator")) {
                    menu.addSeparator();
               else {
                    item = new JMenuItem(menu1[i]);
                    item.addActionListener(new BestandMenuListener());
                    menu.add(item);
          bar.add(menu);
          menu = new JMenu(menu2[0]);          
          for (int i = 1; i < menu2.length; i++) {
               if (menu2[i].equals("Seperator")) {
                    menu.addSeparator();
               else {
                    item = new JMenuItem(menu2[i]);
                    item.addActionListener(new ExtraMenuListener());
                    menu.add(item);
          bar.add(menu);     
          return bar;
package nl.rekenmachine.gui.listeners;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import nl.rekenmachine.gui.forms.MenuBuild;
public class ExtraMenuListener implements ActionListener {
     MenuBuild menuCall;
     public void actionPerformed (ActionEvent e) {
          menuCall = new MenuBuild();
          if (e.getActionCommand().equals("Wetenschappelijk")) {
               System.out.println(menuCall.menu.getItemCount());               
          if (e.getActionCommand().equals("Simpel")) {
          if (e.getActionCommand().equals("Help")) {
          if (e.getActionCommand().equals("About...")) {

Similar Messages

  • Moving business components to other packages

    We have a bc4j/jclient application which needs to be "cleaned up" a bit. There are lots of Entity Objects, View Objects, Associations and View Links which should be packaged in a better way. Unfortunately, there's is no function within JDeveloper to move business components to other packages.
    Deleting the old objects and creating the same in the destination package would be a long procedure with the possibility of getting many errors. Copying the sources (.java and .xml) to a the new packages and replacing only the package statements won't work, I suppose, because of the several dependencies (move VOs from one source package to two destination packages, e.g.).
    Could someone tell me the best way to do that?
    Best regards,
    Torsten.

    There is no support for package renaming in JDeveloper (that I know of). My approach would be search and replace the source and change the place where the package name is mentioned to the new name. As you indicated you'll have to be careful to not do this globally since some reference to viewobjects may be moving to separate packages. You should look at the sources to determine whether or not global search and replace would be possible.
    One other point is that the <package>.xml file contains the list of all the components in that package. You'll need to keep that in sync as well.

  • How do I move objects from other package to a newly created one?

    How do I move objects from other package to a newly created one?
    Thanks!

    Dear Anthony Pham ,
    for changing objects from one package to another package
    open that object for example Report
    open the report and than click GOTO select OBJECT DIRECTIORY ENTRY
    than it will open a popup in that popup click the change and give the new package
    Thanks
    Surendra

  • Loading fails, when classes from other packages are referenced

    My applet follows a simple package structure.
    There's package P1 and there's another package in it P2 (P1.P2)
    P1 contains Applet class A.
    P2 contains another class C and interface I. C implements I.
    A contains a reference of C, which is initialized in the constructor. The use in the constructor of the A (the applet) is something like this
    public A () {
              reg = ToolkitRegistry.getEntry (); //where reg is a reference of type ToolkitRegistry.
              // some more code
              i = (I) C.getC (); //where i is a reference of type I.
    }Trying to load this applet throws error saying "Package Loading failed". Important is to note that the loading occurs successfully by commenting out this line           i = (I) C.getC (); //where i is a reference of type I. , without any other change.
    I understood this to be some problem with the AIDs assigned to both the packages while converting. Unsure of what's the correct way to assign the PIX values, I've been trying some permutation/combinations, it doesn't seem to work.
    Has neone already faced this problem & knows the solution? (The specs aren't much help)

    One more point ..... I mentioned commenting the statements, I DO NOT commment the other statements referencing the other package. This means that the loading IS succesfull, even when these two lines reside in there.
    1. import P1.P2.*; 2. private I i = null;Above two lines pass the loader. The object creation gets stuck.
    Wonder if the package references are actually alright, because JVM wud've treated both situations in a similar way. JCVM is ofcourse different but JCVM spec does not say nething abt this situation (rem: everything is public, so the access control restrictions also do not apply)
    are there ne instantiation restrictions? [In my case, it's in the constructor thread)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Package Change

    Hi
    i have created layoutset but i want change the package name(from one package to other package but not local object)
    thanks in advance

    hi
    use report
    RSWBO052
    to change package of scripts
    This program can be used to edit the package and the persons responsible in the object directory:
    On the selection screen, you can restrict the object set according to various criteria:
    Object type and object name
    Development class
    Person responsible
    Original system
    Package
    Generation flag
    Original language
    Objects with repair flag
    If you do not make any restrictions on object type and object name, then the selection will be made according to all object types and object names.
    regards
    Nagesh.Paruchuri
    Edited by: Paruchuri Nage$h on May 26, 2010 12:22 PM

  • The Firefox window doesn't open at all I can't run safe mode or make other trubleshot changes

    since yesterday 08/10/2011 the Firefox window doesn't open at all I can't run safe mode or make other trubleshot changes. When I click on the desktop short-cut the Firefox windows starts loading but before open is crushing.I have sent several messages to you but no answer and my Firfox is not working.

    Which version of Firefox and which OS are you using?
    There are other ways of opening safe mode given at http://kb.mozillazine.org/Safe_Mode - See if that helps.

  • Where to see the images other than change log table

    Dear all,
                   How to view images for extraction's (example Generic )  in  DSO without using Change log table.
    With Regards,
    Baskaran

    Hi,
    There is no other option other than change log table to view the images.
    in PSA..we will get only raw data..i.e...its non other than the data how its posted in source sytem.we can say..this is only copy of source sytem data.
    after PSA,if the datasource is DELTA enabled(which can sustain NEW or CHANGED records-here only we get concept of IMAGES),we have to load this data only to DSO.from there after activation of the data,the data can be updated to further data targets only from CHANGE LOG table which can maintain images.
    Even further targets are also DSOs,we will have to load from this DSO only.so we can see images only in change log table.
    hope this is clear for you.
    Regards
    Ramsunder

  • How to prevent BGP code 6 (Cease) subcode 6 (Other Configuration Change)

    Can anyone tell How to prevent BGP code 6 (Cease) subcode 6 (Other Configuration Change) ?
    We are facing frequent problem with this error. Please suggest how to stop this.... 
    Note :- We are using BGP VPN between this peers.
    Logs :
    Date/Time     : 2015-04-30 00:49:40+05:30
     State         : Up
     Date/Time     : 2015-04-30 00:39:05+05:30
     State         : Down
     Error Code    : 6(CEASE)
     Error Subcode : 6(Other Configuration Change)
     Notification  : Send Notification
     Date/Time     : 2015-04-29 18:22:11+05:30
     State         : Up
     Date/Time     : 2015-04-29 18:21:39+05:30
     State         : Down
     Error Code    : 6(CEASE)
     Error Subcode : 6(Other Configuration Change)
     Notification  : Send Notification

    on the same dates you mean the same request are posted in IT2001? ie both full days?
    Please clarify
    usually the Time collision checks are followed only via posting using report rptarqpost and not while applying through portal in ESS
    This is very strange you indicate
    SO you need to check the basic tables first
    You may need to check the collision.
    Collisions Tables V_T554Y and V_554Y_B reaction indicators.
    and V_T508A
    able T582A set to time constraint of "Z
    In backend Pa30 collision works like this
    1) the logical collision, checks if there is an overlap in the validity
    interval of the IT´s (begda, endda).
    2) the physical collision, checks if there is an overlap in the time
    interval of the IT's.
    In the logical collision it is checked if there is an overlap in the
    validity interval if at least one of the records is a full-day
    ( that is the case when you enter a Daily Work Schedule (DWS) )
    So when one of the records has a DWS it is considered to be a full day
    record and the logical collision is taken into consideration.
    If instead you enter the only the time interval manually the records
    are considered to be partial-day and the physical collision is
    performed. In that case only the time interval is important.
    So if the clock times are not entered the physical collision can not
    take place.
    The collision functionality is always based on clock times and dates,
    never on the total nr of hours.
    Edited by: Siddharth Rajora on Sep 21, 2011 4:57 PM

  • Primarily using the ipad air as an art portfolio but photos i upload in order get rearranged. other than changing the date they were shot, is there any solution to this? can they be reorganized in iphoto on the ipad?

    primarily using the ipad air as an art portfolio but photos i upload in order get rearranged. other than changing the date they were shot, is there any solution to this? can they be reorganized in iphoto on the ipad?

    You are welcome.
    Sorting and organizing photos on IOS devices is one of the things that really need to be improved. It looks like the developers simply did not expect the users to want to keep large photo libraries on an IOS device, where the ordering would matter. I'd send feedback to the developer team, so that they see, what the users want and need:
    You can use this form:  Apple - iPhoto - Feedback

  • How to use loadjava tool to regard file in other packages/JARs?

    How do I have to set the options for the loadjava tool when I have a Java class that uses classes of another package/JAR (which I have developed by myself). I thought it was just to create a JAR containing my Java class as well as the JARs containing the other packages/classes being imported in my Java class. and then:
    loadjava -u user/passwd@hostname:1521:xxx -v -r C:\Temp\MyJAR.jar
    but I always get
    cannot find symbol    :    class MissingClass

    This is the wrong forum!
    1. Repost the question in the Database JVM forum
    Java in the Oracle Database
    2. Edit this thread and post the link to the new one and direct people to follow up there
    3. Mark this thread ANSWERED so people will follow up in the other forum.
    When you post there provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION) and review Chapter 11 Schema Objects and Oracle JVM Utilities in the Java Developers Guide
    http://docs.oracle.com/cd/B28359_01/java.111/b31225/cheleven.htm#CACFHDJE
    see '-recursivejars' in the Argument Summary section.
    >
    -recursivejars
    Normally, if the loadjava tool encounters an entry in a JAR with a .jar extension, it will load the entry as a resource. If this option is specified, then the loadjava tool will process contained JAR files as if they were top-level JAR files. That is, it will read their entries and load classes, sources, and resources.

  • How to Show All Packages, That are not required by any other package

    I need a way to see al the installed packages thar are not required by any other package
    Thanks in advance ...

    You probably want pacman -Qt or pacman -Qdt
    Check out man pacman.

  • BUG: Changing "alpha" with AS breaks other property changes on timeline

    I've discovered a bug in AS3 where a Movie Clip that spans 2 different frames, but its properties are different in each frame (i.e. it has been repositioned on the 2nd frame but the instance name is the same), and the MC's alpha is changed using ActionScript prior to moving the timeline from one frame to the other, the timeline moves, but the MC does NOT actually move.
    I'm experiencing this error in a professional project that I'm working on so I cannot post the actual FLA, but here is a little mock up that I made:
    stop()
    currentFrameTxt.text = currentLabel
    var alphaChange:Number = .1
    var alphaMax:Number = 1
    var alphaMin:Number = 0
    alphaUpBtn.addEventListener(MouseEvent.CLICK, alphaUp)
    function alphaUp(evt:MouseEvent) {
        box.alpha += alphaChange
        if (box.alpha > alphaMax) {
            box.alpha = alphaMax
    alphaDownBtn.addEventListener(MouseEvent.CLICK, alphaDown)
    function alphaDown(evt:MouseEvent) {
        box.alpha -= alphaChange
        if (box.alpha < alphaMin) {
            box.alpha = alphaMin
    leftBtn.addEventListener(MouseEvent.CLICK, gotoLeft)
    function gotoLeft(evt:MouseEvent) {
        if (currentLabel != "left") {
            gotoAndStop("left")
        currentFrameTxt.text = currentLabel
    rightBtn.addEventListener(MouseEvent.CLICK, gotoRight)
    function gotoRight(evt:MouseEvent) {
        if (currentLabel != "right") {
            gotoAndStop("right")
        currentFrameTxt.text = currentLabel
    On Frame 1 (labeled "left") is an MC with the instance name "box" and the box's position is on the left side of the stage. On Frame 11 (labeled "right") is the same instance "box", but its position has been moved to the right side of the stage.
    I have a pair of buttons ('leftBtn" and "rightBtn") that toggle the timeline between the "left" frame and the "right" frame.
    I also have a pair of buttons ("alphaUpBtn" and "alphaDownBtn") that change the box's "alpha" property.
    If you click "leftBtn" or "rightBtn" before you click the "alphaUp" or "alphaDown" buttons, the box moves left or right as one would expect. BUT if you click either "alphaUpBtn" or "alphaDownBtn", the box does NOT move if you then click "leftBtn" or "rightBtn" even though the timeline is indeed moving (which I am confirming using the "currentFrameTxt" dynamic text box).
    I have tried this example by changing other properties on the 2 frames and they too stop working once you change the "alpha" using AS. I have also tried change other propeties using AS, but alpha is the only property to breaks the other properties changed by moving the timeline.
    Why would changing the "alpha" property suddenly break all other property changes on the timeline?
    Now I know that one work-around for this bug is to simply change the box's position dynamically by setting the x and y positions, but this is NOT an option for this project because it is very important that the client be able to manually position the artwork on each frame by hand.
    This is a serious bug and I'm wondering if anyone else has encountered it before and if they know of a viable workaround.

    I did some more testing by changing other properties of the box with AS and it appears that for most properties, like alpha, x, y, rotation, width, height, etc, if they are changed with AS, then the properties of the MC can no longer be changed by the timeline settings. Changing the "visible" property has no effect, however.
    It seems that this "bug" is not really bug so much as it is a fundamental misunderstanding on my part about the fact that you CANNOT change the properties of a symbol using BOTH ActionScript and timeline properties. I can only change the properties of using either the timeline OR ActionScript because as soon as I change the properties using AS, the MC becomes an AS-controlled object and can no longer be controlled via the timeline. I guess that makes sense, but it is frustrating nonetheless.
    Colin, your suggestion to nest the MC inside another MC is indeed a successful workaround, at least for this little box example (see fixed FLA attached with the "left" and "right" timeline property changes nested inside the box itself) and I will see if it is a viable solution for my actual application. I'm guessing it will not be a problem for my client to simply navigate inside a parent MC in order to adjust the positions of the now-nested MC in question.
    Thanks for the help.

  • Question about access non-public class from other package.

    Hi, everyone!
    Suppose class A and class B are in the same java file of package pkg1
    -- A.java. So, A is a public class and B is a non-public class.
    If I want to access class B from another class class C and class
    C is in package pkg2. When compiling, an error occurs indicating
    that class B is not visible to class C.
    So, If I defined serveral classes in one java file and I want to
    access every class from other package. How should I do?
    (I think in one java file, there should be only one public class and
    only the public class can be accessed from other package.)
    Thanks in advance,
    George

    So, If I defined serveral classes in one java file and
    I want to
    access every class from other package. How should I
    do? As you already seem to know, there is at most one public class allowed per source file (at least, with javac and most popular compilers). So if you want more than one public class, you will need to use more than one file...

  • Can you duplicate spreadsheets so that if you edit one, the other will change accordingly?

    Can you duplicate spreadsheets on numbers 3.2.2 so that if you edit one, the other will change accordingly? I am trying to edit one spreadsheet and use filters to change the different views in the other spreadsheets.

    Hi Jono,
    Your target cell and your base cell need to have the same address. Start with A1 for both. A variation of the formula needs to be in every cell of the second table. Fill down and to the right. You will see your target table appear.
    quinn

  • Is there and app that does the following. Multiple apps are showing a clock in different rooms, all are synced together, one ipad is a master ipad and if you change the time on it all other ipads change the time

    Is there and app that does the following. Multiple apps are showing a clock in different rooms, all are synced together, one ipad is a master ipad and if you change the time on it all other ipads change the time

    None of the spreadsheet apps that work with Excel files offer anything like full native support in iOS.  Apple's own Numbers app pairs down features for the iOS version.  The hardware is simply not up to what a true computer is capable of, so all apps like QuickOffice, DocumentsToGo, Numbers and so forth offer reduced features from their computer-version counterparts.
    I think a custom app will be your only real choice, be it a fully standalone app, or something built in filemaker or some other db-based platform.

Maybe you are looking for

  • Facebook notifications on ipad not working

    facebook notifications on ipad not working or displaying on ipad notifications. They are displaying on the iPhone though. Is this normal behavior or perhaps I have missed something.? Please let me know Thank you

  • Access NAST table immediately after creation of sales order (va01)

    Hi All, I want to access the nast data for the newly created sales order from va01. I tried to use program exits: userexit_save_document and userexit_save_documnr_prepare and plu the BADI BADI_SD_V46H0001 method EXIT_SAPLV46H_003. the breakpoint is n

  • Photoshop Elements 12 Editor crash on launch

    This is a new (3 month old PC) with Photoshop Elements 12 loaded (installed when PC was new).  It has run without any issues until the last week when it has started to fail to launch.  The PC is running Windows 7 - 64 bit.  Crash Report: Problem sign

  • No multimedia with Acrobat Reader 9

    I have lots of .pdf slideshows (created using Phtoshop Album 2.0), they have embedded mp3 files in them. They played perfectly well with Reader 8.0, however now that I've upgraded to 9.0 they mp3 audio cannot be heard. How do I get the multimedia.api

  • Need help with OS10.8

    I just "successfully " installed Mountain Lion on my 13" MacBook late 2009. At least I thought it was successfully installed.  But now, every few seconds the screen "brightens" and then it restarts. I can not open anything on my computer.  Has anyone