On clicking a button run external class which refrances main application

I have a reader ReadXML and a Jframe Cpass, on clicking a button on Cpass, an new filechooser opens, this then fills the input jtextfiled12 . When clicking "load" button on cpass I need to send jtextfiled12.getText() to ReadXML (this runs, and updates mank text fields on cPass)... but I cant reference from a static context Cpass>>ReadXML>>Cpass.... so having a problem
relevant cPass in cPass.java:
public class Cpass extends javax.swing.JFrame {
public static void main(String args[]) {
Cpass C = new Cpass();
     C.show();
public String getIn() {        return this.jTextField12.getText();         }
relevant ReadXML in ReadXML.java:
public class ReadXML {
private void ReadInXML() throws IOException {
     String XmlInText = Cpass.getIn();
          BufferedReader allData8 = new BufferedReader(new InputStreamReader
(new FileInputStream(new File( XmlInText)),"UTF8")); }
Edited by: Mr_Tuition on Dec 5, 2007 3:44 AM

but since cpass is already running from cpass, i cant reinitialise it, I need to used the insatance that is already shown, since it contains the infomation needed to pass to readXML
public static void main(String args[]) {
   Cpass C = new Cpass();
   C.show();
   }When selectinfg a button on C (which selects the file location), that then opens readXML, I cant open a new version of Cpass (since this wont contain the infomation, eg the file the user has just chosen)
I need to run Cpass
Click a button that selects a file
then file location is set in a text feild on Cpass
on selecting "load" on Cpass, this runs readXML.java
*readXML some how gets the file location from Cpass (which is still C.show();)
the XML is read, and sent back to Cpass via:
          public String[] getStrAllData() {
                  return this.arrayXML;
         }One way arround thios is to copy the readXML function into Cpass but thats just messy
Another would be to write out a "cookie" type file that saves the location, then readXML can use this .. less messy, but not what I wanted.
Edited by: Mr_Tuition on Dec 5, 2007 4:42 AM

Similar Messages

  • How can i run Java class form  other java application.

    Hi ,
    I have problem to run java class from my java application,
    I am using the class ClassLoader in order to launched the Java class , it�s work fine whenever, the class exist in the same folder , however , when i am trying to run class that is not in the current folder ,
    i got error (see below),
    Do you have any idea what is wrong?
    java.lang.ClassNotFoundException
         at SimpleClassLoader.loadClass(SimpleClassLoader.java:110)
         at SimpleClassLoader.loadClass(SimpleClassLoader.java:53)
         at Run.main(Run.java:31)

    What does "run an class" mean? You don't run classes. They're not executables.
    I bet your problem is the classpath. You are aware that the classloader looks only there? Unless it's an UrlClassLoader.

  • How do i run a class which has too many dependencies/class/jar file

    i am very new in java environment, i have developed a class which has to many jar file, it works fun when i run it from ide but problem arise which i wanna run it from command promt like
    java classname
    here is my code
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.util.HashMap;
    import java.util.Map;
    import net.sf.jasperreports.engine.JRException;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperExportManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.JasperReport;
    import net.sf.jasperreports.engine.design.JasperDesign;
    import net.sf.jasperreports.view.JasperViewer;
    public class ReportViewer {
         public static void main(String[] args) {
              try {
                   JasperDesign jasperDesign = JRXmlLoader.load("EmpDeptReport.xml");
                   JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
                   Map parameters = new HashMap();
                   parameters.put("Title", "JasperReport");
                   Connection conn = Database.getConnection();
                   JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,
                             parameters, conn);
                   JasperExportManager.exportReportToPdfFile(jasperPrint, "Sebl_Statement.pdf");
                   JasperViewer.viewReport(jasperPrint);
              } catch (JRException e) {
                   e.printStackTrace();
              } catch (SQLException e) {
                   e.printStackTrace();
    so expert people , please help a novice people.
    [code                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    If you place all of your extra .jar files into a "lib" folder in same folder as your jar file then you can call the java class easily using a script similar to.....
    #--------- runJava.bat file to call java program --------------------
    cp=.
    for f in lib/*.jar; do cp=$cp:$f; done
    java -cp $cp:PROGRAM_JAR_FILE.jar com.myclass.mainclass
    #--------- end script -------------
    This loops over the *.jar files in the lib folder and adds them to the classpath. Please note that ":" is used as a cp seperator since this script was run on linux.
    hth,
    Robin

  • Running external class

    Hi
    i need call some external class from web service method.
    Normally it works, but somehow it doesnt work when i'm calling it from web service.
    Do you know where is problem and how to solve it?
    Thanks in advance.
    code is bellow:
    try {
                String[] cmd = new String[3];
                cmd[0] = "cmd.exe" ;
                cmd[1] = "/C" ;
                cmd[2] = "java -cp lib\\jade.jar;lib\\jadeTools.jar;lib\\iiop.jar;lib\\base64.jar;lib\\http.jar;lib\\log4j-1.2.14.jar;. resender.WatchdogStarter bubak bubu";
                Runtime rt = Runtime.getRuntime();
                Process proc = rt.exec(cmd);
                // any error message?
                StreamGobbler errorGobbler = new
                        StreamGobbler(proc.getErrorStream(), "ERROR");
                // any output?
                StreamGobbler outputGobbler = new
                        StreamGobbler(proc.getInputStream(), "OUTPUT");
                // kick them off
                errorGobbler.start();
                outputGobbler.start();
                // any error???
                int exitVal = proc.waitFor();
                System.out.println("ExitValue: " + exitVal);
            } catch (Throwable t) {
                t.printStackTrace();
            }where StreamGobbler is:
    public class StreamGobbler extends Thread {
        InputStream is;
        String type;
        StreamGobbler(InputStream is, String type) {
            this.is = is;
            this.type = type;
        public void run() {
            try {
                InputStreamReader isr = new InputStreamReader(is);
                BufferedReader br = new BufferedReader(isr);
                String line=null;
                while ( (line = br.readLine()) != null)
                    System.out.println(type + ">" + line);
            } catch (IOException ioe) {
                ioe.printStackTrace();
    }

    solved.
    Problem was that application server couldnt find external class so i
    specified it with absolute path.

  • Run function in component from Main Application

    Hello all.
    I have my main.mxml application, that has a component inside of it.  The component is called <ns1:record/> with an id of "rec".
    This component has a function inside of it named doConnect(event:MouseEvent).
    Now i want to be able to add an event listener to a button on the Main.mxml that will run a function inside the component when clicked.
    I have managed to add an event listener to the Main.mxml that triggers a function held within the Main.mxml when a button clicked inside the component is clicked.
    I did this by using this code.
                <ns1:record id="rec" x="9" y="6" camera="{camera}" microphone="{microphone}" creationComplete="makeEvent()">
                </ns1:record>             //Event listener
                public function makeEvent():void {
                    rec.backbtn.addEventListener(MouseEvent.CLICK,swapstate);
                protected function swapstate(event:MouseEvent):void {
                    viewstack1.selectedChild=config;
    No matter what i try thou i cant get this to work the other way around.
    What i need help with is - clicking a button within the Main.mxml to run a function inside the component Record.
    If anyone can help that would be great !
    Thanks in advance.

    Hi djh88ukwb,
    From your post if I understand you correctly you want to listen for a event in record component when a button in main mxml is clicked...based on this
    assumption I am suggesting you a solution...
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete()">
    <mx:Script>
      <![CDATA[
       private function onButtonClicked(event:MouseEvent):void
       rec.swapstate(event);
      ]]>
    </mx:Script>
    <ns1:record id="rec" x="9" y="6" camera="{camera}" microphone="{microphone}" creationComplete="makeEvent()"></ns1:record>
    <mx:Button id="myBtn" label="Call Function in Record Comp" click="onButtonClicked()" />
    </mx:Application>
    <!-- In your record component Add a public function  swapstate as shown below-->
    public function swapstate(event:MouseEvent):void {
                    viewstack1.selectedChild=config;
    Please try this and let me know....
    Thanks,
    Bhasker

  • Refreshing First View on click of button in second view

    Dear All,
    I have a view in whcih I have a table to display the employee requests.On lead select of table I will display another view
    in which manager can approve or reject the employee request.
    After approving the request if manager clciks on back buton again I am displaying the first view using outbound plug.Here I need not to show the approved or rejected request in the table.
    But on click of back button the first view is not getting refreshed it is still showing the approved request in the table.
    If I refresh using F5 the approved request is disapearing.
    Please help in refresing the screen on clcik of back button in second screen.
    Thanks,
    Reddy.

    when you click on the back button , the first view still has the old values....
    when you press F5, the logic which you have used to display the data in view one, gets triggered and that is the reason the approved request disappears...
    on click of the back button, run the logic which you have used to display the data in view 1, place the logic in component controller so that you can use it globally. when pressed back, trigger the global method and it witll bind the data which doesnt have approved request

  • External Classes

    I've been looking around and I've failed to find a way (or I messed up somewhere) to have an applet use an external class which, in turn, uses objects of the applet. In example, you have main.class which has a drawing area, and you have picture.class which is supposed to draw a picture in the drawing area of main.class. I'm asking that someone explains what I add in main.java for it to use picture.java, and what I add in picture.java for it to be able to make use of objects in main.java... I hope I explained this well enough, and replies are appreciated.
    (main.java has a Graphics object and makes an instance of the picture class, to which it passes the parameters Something.jpg, and picture.java then draws Something.jpg on main.java's Graphics object... This is all strictly in example.)

    Yeah, I'm starting to see what you mean by implementing some sort of Getter. Right now, example-wise, I have the Picture class inside of Main.java, and that works fine, since it then has access to the Graphics object, but java compiles them into two separate class files, Main.class, and Main$Picture.class, but I want to separate the two classes and have two separate java files, but since Picture wouldn't have access to the Graphics object, it's not as simple as just making a new file called Picture.java. So yeah, I see what you mean, since Picture doesn't have direct access to the Graphics object, have picture send what it wants to do back to Main, since it has access to the Graphics object, I just don't know how to implement it.

  • How to run a simple program with main?

    I have a simple class with main, something like the following:
    public static void main(String[] args) {
    Is it possible to run / execute this main from within workshop?

    In SP2 we've made it very easy to automatically set the main class name
    when you first try to run a class in a Java project that doesn't have
    already have debugging configured.
    More generalized ways to easily run a class with a main method are
    already on the list for the next release.
    Thanks for the feedback,
    Josh
    Carl wrote:
    Thanks, that worked:)
    Workshop should consider dealing with simple classes with main much
    simpler...
    "Josh Eckels" <[email protected]> wrote in message
    news:3f96f8c1$[email protected]..
    Yes, you can run and debug it, but it needs to be in a Java project. If
    it's not already in one, create a new Java project and copy in the
    source. Go to the Project Properties, and select the Debugger settings.
    Enter the class that contains the main method. If you'd like, you can
    set the checkbox for Build before Debugging so that you are always
    running off the current source code.
    You should then be able to run the project after building it.
    Josh
    Carl wrote:
    I have a simple class with main, something like the following:
    public static void main(String[] args) {
    Is it possible to run / execute this main from within workshop?

  • Friend help me to fix my laptop and runing the program Piriform CCleaner and is finish but which button should I click - Analyze or Run Cleaner

    Need a big help!! A Friend help me to fix my laptop and runing the program Piriform CCleaner and is finish but which button should I click - Analyze or Run Cleaner

    Laptop? this is the ipad forum.
    Is your laptop a macbook? If so I can have the hosts move your post there
    But for specific info about a non-apple program, the best place to look is on the site for the program you're using, In your case Piriform's site.

  • On click Image button links to extern. file - but then advances forward a slide....

    I have an image button that On Success links to an extern. file - which is an index/glossary of a the project modules. However, when clicked, the project moves forward a slide. I would like the project to remain on the same slide when the 'Glossary/index' button is clicked, rather than advance forward. Anyone know how to achieve this?
    Thanks in advance,
    Rich

    Hi and thanks very much for the response. I'm sure I'll be around here for a while on the forums as I've just started using Captivate!
    As you say the button when clicked releases the playhead and the timeline advances to the next slide, which then pauses as I have 'next/back slide' buttons on each slide (sorry i didn't mean to imply it immediatley skips to the next slide).
    Although this is normal behaviour for the image button, I need a work-around as the button in this instance is merely meant to open an external 'pop-up' of the index (of all the learning modules) for the learner, rather than effect anything on the actual module being currently used.
    Sounds like you're application of 'Assign rdcmndGotoFrame with rdinfoCurrentFrame' would be perfect - however I am a novice with Captivate so would greatly appreciate any info on how to apply this work-around to my Glossary button (baring in mind the Action On Success property is already used to open the pop-up - but I assume the 'Assign rdcmndGotoFrame with rdinfoCurrentFrame' is applied using another property?)
    Thanks very much for your help,
    R

  • Run a function in flash when click a button on HTML page

    dear friends,
    i have loaded my swf in an html/ aspx page. when i click a button in html page, i want to pause my swf movie. Actually swf has another movie clip i want to stop that. any option pls help me. possible send me some sample coadings.. i tried with externalInterface but no result..
    or if i click a button in html page, i want to run a function existing in loaded swf....
    thanks in advance...
    Thanks and Regards,
    Syed Abdul Rahim

    Dear Mr.ned,
    Greetings! i tried to put the id also, still its not working.. any ideas? find below my codings:
    flash code:
    import flash.external.ExternalInterface;
    ExternalInterface.addCallback("methodName", method );
    function method() {
        mytxt.text = "call from java script";
        trace("called from javascript");
    HTML code:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>jscr_rd</title>
    <script language="javascript">AC_FL_RunContent = 0;</script>
    <script src="AC_RunActiveContent.js" language="javascript"></script>
    </head>
    <body bgcolor="#ffffff">
    <p>
      <!--url's used in the movie-->
      <!--text used in the movie-->
      <!--
    <p align="left"></p>
    -->
      <!-- saved from url=(0013)about:internet -->
      </script>
      <script language="javascript" type="text" >
    function methodName() {
       jscr_rd.method();
       window.alert("hi.. u clicked me?");
    </script>
      <script language="javascript">
        if (AC_FL_RunContent == 0) {
            alert("This page requires AC_RunActiveContent.js.");
        } else {
            AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','widt h','550','height','400','id','jscr_rd','align','middle','src','jscr_rd','quality','high',' bgcolor','#ffffff','name','jscr_rd','allowscriptaccess','sameDomain','allowfullscreen','fa lse','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','jscr_rd' ); //end AC code
    </script>
      <noscript>
        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="550" height="400" id="jscr_rd" align="middle">
          <param name="allowScriptAccess" value="sameDomain" />
          <param name="allowFullScreen" value="false" />
          <param name="movie" value="jscr_rd.swf" />
          <param name="quality" value="high" />
          <param name="bgcolor" value="#ffffff" />   
          <embed src="jscr_rd.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="jscr_rd" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />   
      </object>
      </noscript>
    </p>
    <form name="form1" method="post" action="">
    <input name="but" type="button" value="click me" onClick="methodName()">
    </form>
    <p> </p>
    </body>
    </html>
    pls check advice me
    Thanks and Regards,
    Syed Abdul Rahim

  • Run external exe program from APEX button

    Hi,
    I want to run external programs like EXCEL or Word called from an APEX button.
    Does anyone hav an idea?
    Regards,
    Siegwin

    Hi Siegwin,
    To my knowledge, there are two possibilities running apps on the client side: Either user IE with ActiveX or create your own browser and deploy it with the application.
    I did this using the WebKit browser which comes free with the Qute-Framework. It works very well, the only thing I need to do is create a link that starts with os:// to start an external application and hand parameters over. The browser is a minimal browser component, strong enough to run Flash and enabled to interact with the local computer. Deployment of this C++ application is a simple copy to a network device. This approach gave me piece of mind in regard to compatibility issues as well. The browser is a simple window that even don't allow for direct address entering, therefore the Apex-application looks like a normal application then and is unable to connect to any other internet resource other than the APEX applicaiton itself.
    To the others moaning about this security whole: There are situations where you need something like this, fi in intranet environments where you want to enable APEX to interact with the local environment. So I think it's a valid request.
    Best regards,
    Jürgen

  • Trying to makea report run when clicking a button on a form

    I am trying to run a report by clicking a button on a form (Forms 9i)
    I have modified the registry settings for FORMS90_PATH and REPORTS_PATH to include my development directory, and now at last the report is generating. However the command to display the form in a window is not doing anything at all - no error even. Can someone please help, the trigger code for my button is displayed below:
    DECLARE
         rep_result VARCHAR2(30);
    BEGIN
         SET_REPORT_OBJECT_PROPERTY('INVENTORY_REPORT', REPORT_FILENAME, :GLOBAL.project_path || 'Inventory.rdf');
         SET_REPORT_OBJECT_PROPERTY('INVENTORY_REPORT', REPORT_DESNAME, :GLOBAL.project_path || 'Inventory.htm');
         rep_result := RUN_REPORT_OBJECT('INVENTORY_REPORT');
         --MESSAGE('Rep result: ' || rep_result);
         WEB.SHOW_DOCUMENT('file:///' || :GLOBAL.project_path || 'Inventory.htm', '_blank');
         --WEB.SHOW_DOCUMENT('file:///C:\Temp\Dev\Inventory.htm', '_blank');
    END;
    thx
    adam

    Hi,
    may be this could be helpful for you:
    You have to include the following code to execute a report:
    repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status Varchar2(20);
    BEGIN
    repid := find_report_object(report_name);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,BATCH);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'pdf');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,report_server_name);
    v_rep := RUN_REPORT_OBJECT(repid);
    rep_status := report_object_status(v_rep);
    WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED') LOOP
    rep_status := report_object_status(v_rep);
    END LOOP;
    if rep_status = 'FINISHED' then
    WEB.SHOW_DOCUMENT('/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=repserver90','_blank');
    else
    error report not exists
    end if;
    END;
    Also you have to create the report server with the command:
    "rwserver - install service_name autostart=yes
    report server name must be the same that appears in the code above
    You must add the report to run in the REPORT object type in your .fmb and put there with the same name
    The report server to install ought to be the one and only in you network to avoid mistakes...

  • When I connect an external drive I'd like to run a program which is on it. How could I do that?

    When I connect an external drive I'd like to run a program which is on it. How could I do that?
    I tried automator, but without success.
    Thanks

    Interesting question.  Others have provided the direct answer (no, massive security hole), and a little time with a search engine finds various existing discussions of autorun-related topics (eg: here and here and here), and a link to the Do Something When tool, and there is the DeviceListener example in the Xcode kit and to adding a folder action where the volumes are mounted.  See the topics for details.   Haven't tried this stuff, though.

  • Letting user to click a button and run an application

    Hi all,
    I'm trying to do this: once the user logged on, the user can click a button to run an application. If it's the first time he/she use it, it'll let user to download the program and then run it. How can I do that?
    Thank you.
    Cal

    Find out about Java Web Start.

Maybe you are looking for

  • Getting text messages back

        So I was having horrible battery problems and instead of Apple replacing the phone they told me to restore as new phone and to NOT restore from a backup.  I hated to do that, but I finally got it done after an hour or two of manually downloading

  • Queries on OVS

    Hi I need pointers on follwoing: - Is there a way to change the search icon which comes with OVS functionality to some other icon? - Also, if i want to open up a new screen depending on the selection from the OVS o/p table, I had put the code in the

  • Problems with certain keys...

    Hello everyone. I am having someo problems with my keyboard on my ibook g4, using os 10.3.5, and was wondering if anyone has experienced this and what might be wrong. e " key creates è, and to get a quote i have to type shift and the right angle brac

  • Quicktime player messing up video visual

    Used to be able to view any video file from my digital camera in Windows Media Player, then downloaded Quicktime and all my existing video files converted to say Quicktime Movie under file type. Now cannot play any of them properly in WMP, just get a

  • Is there a fast way to remove duplicate files from itunes?

    I relocated a lot of my music on my computer to a single folder so there would be less clutter. So far as I know there is no easy way to relocate all of my music without going through each song one by one, and I have a rediculous amount of music so t