Import java code applet into form and execute it

Hi all.
I'm on devsuite 10g.
I have the following applet code:
import java.applet.Applet;
import java.awt.event.*;
import java.awt.*;
public class simple2 extends Applet
  implements MouseListener, MouseMotionListener {
      double r0 = 100.0;
      double r1 = 40.0;
    public void paint(Graphics g) {
      int n = 400;
      int x0=0,y0=0,x1,y1;
      for(int i=0;i <=n;i++)
           double rho   = 2*Math.PI*i/n;
           double theta = 16*Math.PI*i/n;
           double x = r0*Math.cos(rho) + r1*Math.cos(theta);
           double y = r0*Math.sin(rho) + r1*Math.sin(theta);
           // cambio sistema di riferimento
           x1 = getSize().width/2+(int)x;
           y1 = getSize().height/2+(int)y;
           // disegno
           if(i>0) g.drawLine(x0,y0,x1,y1);
           x0 = x1;
           y0 = y1;
    public void init() {
      addMouseListener(this);
      addMouseMotionListener(this);
    public void mouseClicked(MouseEvent e) {}
    public void mousePressed(MouseEvent e) {}
    public void mouseReleased(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) {}
    public void mouseMoved(MouseEvent e) {}
    public void mouseDragged(MouseEvent e) {
      int x = e.getX(), y = e.getY();
      r0 = x-getSize().width/2;
      r1 = y-getSize().height/2;
      repaint();
      e.consume();
} I want to import this code into my form in order to execute it.
Code make possible drawing graphs to screen...
What I want is to execute this code into my form, in a when-new-block instance trigger or something else.
How can I achieve this???
Thanks all for collaboration,
Fabrizio

It isn't quite as simple as just "importing" your java code if your goal is to have the forms and the java app communicate with each other. Interaction occurs when a properly designed Java Bean is created.
Take a look at some of the examples on the following page as they can likely provide you with a good starting place:
http://sheikyerbouti.developpez.com/forms-pjc-bean/menu/

Similar Messages

  • How to use java code in my forms.................

    Hi All,
    I want to use the below java code in my form 6i ..but don't know how????????
    related function is also given below..........
    Any idea .......Please
    Thanks
    Harry.....
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.sql.*;
    public class MyProgram {
    private static Connection con = null;
    private static Statement st;
    public static ResultSet rs;
    public static String s;
    /* public void setlable(int n)
    rs = st.executeQuery("SELECT number_to_words("+n+") FROM dual");
    while (rs.next())
    output.setText(rs.getString(1));
    public static void main(String[] args) {
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection con = DriverManager.getConnection("jdbc:oracle:thin:@172.19.193.38:1525:ITSTIN", "scott", "tiger");
    st = con.createStatement();
    }catch(Exception exp){
    System.out.println("Error"+exp.toString());
    JFrame f = new JFrame("Conver Digit to Words..");
    JLabel input = new JLabel("Enter Numeric digits :");
    final JLabel output = new JLabel("Please enter value into TestBox.....",JLabel.CENTER);
    final JTextField TF1 = new JTextField(90);
    final JButton B1 = new JButton("Close");
    f.setSize(750, 250);
    f.setLocation(300,200);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = f.getContentPane();
    contentPane.setLayout(null);
    contentPane.setBackground(Color.CYAN);
    TF1.setLocation(300,25);
    TF1.setSize(150,30);
    input.setLocation(175,25);
    input.setSize(150,30);
    input.requestFocus();
    output.setLocation(15,100);
    output.setSize(650,30);
    output.setForeground(Color.RED);
    B1.setSize(100,32);
    B1.setLocation(620,175);
    contentPane.add(TF1);
    contentPane.add(input);
    contentPane.add(output);
    contentPane.add(B1);
    f.setVisible(true);
    B1.addMouseListener(new MouseAdapter(){
    public void mouseClicked(MouseEvent me)
    System.exit(0);
    TF1.addKeyListener(new KeyAdapter(){
    public void keyReleased(KeyEvent event){
    if (TF1.getText().equals("") )
    output.setText("Please enter value into TestBox.....");
    else
    try
    if (TF1.getText().length()<12)
    s = "SELECT initcap(number_to_words("+Long.parseLong(TF1.getText())+")) FROM dual";
    rs = st.executeQuery(s); //Function number_to_words exists in scott@itstin created by AMUY-IN
    while (rs.next())
    output.setText(rs.getString(1));
    }catch(Exception e)
    System.out.println("Error-2"+e.toString());
    ================================function===============
    CREATE OR REPLACE FUNCTION amuy_con_to_eng(nm2 NUMBER) RETURN VARCHAR2 IS
    nm1 NUMBER(10,0) := nm2;
    NM VARCHAR2(100):='';
    div NUMBER;
    BEGIN
    WHILE nm1>0 LOOP
    IF nm1>=20 THEN
    div :=Floor(nm1/10);
    NM := NM||' '||base_convert(div*10);
    nm1:=Mod(nm1,10);
    END IF;
    IF nm1>=1 AND nm1<20 THEN
    NM := NM||' '||base_convert(nm1);
    nm1:=nm1/10;
    END IF;
    nm1 :=Floor(nm1/10);
    END LOOP;
    RETURN NM;
    END;
    CREATE OR REPLACE FUNCTION number_to_words(inm NUMBER) RETURN VARCHAR2 IS
    /* Function that converts number's to word's*/
    /* Created buy amuy-in */
    l_inm NUMBER(35,0);
    NM VARCHAR2(1000):='';
    div NUMBER;
    BEGIN
    l_inm := inm;
    IF inm<=0 THEN
    RETURN 'ZERO';
    ELSE
    WHILE l_inm>0 LOOP
    case when Length(l_inm) >= 1 AND Length(l_inm)<=2
    then RETURN NM||' '||sf_num_to_words(l_inm);
    when Length(l_inm) = 3
    then div :=Floor(l_inm/RPad(1,3,0));
    l_inm := Mod(l_inm,RPad(1,3,0));
    NM :=NM||' '||sf_num_to_words(div)||' '||'HUNDRED';
    when Length(l_inm) >= 4 AND Length(l_inm) <= 5
    then div :=Floor(l_inm/RPad(1,4,0));
    l_inm := Mod(l_inm,RPad(1,4,0));
    NM :=NM||' '||sf_num_to_words(div)||' '||'THOUSAND';
    when Length(l_inm) >= 6 AND Length(l_inm) <= 7
    then div :=Floor(l_inm/RPad(1,6,0));
    l_inm := Mod(l_inm,RPad(1,6,0));
    NM :=NM||' '||sf_num_to_words(div)||' '||'LAKH';
    when Length(l_inm) >= 8 AND Length(l_inm) <= 9
    then div :=Floor(l_inm/RPad(1,8,0));
    l_inm := Mod(l_inm,RPad(1,8,0));
    NM :=NM||' '||sf_num_to_words(div)||' '||'CRORE';
    when Length(l_inm) >= 10 AND Length(l_inm) <= 11
    then div :=Floor(l_inm/RPad(1,10,0));
    l_inm := Mod(l_inm,RPad(1,10,0));
    NM :=NM||' '||sf_num_to_words(div)||' '||'ARAB';
    ELSE RETURN 'ERROR {Length of input value should be <12}';
    END CASE;
    END LOOP;
    RETURN NM ;
    END IF;
    END;
    /

    You cannot use java directly inside forms. You can either create a java-bean to enhance the GUI (as you have some UI-components in your java-code, i guess this would be the direction) or use the java-importer and call server-side-java. Both require that you are running forms in a web-version and not as client-server.
    What exactly is your requirement?

  • How to load a java card applet into a java card

    Dear All,
    I am a novice to java card technology..
    I have done some search on how to load a java card applet into a smart card but haven't found a satisfactory answer. I have read about installer.jar and scriptgen tool but I want to load the applet from a java program and not from command line. It would be of great help if somebody can help me out.
    If somebody can share a sample program which load a javacard applet(.CAP file) into a smart card, I will be very thankful.
    I am able to find some client applications which help us send APDU commands and recieve response APDU's to interact with an applet loaded on to the smart card but not application which actually load the applet.
    I have heard of OCF and GP.. some say that OCF technology is outdated and no longer in use.. can somebosy throw some light on this too..
    cheers,
    ganesh

    hi siavash,
    thanks for the quick response.. i checked out GPShell as suggested, it looked like a tool by which one can load an applet on to card and send some sample apdu commands... but I want to load the applet from the code.
    My application should look something like this.. it will be a swing applicaton where I have a drop down with a list of readers, I select the one desired and then click on "LOAD" after inserting a blank java card, at this point my applet which is stored in my DB should get loaded on to the java card. The next step should be to personalize it where I enter the values for the static variables of my applet and click "PERSONALIZE", at this point all these values should be embedded into APDU commands and sent to the java card for processing.
    For achieving this I am yet to find a comprehensive sample or documentation on the net.
    Please help...
    regards,
    ganesh

  • Unable to import the excel template into form in HFM

    Has any one came across this issue that I am facing now?
    I have a form in HFM and I exported the form to Excel and the export works fine. but when I import the excel template into form, it was not successful. I have 250 rows in the template. I deleted 50 rows and tried to import and it worked fine . Is there any row limit on this?
    Below here is the error message that I am getting
    An error occured. Please contact your administrator
    Error Number: - 2147467259
    Error Description:007~Unexpected error~The function returned |.
    Error SOrce: request Object
    Page on which error occured:/hfm/data/processImportWdeffromExcel.asp
    I appreciate any ideas on this

    What version of HFM and Excel?
    Make sure you honor the file extension requirements for 2007 docs and import the same as they are exported.

  • How to import java library file to forms 6i

    Hi all,
    Is it possible to import java library file to forms 6i. Please help me.

    The Java importer is introduced in 9i.
    However, most java functionality is added to Forms in the client, not the server. In 6i you can add Java pluggable components to your forms. You need to make a Java Pluggable Component to do this. Stand-alone Java beans can only be called from Forms 9i on using the fbean package.
    So it depends on what you want to do with the java whether it is possible to use it in 6i.

  • I have iMovie 8.0.6 and an iPhone 4S.  I took hours of videos on vacation (Australia and New Zealand) and want to make a movie.  I've imported the first batch into iMovie and started the project.  I just realized that I shot both horizontally and vertical

    I have iMovie 8.0.6 and an iPhone 4S.  I took hours of videos on vacation (Australia and New Zealand) and want to make a movie.  I've imported the first batch into iMovie and started the project.  I just realized that I shot both horizontally and vertically and when I preview (on full-screen) what I've combined, first it's wide-screen, then it's tall, narrow with wide black sides. 
    The film looks choppy, no flow, since it alternates horizontally and vertically.
    I can import the vertical clips two ways:  "Full-Original Size", or "Large 960x540."  But the vertical clips have very short, fat people.
    This didn't happen with my Flip HD; the movies are smooth and terrific.  My heart is breaking.....please, how can I make the videos match?

    Yes, I'd like to use all the video I shot, put it together with music, titles, etc. and make it consistant.  when it goes from full screen to this vertical, narrow clip, it's very awkward.....and it's so narrow, it's hard to see what I'm looking at; my eyes don't make the adjustment quickly.

  • Can I use "Adobe X Pro" to debug the java code in adobe forms?

    HI,
    Can I use "Adobe X Pro" to debug the java code in adobe forms?, if not how do i debug the java code written in the adobe form.

    I have the adobe acrobat x evaluation version installed, please find the print shot attached, I have pressed CTRL+J in the preview mode, but nothing came up.
    Am I doing something wrong..

  • I imported a quicktime movie into imovie and want to export it to idvd and it is grayed out

    I imported a quicktime movie into imovie and want to export it to idvd but the menu comes up gray, what do I need to do first?

    Hi
    And if You
    Share to file - and as 480p - then drop this file into iDVD bigMenu window (avoiding dropzones) - You get an even better result.
    other res gives problems.
    Yours Bengt W

  • I am trying to import quicktime audio files into FCPX and it's saying they're not suppored - Help?

    I am trying to import quicktime audio files into FCPX and it's saying they're not suppored … Help?

    Here is the How to import in itunes 11. Including the Join tracks option.
    http://support.apple.com/kb/PH12278
    Also if you have imported them then  this article gives a good understanding of how to tag these songs
    http://samsoft.org.uk/iTunes/audiobooks.asp
    the other option would be to use an App like Audiobook Builder to stitch the tracks together in upto 12 hour long sections and sends to itunes automatically. It is available in the App Store. There are others available, Audiobook binder is free

  • I am switching over from a PC to a MacBook Pro and an iPad.  How do I import my Outlook contacts into MacBook and iPad?

    I am switching over from a PC to a MacBook Pro and an iPad.  How do I import my Outlook contacts into MacBook and iPad?

    One option is forwarding your Outlook contacts as vCard files which can be imported by the Address Book on your Mac, followed by being synced with your iPad.
    In Outlook, select all contacts and at the menu bar select forward as vCard. Each contact will be a separate vCard file. Send the email to an email account you are accessing with the Mail app on your Mac.
    Save the attached vCard files in a folder created on your Desktop or in whichever chosen location for the folder. At the Address Book menu bar, go to File and select Import navigating to the folder that incudes the vCard files. Open the folder to select.

  • I have imported a jpeg photo into iPhoto and cannot get the Places map to let me fix a position on the map. It remains disabled for my photo. Checking out the Help file has not given any solution.

    I have imported a jpeg photo into iPhoto  and cannot get the Places map tp show. I have tried the Help file and the information was not helpful. Can anyone give advice here?

    I am using iPhoto 9.1.1. When I select thephoto, then Places I get the window (Places to lookup disabled). When I hit theInfo button I get the size an JPEG notification, and  Faces and Key words. The “reverse” of thepicture shows a window with Rotate, Hide, Trash etc.
    When I select Places, get the Google worldmap, and this case a pin on Sydney Australia showing that eighteen photos arecorrectly placed. I am unable to make the connection to San Francisco wherethis particular photo was taken on a very modern camera.
    Regards,
    Theogt

  • Calling Java code inside JSP page and sending toString on object to Servlet

    Hi.
    I am trying to setup a way to make testing my application easier. Using a web-based method will work best. Here is what I am trying to accomplish:
    - Have a web page that will prompt the user to enter data, fill in text fields, make choices, etc. When done, they press the Submit button. I don't need to keep info between sessions. Just open browser, execute, view results, close browser, repeat.
    - I then want to take this data and use some Java Classes I have to create a Java object.
    - I then want to send the toString() results of this Java object to a known Java servlet. The result of the servlet's actions should be displayed as a response on the screen.
    This is what I currently have (Ignore the
    's - I don't know why they are showing up - its not important):
    Web page:
    <html>
    <head><title>TestGroup</title></head>
    <body>
    <form name=f method=post action=http://localhost:100/Servlet>
    Name: <br>
    Group: <input name=group type=text><br>
    <br>
    <input type=submit value=Submit>
    <input type=reset value=Reset>
    </form>
    </body>
    </html>The Java code in the JSP (where to put it?):
    <%
    Group g = new Group();
    g.setGroupName(request.getParameter("group"));
    String output = g.toString(); // I want this to go to the Servlet.
    %>But, now I am stuck as to how to piece these together. I have some JSP experience, but not quite like this.
    As I said, when the user presses the Submit button, I want to perform the Java code above, and have the results of the toString method sent to the Servlet, plus clear all other parameters (so they are not sent to the servlet).
    Does anyone have any advice/comments? I am open to alternative designs too, this is just the simplest one I could think of. If another JSP page is needed, that's fine too.
    Thanks.

    Hi.
    I am trying to setup a way to make testing my application easier. Using a web-based method will work best. Here is what I am trying to accomplish:
    - Have a web page that will prompt the user to enter data, fill in text fields, make choices, etc. When done, they press the Submit button. I don't need to keep info between sessions. Just open browser, execute, view results, close browser, repeat.
    - I then want to take this data and use some Java Classes I have to create a Java object.
    - I then want to send the toString() results of this Java object to a known Java servlet. The result of the servlet's actions should be displayed as a response on the screen.
    This is what I currently have (Ignore the
    's - I don't know why they are showing up - its not important):
    Web page:
    <html>
    <head><title>TestGroup</title></head>
    <body>
    <form name=f method=post action=http://localhost:100/Servlet>
    Name: <br>
    Group: <input name=group type=text><br>
    <br>
    <input type=submit value=Submit>
    <input type=reset value=Reset>
    </form>
    </body>
    </html>The Java code in the JSP (where to put it?):
    <%
    Group g = new Group();
    g.setGroupName(request.getParameter("group"));
    String output = g.toString(); // I want this to go to the Servlet.
    %>But, now I am stuck as to how to piece these together. I have some JSP experience, but not quite like this.
    As I said, when the user presses the Submit button, I want to perform the Java code above, and have the results of the toString method sent to the Servlet, plus clear all other parameters (so they are not sent to the servlet).
    Does anyone have any advice/comments? I am open to alternative designs too, this is just the simplest one I could think of. If another JSP page is needed, that's fine too.
    Thanks.

  • "Import Java Classes"in Oracle6i Forms

    Hello
    I have two questions regarding importing java classes in Forms 6i
    1- How we can add my own class to this list, so that I can import it directly in form 6i and use it?
    2- When these classes are used in form development, are they fully imported to client side or only class wrapper is ported to forms. I m asking this question, cuz I want to develop my application with all bussiness logic(Java classes) in middle tier ie Form Server.
    Can anyone guide me in this regard
    Thanks in advance
    Asif

    OK answers to the questions are:
    1) If your class is on the classpath it will be picked up by the Java importer but you have to restart Forms if you add the class to the path
    2) THe java importer is for middle tier. In Forms, all ofthe application logic is on the middle tier and if you want it integrate this with Java the importer will create a PLSQL wrapper to call the Java - in pretty much the same way as ORA_FFI. (So NOT imported into the client)
    There are some white papers on OTN.
    Regards
    Grant

  • Problem when importing a SQL file into Forms

    Hello friends at www.oracle.com ,
    I have a Forms program which has to open a SQL external file, read each SQL instruction into a variable, execute it and read the next one, as in the example (for illustration purposes) below.
    create table ...
    insert into log_table ...
    delete from table ...
    So, whenever Forms finds the slash, it will execute the instruction via FORMS_DDL built-in.
    The problem is that we have a SQL instruction that can't be executed via Forms. The reasons:
    - It is a SQL that creates a package body
    - The SQL that creates the package code is very big (more than 32 kb), and this leads to the problem below
    - The 32 kb SQL code is sent to a Forms variable, and a FORMS_DDL should execute it, but FORMS_DDL has a limitation: the maximum that FORMS_DDL can read is 32 kb
    - I can't find a way for me to break the package code into two or more codes because I cannot alter a package to add procedures or functions
    Could you please tell me what should I do? If the text above is not clear, please ask me more details.
    Best regards,

    Hello Francois,
    Why don't you run your SQL file with Sql*Plus ?sincere thanks for your answer.
    Your idea would be the ideal solution, but the package needs to be created via Forms only, for maintenance purposes. A Forms program needs to handle everything that comes from this SQL external file.
    Another way could be creating the package inside Forms, but the idea is to send all SQL instructions to an external file, for the same reason as above (that is, maintenance).
    Best regards,

  • Importing java code in UDF of XI

    Can anyone tell me how we can import a .class file written in NDS into the import parameters of User Defined Functions in XI ?

    Hi guys,
    i created a zip file of all the files alon with the class file...
    imported it in Imported Archive ...
    the file name is "writesplit.zip".
    In the UDF i imported it as writesplit; and am getting the following error.
    Source code has syntax error:  D:/usr/sap/PI7/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map7b55e690e96811dca799000e7f303916/source/com/sap/xi/tf/_MM_CannonicalToWRITE6Split_.java:3: '.' expected import com.sap.aii.mappingtool.tf3.;import com.sap.aii.mappingtool.tf3.rt.;import java.util.;import java.io.; import java.lang.reflect.;import writesplit;import java.io.; ^ 1 error

Maybe you are looking for

  • What is the difference in SAP CRM and SAP R/3

    Hi Experts, I am new to the CRMs system. Please clarify the following points. what is the difference between SAP CRM system and SAP R/3? In SAP R/3 contains the different module like SD , FI, MM, HR... Like that in SAP CRM also have different modules

  • ITunes 10.6 crashes when i open books

    Hi, just downloaded itunes 10.6 and as with ALL others it keeps on crashing, in my case only when i open books. I can't sync to my ipad or iphone. Any news on a fix or do i have to revert to 10.5 or something thanx

  • Save custom fields value  in EKKO through ME21N

    Hello Friends, putting a new inputfield in the header of ME21N - PO transaction must be inserted within existing tabstrib "Additional Data". This the new requirement. I have used the enhancement "MM06E005". I have only implemented and activated the U

  • Need clarifications on OIM 11gR2

    Friends, I have successfully installed OIM 11gR2 on Linux 64 bit and used weblogic 10.3.6. I have few queries and expecting your expertise. 1) Tried to install JDeveloper on it but it is getting failed saying it is not compatible with middleware. Aft

  • ITV G1 HD Content doesn't xfr to iTunes

    iTV G1 - HD content (movies or tv shows) used to xfr two files to itunes,  HD and regular video file.  Items ordered on iTV never xfrs HD content to iTunes. HD files play on PC in HD.  For example, Billy Joel - Shea Stadium only offered in HD.  Canno