Accessing a different class using ActionPerformed

hi
im trying to access a method in a different class using
public void actionPerformed (ActionEvent e) {
          if(e.getSource() == AuthorCombo) {
               ComboAction();
          else if(e.getSource() == SearchButton){
                    SearchSystem();
}and then using
public class Book extends ViewPanel{
public void SearchSystem(){// this is used to get the information from
                  //the combo boxs whixh can latter show
                  //the data in the text area
tempBookNoList.clear();
          for(int a=0; a<AuthorList.size(); a++) {
                              if(((String)AuthorCombo.getSelectedItem()
                              ==AuthorList.get(a))
                              &&((String)BookCombo.getSelectedItem()
                              ==BookList.get(a))) {
                                   tempBookNoList.add((String)BookNoList.get(a));
                    String result = (String)tempBookNoList.get(a);
                    InfoArea.setText ((String)tempBookNoList.get(a));
}          }//End neither random situation.to manipulate some data within the other class
i keep getting the error
.\ViewPanel.java:314: cannot resolve symbol
symbol : method SearchSystem ()
location: class ViewPanel
                    SearchSystem();
^
1 error
can anyone help me spot the problem

in that case i do not know what could be the cause in this program
the only area i think it could be is when the SearchSystem method in the Book class gets using the Action Performed method in the Viewpanel method, shown below
public class Book extends ViewPanel{
public void SearchSystem(){// this is used to get the information from
                  //the combo boxs whixh can latter show
                  //the data in the text area
          for(int a=0; a<AuthorList.size(); a++) {
                              if(((String)AuthorCombo.getSelectedItem()
                              ==AuthorList.get(a))
                              &&((String)BookCombo.getSelectedItem()
                              ==BookList.get(a))) {
                              InfoArea.setText((String)BookNoList.get(a));
               }which is called using
public void actionPerformed (ActionEvent e) {
          if(e.getSource() == AuthorCombo) {
               ComboAction();
          else if(e.getSource() == SearchButton){
                    theBook.SearchSystem();
}but i cant see this being a problem as it all compiles

Similar Messages

  • How to Execute different classes using editplus

    Consider a program like this
    class abc
    public static void main(String args[])
    System.out.println("abc");
    class bbc
    public static void main(String args[])
    System.out.println("bbc");
    In this program there are two classes when i compile this code in editplus i wont get any error but if i want to execute only ABC class how to do that in editplus because in editplus we usually set the file name for JAVA execution
    But here it is different SO,how to execute different classes in a program which is saved with arbitary name in EDIT PLUS..

    Try reading an editplus FAQ or posting to an editplus forum or even searching through help in editplus.

  • How to use the different class for each screen as well as function.

    Hi Experts,
    How to use the different class for each screen as well as function.
    With BestRegards,
    M.Thippa Reddy.

    Hi ThippaReddy,
    see this sample code
    Public Class ClsMenInBlack
    #Region "Declarations"
        'Class objects
        'UI and Di objects
        Dim objForm As SAPbouiCOM.Form
        'Variables
        Dim strQuery As String
    #End Region
    #Region "Methods"
        Private Function GeRate() As Double
                Return Double
        End Function
    #End Region
    Public Sub SBO_Appln_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean)
            If pVal.BeforeAction = True Then
                If pVal.MenuUID = "ENV_Menu_MIB" Then
                End If
            Else ' Before Action False
                End If
        End Sub
    #End Region
    End Class
    End Class
    Rgds
    Micheal
    Vasu Anna Regional Feeling a???? Just Kidding
    Edited by: micheal willis on Jul 27, 2009 5:49 PM
    Edited by: micheal willis on Jul 27, 2009 5:50 PM

  • How to access form objects from different class?

    Hello, I am new to java and i started with netbeans 6 beta,
    when i create java form application from template i get 2 classes one ends with APP and one with VIEW,
    i put for example jTextField1 with the form designer to the form and i can manipulate it's contents easily from within it's class (let's say it is MyAppView).
    Question>
    How can i access jTextField1 value from different class that i created in the same project?
    please help. and sorry for such newbie question.
    Thanks Mike

    hmm now it says
    non static variable jTree1 can not be referenced from static context
    My code in ClasWithFormObjects is
    public static void setTreeModel (DefaultMutableTreeNode treemodel){
    jTree1.setModel(new DefaultTreeModel(treemodel));
    and in Class2 it is
    ClasWithFormObjects.setTreeModel(model);

  • How to access private method of an inner class using reflection.

    Can somebody tell me that how can i access private method of an inner class using reflection.
    There is a scenario like
    class A
    class B
    private fun() {
    now i want to use method fun() of an inner class inside third class i.e "class c".
    Can i use reflection in someway to access this private method fun() in class c.

    I suppose for unit tests, there could be cases when you need to access private methods that you don't want your real code to access.
    Reflection with inner classes can be tricky. I tried getting the constructor, but it kept failing until I saw that even though the default constructor is a no-arg, for inner classes that aren't static, apparently the constructor for the inner class itself takes an instance of the outer class as a param.
    So here's what it looks like:
            //list of inner classes, if any
            Class[] classlist = A.class.getDeclaredClasses();
            A outer = new A();
            try {
                for (int i =0; i < classlist.length; i++){
                    if (! classlist.getSimpleName().equals("B")){
    //skip other classes
    continue;
    //this is what I mention above.
    Constructor constr = classlist[i].getDeclaredConstructor(A.class);
    constr.setAccessible(true);
    Object inner = constr.newInstance(outer);
    Method meth = classlist[i].getDeclaredMethod("testMethod");
    meth.setAccessible(true);
    //the actual method call
    meth.invoke(inner);
    } catch (Exception e) {
    throw new RuntimeException(e);
    Good luck, and if you find yourself relying on this too much, it might mean a code redesign.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to use javasetters and getters in different classes

    how to use setters and getters in different class so that the setvalue in one class is effect in second class for getting

    If i got your question right,
    make sure your classes are in the same package
    make sure your getters are public/protected
    make sure your code calls the setter before calling the getter
    Kind regards

  • Accessing Java Class using JNDI

    Hi,
    I am looking for a way for accessing a java class (non-ejb) and invoking a method in it using JNDI.
    Thanks

    See if the follwing helps u
    1).implement Referencable interface for your java class. Implement serialize interface also.
    2).Referencable interface has a methd referencable() which will be invoked by JNDI naming system when a lookup is made by client.
    3) in referencable method create a Refrence object.(Reference is a api class).This Reference object can be created to contain a lot of info about the remote obj u have registered. In that u can say the class that be used to create your client side stub.
    4).now when client does a lookup, jndi creates a stub using Reference object and sends it to client.
    5)the methods now u call gets passed on to actual machine running ur remote object

  • Using Buffered Writer In Different Classes

    Hi,
    I have 4 different classes in my program. Although the three object defining classes have accessor methods, I use print functions designed within them. I'm wondering if it is at all possible to use a single buffered reader to use all of the classes. Thanks for the help.

    Possible, yes.Wow that doesn't sound reassuring haha..
    Well I decided to stop being lazy and recreated the print function as a writing function using the accessors, but now I'm having an issue between methods. Is it possible to use the same bufferedreader easily[i] between different methods?

  • Plz tell me about  different types of derived classes used in Java program

    i wan't to learn about different types of derived classes used in Java programming

    cool down bro i am new here i don't how it works
    here.well i will try to be specific frm now on. thank
    anywaysIt's not about "how things work here". The same is true for anything in life. How do you expect anyone to give you an answer when you cannot give a clear description.
    You: "My car sorta ya know don't work. Canya sorta ya know fix it"
    Mechanic:"WTF?"

  • How can I Access the Flash "Slide class" using flex and ActionScript 3?

    Hi,
    I hope someone can help me solve a problem...
    I'm using the flex SwfLoader to load a flash side
    presentation as follows...
    <mx:SWFLoader id="ss_slides" source="ss_slides.swf"
    width="320" height="240"/>
    I would like to access the flash "Slide Class" using flex so
    I can make the following call...
    Slide.gotoNextSlide();
    Anyone know how I can do that?
    Would it be through the SwfLoader Object?
    Is there another way?
    F.Y.I. Here is a snippets about the Slide class from the
    Flash 8 help...
    Using the Slide class (Flash Professional only)
    You use the methods and properties of the Slide class to
    control slide
    presentations you create using the Screen Outline pane for a
    Flash Slide
    Presentation, to get information about a slide presentation
    (for example, to
    determine the number of child slides contained by parent
    slide), or to navigate
    between slides in a slide presentation (for example, to
    create "Next slide" and
    "Previous slide" buttons).
    You can also use the built-in behaviors that are available
    in the Behaviors
    panel to control slide presentations. For more information,
    see Adding controls
    to screens using behaviors (Flash Professional only) in Using
    Flash.
    Thanks,
    Chris S.

    Hi Chris,
    You cannot access the methods of the Flash 8 movie from Flex.
    And you can't do it the other way around either.
    The only way to communicate is to create a LocalConnection on
    each side.
    M.

  • Reference product use a different class

    Hi
      I face  a inbound error queue in R/3 system :Reference product use a different class. What does it mean? I have checked the
    classification in apo in product. The value in  Reference Product (Loc.-Indep.) is 100_SER.  The value in CDP Class is
    CL_100_SER. BUt in R/3 the value in Cross-plant CM is 101_SER. Is it because this reason? I don't know the relationship
    between these fields. Could you please help expalin ? Thank you very much in advance.

    Hi,
    In R/3 there are two feilds  one is cross plant configurable material in basic data 2 veiw. This will appear in APO location independent reference material.
    In MRP3 there is plant specific configurable material which will appear in APO as location dependent configurable material.
    Genrally these both feilds will have same value.
    Secondly Z these feilds need to be assigned material post material is transfered to APO.
    Can you give some more details to help you.
    Like what is class type assigned in ECC?
    Regards,
    SANTOSH

  • How do I access a gui component in a different class?

    I have a jpanel (mainwindow) in a japplet. mainwindow loads and displays a jpanel form (content1). How do I code a button on conent1 so that mainwindow loads and displays a different jpanel form(content2)? mainwindow, content1, and content2 are all in different classes/packages. Thanks in advance!

    Let your JPanel content1 forward its ActionEvents to its parent. For instance, you could define your content1 as follows:
    public class Content1 extends JPanel
        private ArrayList<ActionListener> actionListeners;
        private JButton myButton;
              public Content1()
             actionListeners = new ArrayList<ActionListener>();
             myButton = new JButton("Test");
             myButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                             forwardAction(e);
              public void addActionListener(ActionListener listener) {
             actionListeners.add(listener);
        protected void forwardAction(ActionEvent e) {
          for (ActionListener l: actionListeners) {
               l.actionPerformed(e);
    }Then you could let your mainWindow listen to content1:
    // in your main windows' code:
    Content1 content1 = new Content1();
    content1.addActionListener(new ActionListener() {
         public void actionPerformed(ActionEvent e) {
              swapPane(e);    // create a method swapPane in your mainwindow that handles the switch to content2.
    });

  • While running my app I get the below error  - have different Class objects for the type javax/servlet/http/HttpServletRequest used in the signature

    I am running ATG[10.1.2] app on Jboss [EAP 5.1.0 GA] I am able to open dyn/admin however when I start my app I get the below error
    java.lang.LinkageError: loader constraint violation: when resolving method "atg.servlet.ServletUtil.setSessionConfNumCacheRequest(Ljavax/servlet/http/HttpServletRequest;)Ljavax/servlet/http/HttpServletRequest;" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, atg/filter/dspjsp/PageFilter, and the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) for resolved class, atg/servlet/ServletUtil, have different Class objects for the type javax/servlet/http/HttpServletRequest used in the signature
      at atg.filter.dspjsp.PageFilter.doFilter(PageFilter.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at atg.servlet.ForwardFilter.doFilter(ForwardFilter.java:263)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at atg.servlet.ErrorFilter.doFilter(ErrorFilter.java:279)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:446)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:310)
      at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:416)
      at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:342)
      at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:286)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
      at java.lang.Thread.run(Thread.java:680)
    11:22:47,413 ERROR [[localhost]] Exception Processing ErrorPage[errorCode=500, location=/global/errorPage500.jsp]

    The supported JBoss version for 10.1.2 is JBoss EAP 5.1.2 but I don't think that your issue is caused because of this. Your issue is more of an environmental thing as you are probably getting two different versions getting loaded of class javax.servlet.http.HttpServletRequest and so correspondingly two different Class objects as the error shows. One reason for this could be if you include any server-specific libraries (in present case the Servlet API JAR which contains the class javax.servlet.http.HttpServletRequest) of a different version in the /WEB-INF/lib of your web application. Try removing it from there if so and see if that helps.

  • How to access the Swing Conponents in different Classes

    Hi
    In swing based application, Parent Frame filled with multiple Panels, for each panel i created separate class and added the required swing component.
    components in one panel class require to update/modify components in another panel class.
    For solving this problem i made the components & required methods in a class as STATIC and directly access from another class.
    Is it right approach?
    is there any other approach to solve this issue?
    Thanks
    nidhi

    knidhi wrote:
    Hi
    In swing based application, Parent Frame filled with multiple Panels, for each panel i created separate class and added the required swing component.
    components in one panel class require to update/modify components in another panel class.
    For solving this problem i made the components & required methods in a class as STATIC and directly access from another class.
    Is it right approach? No.
    is there any other approach to solve this issue?Yes. Learn about the MVC design pattern.
    You already implemented the V(iew)-part.
    Now you have to create a M(odel) to hold the Information you want to manipulate and display and a C(ontroller) that changes this information upon the user input (could be combined...)
    Usually the display components register themselves as Listeners to the model and the model publishes state changes to who ever has been registered...
    bye
    TPD

  • Cannot access Graphics - bad class file

    Hey.
    When I try to compile my source I get an error saying...
    .\Man.java:146: cannot access Graphics
    bad class file: .\Graphics.java
    file does not contain class Graphics
    Please remove the files or make sure it appears in the correct subdirectory.
    It's on a different computer so that's not exactly it, but it's close enough. Compiler was working fine until the other day when i found out that all the source files were zipped up in src.zip, I had to extract Graphics.java so I could open it in emacs, and after I did that it started giving me that error message. There's nothhing wrong with my source, and I didn't move Graphics, it's still in the correct place exactly as it was, and i looked at it, all the right stuff is still inside. I'm quite confused.
    So do I have to reinstall? That would mean a massive download on my 56k and I kinda wanna carry on with my work.

    You should not need to unzip src.zip to use the Graphics class or any class that comes with j2sdk. The compiled classes are in jar files that are installed in certain directories when you install the j2sdk.
    You should only need to have a line "import java.awt.Graphics;" near the start of your source code.
    The error most likely occurred when the compiler found a Graphics.class file but inside the file is java.awt.Graphics class, not a plain Graphics class.

Maybe you are looking for

  • Acrobat 8.1 and C# - How can you detect password protected PDF files?

    I am modifying our existing C# code that opens PDF files.  But when ever we hit a password protected file, we are prompted for a password.  This is an automated process, so if we detect a password protected file, we move the file to a manual processi

  • Creating BADI in ECC 6.0 version

    hi guys,          Can any one help me, 1. when iam creating a BADI in ECC 6.0 version after giving the badi name and description, i dont find the INTERFACE tab.    CAN ANY ONE GIVE ME THE STEPS TO CREATE BADI IN ECC 6.0 VERSIO. Thanks ahmed

  • Any danger changing a podcast name?

    Hi, I want to be sure that changing my podcast' name in the xml will not affect the old subscribers (Will they still recieve the new episodes automatically?) Or is there any other problems that can be due to a podcast name change? Thanks, Jean.

  • Integration between Time and Payroll

    Time evaluation period is from 23rd of prev month to 22nd of the current month. Payroll period is from 1 to 30 or 31st. Is there any rule or function module in Payroll to pick results from ZL only till 22nd of the current month ??

  • LSO -  external Person (customer)

    Hello, I created  with PSV8  "external" persons for the Learning Solution. How can I connect the User (US) with the external person, so that the external person can book courses via the Enterprise Portal and see their history? How can external person