Why it is error? (Function)

Hello,
I am trying to write a program to calculate a function like f(x) = asin(x+b)exp(cx) where a,b,c, and x is unfixed and users can input their values. After input all values of a,b,c and x, users click a button named "result", and result of that function is appeared. values of a,b,c, and x can be decimal point and negative. Below is my program. However, when I compile, it said that error at the line of " public void init(){". Can anyone help me to solve this problem please!
//Main method
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.lang.Math;
public class Function extends Applet implements
ActionListener
TextField textField1;
TextField textField2;
TextField textField3;
TextField textField4;
public void init()
textField1 = new TextField(5);
textField2 = new TextField(5);
textField3 = new TextField(5);
textField4 = new TextField(5);
add (textField1);
add (textField2);
add (textField3);
add (textField4);
textField1.setText("0");
textField2.setText("0");
textField3.setText("0");
textField4.setText("0");
textField1.addActionListener (this);
textField2.addActionListener (this);
textField3.addActionListener (this);
textField4.addActionListener (this);
public void paint (Graphics g) {
double value1;
double value2;
double value3;
double value4;
     double function;
String s = textField1.getText ();
value1 = Integer.parseInt (s);
s = textField2.getText ();
value2 = Integer.parseInt (s);
s = textField3.getText ();
value3 = Integer.parseInt (s);
s = textField4.getText ();
value4 = Integer.parseInt (s);
double function = value1 * Math.sin ( value4 + value2 ) * Math.exp ( value3 * value4 );
s = String.valueOf(function);
g.drawString (s, 140, 200);
public void actionPerformed (ActionEvent event) {
repaint ();
// this is another file for execute the frame
public class Application {
/* Constructor */
public Application() {
Function frame = new Function();
frame.setVisible(true);
/* Main method */
public static void main(String[] args) {
new Application();

Sorry,
I made a mistake this morning to upload the wrong program. Following is the one I want to ask for help. I am using J2SDK1.4.1 beta. However, the error message is in Japanese which I could not understand, because I am using Japanese Windown version, and I do not know how to install Java development kit in English.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.Math;
public class Frame extends JFrame {
     JPanel contentPane;
     JLabel L1 = new JLabel();
     JLabel L2 = new JLabel();
     JLabel L3 = new JLabel();
     JLabel L4 = new JLabel();
     JLabel L5 = new JLabel();
     JLabel L6 = new JLabel();
     JLabel L7 = new JLabel();
     JButton jButton1 = new JButton();
     JButton jButton2 = new JButton();
     JButton jButton3 = new JButton();
     JButton jButton4 = new JButton();
     JButton jButton5 = new JButton();
/*Construction of a frame*/
public Frame() {
/* Text Label */
L1.setText("f(x) = ");
L1.setBounds(14, 39, 163, 35);
L2.setText("sin (x + ");
L2.setBounds(140, 39, 163, 35);
L3.setText(") exp (");
L3.setBounds(240, 39, 163, 35);
L4.setText("x )");
L4.setBounds(340, 39, 163, 35);
L5.setText("f ( ");
L5.setBounds(14, 89, 163, 35);
L6.setText(" ) =");
L6.setBounds(140, 89, 163, 35);
L7.setText(" ? ? ?");
L7.setBounds(140, 109, 163, 35);
     contentPane = (JPanel) this.getContentPane();
     contentPane.setLayout(null);
this.setSize(650,350);
/* Set textfield for user to add value */
public void init {
     TextField textField1;
     TextField textField2;
     TextField textField3;
     TextField textField4;
     textField1 = new JTextField(5);
     textField2 = new JTextField(5);
     textField3 = new JTextField(5);
     textField4 = new JTextField(5);
     add (textField1);
     add (textField2);
     add (textField3);
     add (textField4);
     textField1.setText("0");
     textField2.setText("0");
     textField3.setText("0");
     textField4.setText("0");
textField1.addActionListener (this);
textField2.addActionListener (this);
textField3.addActionListener (this);
textField4.addActionListener (this);
public void paint (Graphics g)
double value1;
double value2;
double value3;
double value4;
double function;
String s = textField1.getText ();
value1 = Integer.parseInt (s);
s = textField2.getText ();
value2 = Integer.parseInt (s);
s = textField3.getText ();
value3 = Integer.parseInt (s);
s = textField4.getText ();
value4 = Integer.parseInt (s);
double function = value1 * Math.sin ( value4 + value2 ) * Math.exp ( value3 * value4 );
s = String.valueOf(function);
s.setBounds(240, 89, 163, 35);
public void actionPerformed (ActionEvent e) {
repaint ();
return true;
/* Setting a button */
jButton1.setText("Result");
jButton1.setBounds(240, 89, 96, 41);
jButton1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
L7.setText("+ function");
contentPane.add(jButton1, null);
contentPane.add(L1, null);
contentPane.add(L2, null);
contentPane.add(L3, null);
contentPane.add(L4, null);
contentPane.add(L5, null);
contentPane.add(L6, null);
contentPane.add(L7, null);

Similar Messages

  • Why we use this function module

    Hi
        why we use this function module 'LIST_TO_ASCI'.
    regards,
    sivakumar

    hi,
    using LIST_TO_ASCI you can get the list in TEXT format, but this will be with all the formatting you have done in your list, it wont be just field names and its values.
    check this sample code.....
    DATA  BEGIN OF itab_list OCCURS 0.
            INCLUDE STRUCTURE abaplist.
    DATA  END OF itab_list.
    DATA: BEGIN OF vlist OCCURS 0,
            filler1(01)   TYPE c,
            field1(06)    TYPE c,
            filler(08)    TYPE c,
            field2(10)    TYPE c,
            filler3(01)   TYPE c,
            field3(10)    TYPE c,
            filler4(01)   TYPE c,
            field4(3)     TYPE c,
            filler5(02)   TYPE c,
            field5(15)    TYPE c,
            filler6(02)   TYPE c,
            field6(30)    TYPE c,
            filler7(43)   TYPE c,
            field7(10)    TYPE c,
          END OF vlist.
    SUBMIT zreport EXPORTING LIST TO MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = itab_list
      EXCEPTIONS
        not_found  = 4
        OTHERS     = 8.
    CALL FUNCTION 'LIST_TO_ASCI'
      EXPORTING
        list_index         = -1
      TABLES
        listasci           = vlist
        listobject         = itab_list
      EXCEPTIONS
        empty_list         = 1
        list_index_invalid = 2
        OTHERS             = 3.
    IF sy-subrc NE '0'.
      WRITE:/ 'LIST_TO_ASCI error !! ', sy-subrc.
    ENDIF.
    ~~Guduri

  • FRM-41009 error - function key not allowed ?

    Folks,
    I don't know what object or item in my form is causing the "FRM-41009" error - "function key not allowed".
    I have a simple button which (when pressed) inserts records into a table, then does a commit. That insert statement is NOT the problem because an older version of my application does not give me this error.
    Does this mean that I have a trigger somewhere that's reacting on a COMMIT ??? Any ideas...sorry so vague on this one, but I can't pinpoint the problem.
    Thanks,
    Bob

    It's definitely my COMMIT statement that's causing the error in my form.
    When I do a simple Insert statment with the commit, it returns the error. Without the commit, there's no error (and of course no data in my table).
    Why does my commit work in a previously version of my form ?
    Bob

  • ERROR: Function expected

    Does any one of you know what does it mean?
    I've created a report in CR 10 earlier. After that i just migrate the CR 10 report to Crystal 11 using Crystal 11 client. And it was running well in the client.
    Also I exported the report into BO XI R2 enterprise server. But it is throwing the following error while trying to launch the report from BO InfoView.
    ERROR: Function expected
    Pls. let me know what this issue means?
    Thanks
    Viswa

    Hi,
    Thanks for your reply.
    When checked under Report>>Formula Workshop i found some Repository custome functions and i've no rights to delete those functions! And those functions are not used in the report too...
    The complete error text is : ERROR: Function expected only.
    I'm wondering why this is happening under InfoView only not in Crystal client!
    Pls. let me know
    Thanks
    Viswa

  • Why does the error message "Microsoft Outlook must be closed because an error occurred" keep coming up?

    why does the error message "Microsoft Outlook must be closed because an error occurred" keep coming up?

    Reboot the machine.

  • HT1222 Why are there error while updating my ipad

    Why are there error while updating my ipad from 5.1 to 7.1.1

    Because something is wrong...
    You can check here for troubleshooting information on specific error messages: http://support.apple.com/kb/ts3694

  • Why  would an error pop up saying the installer is damaged. The Installer can't open the package. There may be a problem with file ownership or permissions. when trying to install java 7?

    why  would an error pop up saying the installer is damaged. The Installer can’t open the package. There may be a problem with file ownership or permissions. when trying to install java 7?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Select
    /var/log ▹ install.log
    from the hierarchical list on the left. If you don't see that list, select
    View ▹ Show Log List
    from the menu bar. Then select the messages from the last installation or update attempt, starting from the time when you initiated it. If you're not sure when that was, click the Clear Display button in the toolbar of the Console window and then try the installation again.
    Copy the messages to the Clipboard by pressing the key combination command-C. Paste into a reply to this message (command-V).
    If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.

  • Job in batch R/3 CallReceive error Function RFC_ABAP_INSTALL_AND_RUN

    Hi,
    I have an scenario where I am integrating SAP with a DB. I am pulling data from 2 tables from SAP using the R/3 Data flow. I need to run this job on batch, so I changed the parameters on the datastore used to access SAP, when it runs, the job gets terminated, and  I got the following error
    |Dataflow df_sap2tables2file
    R/3 CallReceive error <Function RFC_ABAP_INSTALL_AND_RUN: . Exception condition "INVALID_TARGET" raised.. The problem may go
    away if you change the SAP datastore property to Execute in background(batch)>.
    |Dataflow df_sap2tables2file
    R/3 CallReceive error <Function RFC_ABAP_INSTALL_AND_RUN: . Exception condition "INVALID_TARGET" raised.. The problem may go
    away if you change the SAP datastore property to Execute in background(batch)>
    The abap program gets created on the shared folder.
    Anyone has faced this issue?
    Thanks,
    Julio

    Hi,
    The issue has been resolved. You have to:
    Upload DS function modules into SAP
    Define an RFC destination on SAP
    Run the task RfcSrv on the DS Server
    Thanks, for the help
    Julio

  • HT201413 why got occured error (1600) when instal ios 6 on iphone 3g

    why got occured error (1600) when install ios6 on iphone 3g ?

    Hi dbs5852,
    Thanks for using Apple Support Communities.  This article has information on error 1600 and may help:
    Resolve specific iTunes update and restore errors
    http://support.apple.com/kb/ts3694
    Check USB connections
    If there’s an issue with the USB port, cable, dock, or hub, or if the device becomes disconnected during restore, try troubleshooting the USB connection, then troubleshooting your security software.
    Common errors: 13, 14, 1600-1629, 1643-1650, 2000-2009, 4000, 4005, 4013, 4014, 4016, “invalid response”, and being prompted to restore again after a restore completes.
    To narrow down the issue, you can also change up your hardware:
    Use another USB cable.
    Plug your cable into a different USB port on your computer.
    Try a different dock connector (or no dock).
    Add (or remove) a USB hub between your device and computer.
    Connect your computer directly to your Internet source, with no routers, hubs, or switches.
    If you see your error after changing your USB connections, continue to the next section to troubleshoot your hardware.
    Cheers,
    - Ari

  • Why does the error console continuosly keep filling up ? in yellow, pink & blue messages ??

    Ok, first I am using an older, slower Mac G4 400 Mhz, PCI, "YIKES" model machine. ..... The problem is that after browsing mail for 1/2 hr., Fire Fox slows down a lot. Most likely related to my machine speed. I understand that and this machine is a backup computer. I can cure the speed problem by closing FF, and relaunching it, and speed is fine for another 1/2 hr. or more. Then repeat the close and restart for speed reset as needed. This seems to clear a backlog of info. slowing down the CPU.
    THE REAL QUESTION IS; Why does the ERROR CONSOLE keep filling up with messages in pink, yellow and blue, warnings, errors, and (blue) website not supported messages ??.
    The message copy & pasted in the trouble shooting info. box is the first one to show up immediately after "clearing error console" window (5 seconds later), it will be filling up as I type now. and I don't know squat about coding or deep workings of computers, I am to old to start learning now, but it just seems to me that the "ERROR console" should not be filling up with every mouse click I make while browsing mail & websites I use everyday, that are working just fine as far as I can tell.
    I have watched the error console fill up as I brows, usually 1 mouse click can produce 4 to 8 lines in the error console, clearing it out doesn't seem to affect the speed problem at all, so is unrelated to speed (??) I think.
    But the Question is ??? why does the ERROR CONSOLE keep filling up with all these messages when FF seems to be working fine ????????
    There are now 15 (PINK) separate lines of the same message in the console window, just while typing this out. 0
    Reply to ;<[email protected]> ..... I am really curious about this and await an answer. Thank You. wayne

    Hello, took me awhile to find this out, but...
    Get the combo update for Intel-based Macs...
    http://www.apple.com/support/downloads/macosx10411comboupdateintel.html
    Safe Boot, (holding Shift key down at bootup), & use Disk Utility from there to Repair Permissions, reapply the Combo Update.
    Repair Permissions afterwords, reboot.

  • Why is the scroll function not working after accessing the voice feature in settings?

    Why is the scroll function not working after accessing the voice feature in settings?

    For some prerecorded audio files the Transpose slider will not work reliably. I found no clear pattern, when it does and when not.
    If all fails, create a loop from the audio file. Select the region in the track and use the command "File: Add region to Loop library".
    Set the current key and tempo, name the loop, and save the loop.
    Now add it from the loop browser to a new track and delete your old track. The search field in the Loop browser will help you to find the loop quickly.
    You will be able to transpose the sample as described above, like a regular loop.
    For example - a audio file turned into a loop and transposed:

  • Error: "Function or method not supported." when using RF List Mode on NI 5673E

    Hi,
    I am trying to use the RF List Mode in NI RFSG 5673E. I tried running the sample code "RFSG Configuration List Frequency and Power Sweep.vi" but an error would show up:
    "Error: niRFSGCreateConfigurationList.VI <ERR> The LO reported the following error: Function or method not supported." with the error code: BFFA4239. 
    I also tried running other sample codes that contain the Configuration List VI's but the same error appeared. I am using NI RFSG 1.8.5.
    I would really appreciate any help on this. Thanks!

    Hello jdlabrador,
    I setup a 5673E here and tried to run the same example.  I did not encounter an error.
    Other reports I've found pertaining to this error usually involved a large number of steps - there was not enough space on the hardware to accommodate them.  The error text you're seeing is a little different in that it states that the Create Configuration List method isn't supported for the LO.
    Do each of the modules in your 5673E (5450, 5611, 5652) pass a self-test in MAX?  
    Have you associated the 5450 and 5652 with the 5611?
    Could you post a screenshot of the fully-expanded Devices and Interfaces tree from MAX?
    Since RFSG 1.9.5 is available, it may be a good first-step to upgrade to it.  
    Best regards,
    Matthew H.
    Applications Engineer
    National Instruments

  • Running SQL Procedure with dg4msql errors: Function sequence error HY010

    I am trying to execute a stored procedure on a SQL database and get the error Function sequence error HY010.
    A simple query on a table returns teh expected result.
    I have a single Win2008R2 server with MSSQL Express 2008 and Oracle 11gR2 (32bit not 64bit version of Oracle)
    Below is the gateway init, listener and tnsnames files and the query I am trying to run:
    -- initORIONWASP.ora --
    HS_FDS_CONNECT_INFO=INGRDB//waspForGIS
    HS_FDS_TRACE_LEVEL=OFF
    HS_FDS_RECOVERY_ACCOUNT=RECOVER
    HS_FDS_RECOVERY_PWD=RECOVER
    HS_CALL_NAME=dbo.spTest;dbo.spQueryAsset;dbo.spQueryAssetDetails
    HS_FDS_PROC_IS_FUNC=TRUE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    -- Listener.ora -- (partial)
    (SID_DESC =
    (SID_NAME = ORIONWASP)
    (ORACLE_HOME = C:\Oracle\product\11.2.0\dbhome_1)
    (PROGRAM=dg4msql)
    -- tnsnames.ora -- (partial)
    ORIONWASP =
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=INGRDB)(PORT=1521))
    (CONNECT_DATA=(SID=ORIONWASP))
    (HS=OK)
    -- Simple Query --
    Running select "Asset_ID" from asset@ORIONWASP; returns the correct result
    Running select * from sys.procedures@ORIONWASP; returns a list of procedures including the procedure I want to run
    -- This pl/sql block returns the error ******* identifier 'spTest@ORIONWASP' must be declared *******
    declare
    begin
    "spTest"@ORIONWASP;
    end;
    -- This passthrough pl/sql block returns ******** [Oracle][ODBC SQL Server Driver]Function sequence error {HY010} ********
    DECLARE
    CRS BINARY_INTEGER;
    RET BINARY_INTEGER;
    v_COL1 VARCHAR2(50);
    v_COL2 VARCHAR2(50);
    BEGIN
    CRS := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@ORIONWASP;
    DBMS_HS_PASSTHROUGH.PARSE@ORIONWASP(CRS, 'exec spTest');
    BEGIN
    RET := 0;
    WHILE (TRUE)
    LOOP
    ret := DBMS_HS_PASSTHROUGH.FETCH_ROW@ORIONWASP(CRS, FALSE);
    DBMS_HS_PASSTHROUGH.GET_VALUE@ORIONWASP(CRS, 1, v_COL1);
    DBMS_HS_PASSTHROUGH.GET_VALUE@ORIONWASP(CRS, 2, v_COL2);
    DBMS_OUTPUT.PUT_Line('Col1:'||v_COL1||' Col2:'||v_COL2);
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    BEGIN
    DBMS_OUTPUT.PUT_LINE('End of Fetch');
    DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@ORIONWASP(CRS);
    END;
    END;
    END;
    /

    The gateway configuration file contains:
    HS_FDS_PROC_IS_FUNC=TRUE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    This setting commonly causes problems and you need to set
    HS_FDS_PROC_IS_FUNC=TRUE
    HS_FDS_RESULTSET_SUPPORT=FALSE
    for normal procedure calls and
    HS_FDS_PROC_IS_FUNC=FALSE
    HS_FDS_RESULTSET_SUPPORT=TRUE
    when calling the procedure with ref cursors.
    There's a note in My Oracle Support that gives you examples how to call remote SQl Server procedures
         Note.197192.1 Different Methods How To Call MS SQL Server Procedures Using TG4MSQL - DG4MSQL
    and another one for the Sybase gateway but this code is similar for the SQL Server:
    Article-ID: Note 351400.1
    Title: How to Call a Remote Sybase Procedure Using TG4SYBS

  • Error "Function G1 does not exist "

    Hi ,
    While doing monitoring  got error " Function G1 does not exist ".
    Bdoc type : BUPA_REL
    Sate         : E04.
    Checked SMQ1,SMQ2 , no queues were in sysfail status.How to maintain this function.
    Help me how to clear .
    Thanks in advance, Regards,
    PA.

    Hi ,
    May be your customization settings was not replicated correctly.
    In R/3 you have Contact person function G1 and it doesn't exist in CRM.
    You can check it : go to BP trn => open an organisation that has  contact person =>relationship tab => double click on contact person => In "Contact person data "frame you will see field "function" => press F4 and check existing values.
    Those values should be same as in R/3 system.If not - check your customization objects synchronization.
    Hope, it's help
    Rika

  • RFC CallReceive error Function Z_AW_JOB_RUN

    Hi,
    I am using SAP BODS 3.2 to compare customer data between SAP MDM,SAP ECC and SAP CRM systems. I am using ABAPFlows for SAP CRM and SAP ECC customer data extraction. I have generated the abap code and manually pasted it in respective systems. When I run my batch job .I am getting the following error. Please help me out in resolving it.
    error:
    12386564 1 R3C-150412 8/9/2011 11:39:53 AM |Data flow DF_IG_CUSTOMER_GLOBAL_EXTRACT
    12386564 1 R3C-150412 8/9/2011 11:39:53 AM RFC CallReceive error <Function Z_AW_JOB_RUN: The ABAP program lines are wider than the internal table.. The ABAP program lines
    12386564 1 R3C-150412 8/9/2011 11:39:53 AM are wider than the internal table.>.
    9502780 1 R3C-150412 8/9/2011 11:39:53 AM |Data flow DF_IG_CUSTOMER_GLOBAL_EXTRACT
    9502780 1 R3C-150412 8/9/2011 11:39:53 AM RFC CallReceive error <Function Z_AW_JOB_RUN: The ABAP program lines are wider than the internal table.. The ABAP program lines
    9502780 1 R3C-150412 8/9/2011 11:39:53 AM are wider than the internal table.>.
    Thanks,
    Nag

    Hi,
    Sounds like a copy/paste issue.  If you copied the ABAP from within the Designer then maybe try either a) open the generated ABAP file in notepad and copy from there, or b) copy the generated ABAP file to the SAP file system and then use the Import functionality in SE38 to import the code into the ABAP editor instead of pasting it.

  • Why need to give Function group at time of  table maintence generation

    Dear All,
    why need to give Function group at time of  table maintence generation
    Regards,
    Laxman  Sankhla

    Hi Laxman,
    The F1 help of the field says:
    Name of the function group, to which the generated maintenance modules will belong.
    Means the PBO & PAI modules of the screen will be created under this Functio group.
    Regards
    DKS

Maybe you are looking for

  • There is a problem communicating with the printer.

    I have a Lexmark Interpret S405. I am using a MBP laptop with WiFi, running 10.5.8. I have a cabled (non-wifi) Linsys router. I am using an Airport Express. I was finally able to get the WiFi light on the Lexmark to be static green after reinstalling

  • HT204387 Is it possible to use my Android phone to transfer pictures to my iPad 3 via Bluetooth?

    I am trying to transfer  pictures from my Android Phone to my iPad 3. Both devices "found" each other, but when I try my iPad says to make sure my phone is turned on and visible....and it is.  Am I doing something wrong?  In my settings on both devic

  • .MOV to .FLV or the best route to getting movies on the web?

    Hi, I'm trying to figure out how to get some of my short movies onto a website. Do I need to buy a converter? Or are any of the free ones worth their salt? What is the most common way of turning FCP videos into a format compatible with flash players?

  • SQLDeveloper on macosx 10.5 & killing a query

    When a search runs for a long time and I kill it (red button), I am unable to do another search until I quit and restart the application, made worse because I now can not quit the application but must do a force-quit from the operating system.

  • Equium M70-173 - Fatal error - New HDD and Recovery.

    Excuse my lack of knowledge. I have been given a Equium M70-173. upon turning on before loading it reads - Fatal Error; i should back up all of my data and replace the Hard Drive. I am not sure if this is fixable and if it is what i should do. I also