Question about calling a function.

Im trying to call a function when a button is clicked, im using actionlistner() on the button, which looks as so :-
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        jButton1ActionPerformed.keyPad();
    }then trying to run this fuction when the button is clicked:-
private void keyPad(java.awt.event.ActionEvent keyPad){
        String oldNumber;                           //set oldNumber to String
        String newNumber;                           //set newNumber as a String
        jButtonCall.setEnabled(true);
        jLabelInstruction.setText("Press 'Call' When Ready...");
        oldNumber = jTextFieldScreenDisplay.getText();      //get txt, if any, assign to oldNumber
        newNumber = oldNumber + "1";                        //set newNumber as oldNumber adding String to end
        jTextFieldScreenDisplay.setText(newNumber);         //Display newNumber
    }Im new, please go easy, everything is done in the main class, but would like to take this one stage further and create a seperate class outside the main, but i wan to get this working from within the main first.
Cheers Guy's
Doo

So what is your question?
Besides:
- the things are called "methods"Hello There!
Sorry, i'm trying to call a 'method'. I have buttons numbered 0-9 which enter into a text field once clicked using ActionEvent. At the moment each button has its own block of code which is a bad habit as its the same code over with one differance, the number value.
Am i right in thinking i should create one method? Then calling this method on each button.
The problem i have is i am unsure of the code to call the method within each buttons ActionEvent ie:-
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
         //call the method keyPad when button is clicked
private void keyPad(java.awt.event.ActionEvent keyPad){
          //run this
- if you define a method to accept a parameter, you
actually have to provide a parameter upon calling
that method.I don't understand???
Thanks
Doo

Similar Messages

  • Some question about the renegotiation function in SRM Contract (GOA)

    Hi All Expert,
    We are on SRM 5/4.6,  there is a question about the renegotiation function in SRM GOA.
    Can we renegotiate the price for some parts in the GOA items with this function ( e.g. Only renegotiate one item in the contract) ?
    Will the item price updated automatically after the renegotiation?
    Many thanks in advance!!!
        Wendrin

    Hi Sanjeev,
    Many thanks for your help.
    One more question, if I add a new item when we renegotiation, will it be transfered to contract and create a new item after that?
    Thanks and best regards
    Wendrin

  • Questions about user-defined functions

    Hello all,
    I've got some questions about user-defined function in a message mapping:
    1) How can I get the current date/time in format yyyy-mm-dd hh:mm:ss ? What is the java code for this?
    2) I want to use the StreamTransformation constant TIME_SENT, only this is not in the right time-zone.
    It is GMT and it should be CET (1 hour difference). How can I convert this in Java?
    Can somebody help me with this?
    Thanks in advance.
    Kind regards,
    Marco van Iersel

    Hi Marco,
    If the date format is fixed as you have mentioned,please use this:
                                    String test = "2009-03-27 23:15:30";
              String test1 = test.substring(11,13);
              if(!test1.equals("23"))
              int a = Integer.parseInt(test1);
              int b = a+1;
              System.out.println("b"+b);
              String c = Integer.toString(b);
                                    test = test.substring(0,10)+" " + c + test.substring(13,19);
                                    return test;
              if(test1.equals("23"))
              test = test.substring(0,10)+ " 00" + test.substring(13,19);
              return test;
                                    else return "";
    Kindly let me know if this works.
    Thanks.
    Regards.
    Shweta

  • Question about PL/SQL Function in report

    Hi all. I have a (basic) question about using a PL/SQL function in a report. In my report page I have an item (PL/SQL function) that has the following syntax:
    return username from t1
    where username like 'Le%'
    I reference this item in an email process. Ideally this function would return all usernames that begin with 'Le' in the drafted email; however, its not looping so I'm only getting a return on the first name.
    I have a few books on PL/SQL but I'm not exactly sure where to start - I imagine there is a loop process I need to integrate into the function but, like I said, I'm not sure.
    I would have posted this to the PL/SQL forum but also wanted some feedback on whether or not using this method is the best way forward. Essentially I have a table with usernames and just want to send email messages based on some simple logic.
    Thanks!
    Len

    Hi Sergio,
    First, it's an honor to have you reply to my post. Thanks!
    To be more specific,
    T1 is a table containing the results from a user security scan. Username is a column in this table containing user names. What I have done is create a page in HTML DB with the following elements:
    1. An 'Item' containing the PL/SQL function that is hidden. The purpose of this Item is to generate information from T1 that meets the simple logic parameters - in this case, the user names that begin with "Le". I have called this Item P145_TT
    2. A 'Process' containing references to HTMLDB_MAIL. The 'Process' looks similar to this:
    HTMLDB_MAIL.SEND(
    P_TO => '[email protected]',
    P_FROM => 'Anon Email Account',
    P_BODY => 'Note: This message was automatically generated. Do not attempt to reply to this email.
    These are the users that begin with Le: '||:P145_TT||' ',
    P_SUBJ => 'Summary');
    3. A 'Button' to submit the process and (hopefully) send the message containing all users that adhere to the logic in the function.
    4. If I use 'return username from t1...' I will get a username generated, but like I said previously, it only gives me the first and does not loop.

  • Some very basic questions about calling a DLL in C[VI] code.

    Hello everyone!
    I'm sorry if this a really simple concept. I've come from a background of embedded systems, so DLLs are something I haven't really played around with much. Regardless. I'm developing an application in CVI for a project, and I generated a DLL that I want to use in Visual Studio 2013. I was able to compile it and it output the expected *.dll file. My question however is how do I properly import that *.dll into the CVI IDE? I did google and search the forums and I didn't find what I needed exactly.... I did find however this link: <http://www.ni.com/white-paper/8503/en/>. I did read through it all, and I think I'm going to try and use Implicit Linking. In the link it does detail 3 steps: 
    Include the import library (.lib) in your LabWindows/CVI project
    Include the header file that contains the function prototype in your code using #include
    Call the function in your code like any other function
    I was able to easily complete step 1.. Now I'm on step 2. The headerfile that contains the function prototype of my code...I was looking at examples, do I just call the dll file as a .h file now? It seemed that way from what I saw. Do I need to output a header file for the DLL some how? Does the CVI compiler automatically reference that .h file with the lib that was imported? 
    Then in step 3...do I call the functions like they're in another file in the project? Just call the function as usual with the type and then feed the variables into the function and so on?
    Sorry if this is a really rudimentary question.
    Thanks in advance!
    ~Andrew

    The header file definitely isn't the .dll renamed! While creating the .dll, your development environment (don't know which one you've used) should create both a .lib file and a .h file that you must use in your project if you want to go the static linking way. I see you've found the .lib file: the .h file should be available as well, possibly in the same path. The include file lists all the definitions for variables and functions exposed by the dll.
    As per step #3 the answer is yes: you simply call .DLL functions like any other function in your program. At the bottom of the tutorial you've linked there is a link to a Developer Zone Example that is a complete CVI project that uses a .DLL: you may take this as a sample framework to study.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Question about calling batch file by using the System Exec+.vi?

    Hi
    I have a problem about calling batch file. I know that the system exec is equivalent to "run" in Windows. I called the batch file c:\rtxdos\bs\ch0.bat successfully in the "run" but it didn't work in the LabVIEW program. The dos prompt had an error message "Bad command or file name" and it just happen when I call this batch file in LabVIEW. Why?
    Bill.

    Hi,
    Try to set the "working directory" parameter of System exec.vi to the directory where the batch file is located. It may help.
    Good luck.
    Oleg Chutko.

  • Question about Custom Escalation Function

    I want to use a Custom Escalation Function described on this document:
    http://docs.tpu.ru/docs/oracle/en/owl/E14571_01/integration.1111/e10224/bp_workflow.htm#BACHEFDH
    I want to execute a custom function on task EXPIRATION.
    Main Question: The "Custom Escalation Function" is just for Escalation or i can use too for EXPIRATION ?
    Thanks.
    Victor Jabur

    Okay Experts. The problem is solved. There was no problem with the custom key figure function. The problem was with the sales order data. The sales order details for the material in question were under the "make to order" segment and the other transaction data info was in the "make to stock" segment.
    Once i found this out , i tried loading someother material and it worked perfectly.
    Thanks
    Aparna

  • Help! Question on calling a function module

    Hi,everybody.
    I have a problem about function module. I created a normal function module which would call itself when user double clicked some screen elements. But when I exit the function called in second time, the value of the global variants in function called in first time changed to the value in function called in second time. It seems that they shared the global variants. So is there any ease approach to recover the data to the original value?
    Thanks for any help!

    Hi Dan,
      you can use field-symbols instead.
    check the following code
    IM_TEST is the importing parameter
    EX_TEST is the exporting parameter
    FUNCTION ZTEST_RECURSION.
    *"*"Local interface:
    *"  IMPORTING
    *"     REFERENCE(IM_TEST) TYPE  C
    *"  EXPORTING
    *"     REFERENCE(EX_TEST) TYPE  C
    field-symbols : <var> type c.
    if im_test = 1.
    assign im_test to <var>.
    *<var> = 4.
    elseif im_test = 3.
    assign im_test to <var>.
    endif.
    if im_test = 1.
    CALL FUNCTION 'ZTEST_RECURSION'
      EXPORTING
        IM_TEST       = '3'
    endif.
    ex_test = <var>.
    ENDFUNCTION.
    i hope this will help you.
    regards,
    Kinshuk Saxena
    PS reward points if you find the post helpful

  • Question about call statement in trigger

    I faced a question in written exam.
    A CALL statement inside a trigger allow us to call
    a)package
    b)procedure
    c)function
    d)another trigger
    Can anyone give me answer with reason?
    I used CALL statement inside trigger but not allowing to use it. Might be earlier in oracle CALL statement we can use..its only a guess so I am asking in forum..
    plz guide me..
    rgds,
    pc

    You can use CALL in a trigger without resorting to EXECUTE IMMEDIATE
    SQL> create table t1 (
      2    col1 number
      3  );
    Table created.
    SQL> create procedure t1_proc
      2  as
      3  begin
      4    dbms_output.put_line( 'In T1_PROC' );
      5  end;
      6  /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1  create trigger trg_t1
      2    before insert on t1
      3    for each row
      4* call t1_proc
      5  /
    Trigger created.
    SQL> set serveroutput on;
    SQL> insert into t1 values( 1 );
    In T1_PROC
    1 row created.I can't think of any reason that you'd actually intentionally structure your code this way in this day and age because it would be rather likely to cause confusion for whoever had to support this in the future. But it is valid syntax that probably made sense back in Oracle 5.
    Justin

  • I have a question about the Siri function.

    Here in Belgium, we speak Dutch and also French and English. But I think when you use the Siri function it is always easier to use it with your own language ( Dutch). 28th October, the iphone4S will be launched here in Belgium, but only with a Englisch version of the Siri function. So my question is that you have any idea when te Dutch version will be available in Belgium, or when i buy an iphone 4S with English version that I can update it to a Dutch version when it will be launched..
    Thank you for helping
    Dylan

    Nobody here can tell you anything more about Apple's plans than what they have already publicly stated, which is that more languages were promised for later (including Japanese, Chinese, Korean, Italian, and Spanish in 2012).

  • A question about calling classes

    Hi,
    I have a question regarding software design so that each class is independent of other.
    public class A
        public void methodA()
                 B m_B=new B();
              String strA=m_B.getBString();
              System.out.println(strA);
    public class B
       public String getBString()
                      return "someString";
    }My question: Is it possible to call the method in class B from class A without creating an instance of class B in method of class A ?
    I am trying to figure out if this can be done using interfaces and abstract classes.
    I am waiting for some suggestions and if you have completely different suggestion then I am open for it too.
    thanks in advance,
    @debug.

    interface I {
        String getString();
    class B implements I {
        public String getString() { return "someString";}
    class A {
        private I foo;
        public void setFoo(I foo) {this.foo = foo;}
        public I getFoo() {return foo;}
        public void methodA() {
          System.out.println(getFoo().getString());
    public class Main {
        public static void main(String[] args) {
            A a = new A();
            a.setFoo(new B());
            a.methodA();
    }There's one problem with decoupling A and B in this case - A's method creates an instance of B. The above is one solution. There are many others.

  • Question about calling a procedure from a URL

    Hi
    In an Apex 3.0 application (which is not public) I use a procedure call in a URL to download the person's photo, if any. The call looks like this:
    {img src=#OWNER#.download_photo?p_id=&P10_ID.}
    This works fine. However, I found out that I can run that procedure just typing that URL in a web browser, without the need to be logged in to any application!
    This seems to me like a flaw in my procedure and I think I am missing something. In a way it makes sense, as there is not any reference in the URL to the application.
    How can I make this procedure to run only if I am logged in the application it is supposed to be run from?
    Thanks
    Luis

    Luis,
    There is a section (Security Issues to Consider) in the file upload/download how-to that describes how to handle this. Also, Anton Nielsen describes a technique linked to from Re: About file .
    Scott

  • Question about NOCOPY in function formal parameter

    SQL> declare
    2 v_1 number(8);
    3 procedure p_1(parm_1 in out nocopy number) is
    4 begin
    5 parm_1 := parm_1 + 50;
    6 raise program_error ;
    7
    8 end;
    9 begin
    10 v_1 := 100 ;
    11 dbms_output.put_line('the value before call is : '|| v_1) ;
    12 p_1(v_1) ;
    13 dbms_output.put_line('the value after call is : '|| v_1) ;
    14 exception
    15 when others then
    16 dbms_output.put_line('outer exception handle') ;
    17 dbms_output.put_line('the value after call is : '|| v_1) ;
    18 end;
    19 /
    the value before call is : 100
    outer exception handle
    the value after call is : 100
    It was said that the keyword NOCOPY made the formal parameter recieve the reference of actual parameter.
    my question is : why the value after call is not 150 ?

    Thanks ,jeneesh.
    I have read the article,but there is a different situation.If there is exception-handling part in the inner block,such as
    procedure p_1(parm_1 in out nocopy number) is
    begin
    parm_1 := parm_1 + 50;
    raise program_error ;
    exception
    when others then
    dbms_output.put_line('the value in inter exception is : '|| parm_1) ;
    end p_1;
    it returns :
    the value before call is : 100
    the value in inter exception is : 150
    the value after call is : 150
    So , i put 'raise'
    exception
    when others then
    dbms_output.put_line('the value in inter exception is : '|| parm_1) ;
    raise;
    end p_1;
    it returns
    the value before call is : 100
    the value in inter exception is : 150
    outer exception handle
    the value after call is : 100
    It conflicts with the formal parameter reference-pass,doesn't it?

  • Question about "share screen" function

    When I am watching at another persons screen, is there a way to hover your mouse over the remote computers window without it effecting the pointer on the remote computer?
    Thank you

    kevinmathie wrote:
    Hi all,
    I'm recording vocals on a song that has lots of ritardandi and rubato. While the vocalist is here, we'll be setting her part of the tempo mapping in "stone," so to speak, but not necessarily the instruments' tempo mapping between her verses or before her verses.
    I usually record this kind of thing in Digital Performer, because I know that the audio sticks like glue to any ritardando, accelerando, etc., I may put in after recording the audio.
    My question: Does the "Follow Tempo" box in Logic let me program in ritards after the audio is recorded, without messing up how the audio is synced to the sequence?
    Yes.
    In other words, if the audio region spans bars 12-24, and I plug in a big ritard at bar 15, followed by "a tempo" in 16 after the audio is recorded, will the audio region follow the tempo mapping?
    Yes.
    +"Plug in a big ritard"+ ? You are one tough composer!
    2nd question: Does it do it automatically? Or, like Digital Performer, do I need to tell it to follow the tempo mapping after I change tempo?
    No, it 'responds' to tempo events in the *tempo track*.
    Any other tips/suggestions regarding this function that you feel would be helpful for me?
    Yep, it can eat up RAM. When you enable follow tempo for a track, the whole audio file is loaded into RAM. Use a utility like MenuMeters to keep an eye on RAM use. http://www.pure-mac.com/diag.html#menumeters
    You can find all relevant info on pages 526-527 of the *Logic Pro 8 User Manual*.
    regards, Erik.

  • Question about synchronized static function.

    Hi, everyone!
    The synchronized statement often deals with an object (called monitor).
    But a static function can be invoked without an object.
    So if a static function is declared as static, what is the function of
    static and synchronized here? Which lock it is using?
    Can you give me a simple expplanation?
    regards,
    George

    Hence try and avoid synchronizing static methods.
    Try and use non static method if you are doing
    multithreaded programming. That way you can have lockWell, I avoid static methods, not just when doing multithreading, but not for the reason you mention.
    objects which allow non interfering methods to be
    accessed in parallelThats easy to do with static methods anyway:
    class Foo
      static Object lock1 = new Object();
      static Object lock2 = new Object();
      static void method1()
         synchronized( lock1 )
      static void method2()
         synchronized( lock2 )
    }Maybe I just missunderstod you...

Maybe you are looking for

  • Help Zeroing Out Data On eMac

    I'm trying to wipe out the hard drive on my folks' old eMac.  I'm going to recycle the computer but it is important that I at least zero out the data and not just erase it superficially. The disk that came with the mac is 10.1.4, so I gues it doesn't

  • Mixed up in airport, airport extreme and a snow B.S.

    Hello! I am trying to set up an airport base (snow) to allow me to run two macs from my DSL. My titanium DVI has the airport card that came with it (2nd generation).My iBook G4 800 has the airport card that came with it and it is a 3rd generation Air

  • Find the path of a string using methods

    Dear Gurus , I have the path " filestltrv\sap\mauals\text.xls' and i want using Methods in ABAP  to find the path '" filestltrv\sap\mauals\'. I suppose using loops and with finding '\' i will do it . Is any other Way ???? Thanks a lot !!!!

  • Fixation for ER in MIRO and MIGO

    Hi:            Is it possible to keep the ER fixed both at the time of MIGO and MIRO...If possible then please advice. Br

  • Upgrade path for Oracle XE to Oracle 10G rel2 Standard/Enterprise Edition

    Good day, We are currently have application using Oracle 10G XE. Is there a document guide available to assist migration/upgrades from Oracle 10G XE to Oracle 10G Rel2 Thank you in advance for your guidance