Calling a function with a frame isnt working

now i have a problem :
i have made a function called showFrame and i call it from another class and it isnt working :
the problem is on line marked as *** where i call to showFrame()
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Date;
public class colorsMain {
    static daromConnect myCon = new daromConnect();
    static long pNextTime = 1000;
    public static void main(String[] args) {
        try {
            myMsg.write("ss");
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use Options | File Templates.
        new Thread(new Runnable() {
            public void run() {
                while (true) {
                    try {
                        Thread.sleep(pNextTime);
                    } catch (Exception e) {
                        System.out.println("Error :" + e.getLocalizedMessage() + " at : " + new Date());
                    System.out.println("10 seconds");
                    myCon.showFrame();///****problem on this line
                                        pNextTime = 1000 * 60 * 5;
                    //   System.exit(0);
        System.exit(0);
CODE]
and the second class with showFrame :import JavaCom.atidProgram;
import JavaCom.atidProgramsGroup;
import JavaCom.atidRecordSet;
import javax.swing.*;
import java.util.Date;
import java.lang.*;
import java.sql.*;
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.lang.String;
import java.awt.*;
import java.text.*;
public class daromConnect {
private static boolean pIsWorking = false;
private static int pTimeFromDarom = 30;
private static JFrame jf = null;
private static JLabel label2 = null;
public static void SetTotalTimeFromDarom(int tm) {
pTimeFromDarom = tm;
public static boolean getIsWorking() {
return pIsWorking;
private static void setIsWorking(boolean flag) {
pIsWorking = flag;
private static int getIndex(String str, final String[][] unit_table) {
for (int i = 0; i < unit_table[0].length; ++i) {
if (unit_table[0].equals(str) == true || unit_table[1][i].equals(str)==true)
return i;
return 0;
public static void showFrame() {//this is the function i call
jf = new JFrame();
label2 = new JLabel("000");
label2.setSize(30, 300);
label2.setFont(Font.decode("Web Hebrew AD"));
jf.getContentPane().add(label2);
jf.pack();
jf.setVisible(true);
public static void main(String[] args) {
setIsWorking(false);
why isnt it working?
thnaks in advance
peleg

Right off the bat I can see that you aren't starting the thread. Try:
    Thread t = new Thread(new Runnable()
      public void run()
    t.start();

Similar Messages

  • How to call a function with pl/sql

    How does one call a function with pl/sql that uses a function?

    Hi,
    How does one call a function with pl/sql that uses a
    function?I'm not sure what you mean.
    In PL/SQL function can be used just about anywhere where an expression (with the same data type that the function returns). Arpit gave a very common example.
    Here's another example, where all the functions take a single NUMBER argument and return a NUMBER, so they can all be used in places where NUMBERs are used:
    IF  fun_a (fun_b (0)) < fun_c (1)
    THEN
        UPDATE  table_x
        SET     column_y = fun_d (2)
        WHERE   column_z = fun_e (ROUND ((fun_f (3), fun_g (4)));You call a function simply by using its name, followed by its argument list, if any.
    If the function is in a package, you must call it with the package name, like "pk_foo.bar (1, 2, 3)", unless the call comes from within the same package.
    If the function is owned by someone else, you must give the owner name, like "scott.bar (SYSDATE)" or "scott.pk_foo.bar (1, 2, 3)". You can create synonyms to avoid having to name the owner.

  • Call outside function with same name in a package

    I created a function as follows:
    create or replace function f1 return number
    is
    begin
    return 1;
    end;
    This f1 is to be called in a package created below.
    Then I create a package with a function in it, as follows:
    create or replace package pack1 as
    function f1 return number;
    end;
    Now I define the package body as follows:
    create or replace package body pack1 as
    function f1 return number as
    -- I am trying to call the first function f1 defined above here
    How do I resolve the name issues here?
    In other words, I want to call a function with the same signature outside a package.
    Thanks for your kind help.

    Hi,
    Welcome to the forum!
    Do you have a good reason for using the same name?
    Refer to the stand-alone function with the owner name, even though it's your current schema.
    That is, even if the package and the stand-alone function are owned by scott, in the package, say
    x := scott.f1;

  • Is there a way to call a function with in the initializer of a ArrayCollection?

        Is there a way to call a function with in the initializer of a ArrayCollection?
    It won't let me do this:
    var ac:ArrayCollection = new ArrayCollection([
                        {childName:'addTrade',index:addTradeIndex },
                        {childName:'tradeList',dealsCanvas.getChildIndex(tradeList) }

    The correct syntax is
    var ac:ArrayCollection = new ArrayCollection([
                        {childName:'addTrade',index:addTradeIndex },
                        {childName:'tradeList',index:dealsCanvas.getChildIndex(tradeList) }

  • How to call a function with event

    How do I call a function with a event inside it?
    function showTopTen(e:Event):void
        highscoreData = new XML(e.target.data);
        trace("Hiscores: " + highscoreData.item[0].name.text() + " - " + highscoreData.item[0].score.text())
    //showTopTen();  ..??

    Could you indicate why you would want to?
    The eventhandler you show here uses the properties of the event object passed as an argument.
    The way I read it it is data retrieved from a server so your app won't know anything about is untill it is loaded from the server which should be done with an URLLoader object which in it's turn calls your eventHandler when the Event.COMPLETE is triggered.
    something like:
    var urlLoader = new URLLoader();
    urlLoader.addEventListener( Event.COMPLETE, showTopTen )
    urlLoader.load( new URLRequest( "http:// etc." ) );
    to me would seem the proper method to have the function execute.

  • How to call java function with parameter from javascript in adf mobile?

    how to call java function with parameter from javascript in adf mobile?

    The ADF Mobile Container Utilities API may be used from JavaScript or Java.
    Application Container APIs - 11g Release 2 (11.1.2.4.0)

  • How to call a function with parameters in ScriptStart function

    i am trying to call ScriptStart function from SUD dialog. This is how iam calling Call ScriptStart(path & "test.vbs","abc") abc is function which is written test.vbs. It is working. But when i want to pass some parameters to the abc function of test.vbs. It is not working why. can anybody suggest where i went wrong. I am calling the same function as Call ScriptStart(path & "test.vbs","abc(" & text1.Text & ")"). It is not working why ? Is the ScriptStart function only point to functions. it does not take any parameters or waht ?

    Hi abc421,
    Another option in addition to UserCommands would be to use ScriptInclude(path). If you execute a ScriptInclude(path) command at the beginning of your VBScript, then all the functions and Subs in the VBscript located at "path" are now available to you-- including passing parameters and receiving return values from functions. If you are calling a VBscript that uses only VBScript variables, then this is the preferred method.
    If instead you are calling a VBScript that uses global DIAdem variables declared in a VAS file (their variable names all end with the "_" character), then those parameters are already available at the subroutine called with ScriptStart(path, routine).
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Call a function with tables in a FORM

    Hi all,
    I am currently willing to create a FORM that would call a function (which has a table in its parameters).
    In the form, I modify the fields of this table, and then I call the function.
    I put the table in the FORM parameters (either 'USING' or 'TABLES').
    Problem is: the syntax check keeps on telling me that my internal table is not correctly defined (missing the statement 'OCCURS 0') and won't compile.
    I tried to add this statement 'OCCURS 0', even 'WITH HEADER LINE', but I cannot make it work.
    Can anyone help ?
    Thx a lot.
    Isa.

    Hi,
    Declare a Ztable inside the form of the type declared in the FM with a header line.Assign the fields that u require to pass through the table and append to this Ztable.
    Now pass this Ztable to the parameters of the FM.
    This should help u out...
    Mark useful answers...

  • How to call javascript function with dynamic data in display tag

    Hi,
    Iam new to pagination concept. Iam using display tag to display rows in jsp by strtus.
    I have a problem when calling the javascript function using ahref in attribute in display tag.
    <bean:define name="form1" property="EditDetails.List" id="ListDisplay"/>
    <display:table name="pageScope.ListDisplay" cellpadding="0" cellspacing="1" pagesize="10" partialList="false" size="listSize" requestURI="">
    <display:column property="poNo" href='javascript:searchEditDetails("./submitOrder.do? actionID=getMISLoadEdit&poNumberSel=<%=((com.po.bean.EditDetails)poListDisplay).getNo()%>&statusIdSelected=<%=((com.po.bean.EditDetails)ListDisplay).getStatusId()%>")'
    title="Number"/>                         
    <display:column property="strDate"title="Date" />
    <display:column property="orderValue"title="Order Value(INR)"/>
    <display:column property="stringRequestedDeliveryDate"title="Suggested Delivery Date"/>
    <display:column property="statusDescription" title="Status" />
    </display:table>
    The above code display the data in row format is working fine when I click the No It thow javascript error and its not redirecting to the other page.
    When I try this with ordinary struts its working fine the code is:
    <logic:iterate id="polist" name="Form1" property="EditDetails.List" indexId="i" type="com.bean.EditDetails">
    <tr>
    <td ><a href="javascript:searchEditDetails("./submitOrder.do?actionID=getMISLoadEdit&NumberSel=<%=((com.bean.EditDetails)polist).getNo()%>&statusIdSelected=<%=((com.bean.EditDetails)polist).getStatusId()%>")"><html:hidden name="polist" property="No" write="true" /></a>     </td>
    <td><html:hidden name="polist" property="strDate" write="true" /></td>
    <td><html:hidden name="polist" property="orderValue" write="true" /></td>
    <td><html:hidden name="polist" property="stringRequestedDeliveryDate" write="true" />     </td>
    <td><html:hidden name="polist" property="statusDescription" write="true" /></td>
    </tr>
    </logic:iterate>
    Please help me how to call javascript with dynamic data.
    Thanks in advance

    The ADF Mobile Container Utilities API may be used from JavaScript or Java.
    Application Container APIs - 11g Release 2 (11.1.2.4.0)

  • Can I call a function with an arguement of %ROWTYPE directly from SQL?

    I have the following function in a 10g DB:
    CREATE OR REPLACE FUNCTION f_is_eligible2 (in_dm_row IN amplify_dm%ROWTYPE)
    RETURN NUMBER
    IS
    I know I can call that function from another pl/sql function but I'm wondering if I can call that function directly from a SQL statement, something like this:
    SELECT f_is_eligible2(dm.*)
    FROM amplify_dm dm
    or
    SELECT f_is_eligible2(dm%rowtype)
    FROM amplify_dm dm
    neither of those worked so I'm thinking it's not possible but I thought I'd ask anyway.
    Thanks in advance!

    Not possible as said - but - based on what I'm seeing - you could simply pass the parameter(s) that are key on that table and - accomplish the same thing by modifying the function.
    not sure why you'd need the whole row if I'm interpretting the code excerpt.

  • Dot source/calling a function with switch from the cmd line

    Hi
    This is driving me crazy and I know its something really obvious.
    If I have an example script like so, called myexample.ps1
    [CmdletBinding()]
    param
    [Parameter(Mandatory=$false, HelpMessage="My Switch")]
    [switch] $Myswitch,
    [Parameter(Mandatory=$false, HelpMessage="Email Address")]
    [string] $email
    Function Main
    [CmdletBinding()]
    param
    [switch] $Myswitch,
    [string] $email
    if ($Myswitch)
    Write-Host "Switch Enabled"
    Write-Host "Email is $email"
    else
    Write-Host "Switch Disabled"
    Write-Host "Email is $email"
    Main -email $email #This is the line that I think is at fault
    I have two issues
    1) How do I correctly write the code so that the script can be called with either or both parameters. The switch ($Myswitch) is the one that is really causing me issues.
    2) Is invoking it the easiest method/best/most common method of calling it via a batch file
    Here's my understanding
    a) I could dot source it (. .\myexample.ps1) to load the functions into the current session, then call the function
    Main -email hello.com -Myswitch
    or
    Main -email hello.com
    b) or I could Invoke it, which I think is my preference as my final goal here is for it to be called via a batch file in a scheduled task
    & 'C:\Users\myusername\Desktop\MyExample.ps1' -email hello -myswitch
    or
    & 'C:\Users\myusername\Desktop\MyExample.ps1' -email hello
    Any push in the right direction will be appreciated :)

    Why the function?  Just call the file.  We don't "Invoke" scripts. Just call the script..
    # MyExample.ps1
    [CmdletBinding()]
    param(
    [Parameter(Mandatory=$false, HelpMessage="My Switch")]
    [switch] $Myswitch,
    [Parameter(Mandatory=$false, HelpMessage="Email Address")]
    [string] $email
    if ($Myswitch){
    Write-Host "Switch Enabled"
    Write-Host "Email is $email"
    }else{
    Write-Host "Switch Disabled"
    Write-Host "Email is $email"
    Now jsut call it like a normal script:
    .\MyExample.ps1 -email someemail -MySwitch
    It is as simple as that.
    If it has to be a function as in a library then you must either dot source or create a module.
    ¯\_(ツ)_/¯

  • Call a function with variable function name

    Hey guys,
    I have a func_table which maintains function names (each one makes reference to a dynamically generated stored function)
    I need to make a procedure that calls the functions in that table one by one using its name retrieved from SELECT func_name FROM func_table;
    Thanks

    929955 wrote:
    I have a func_table which maintains function names (each one makes reference to a dynamically generated stored function)
    I need to make a procedure that calls the functions in that table one by one using its name retrieved from SELECT func_name FROM func_table;Okay, first the bit where I, foaming at mouth and vigorously waving a well used lead pipe around, tell you that this is HIGHLY SUSPECT and likely a FLAWED DESIGN. That dynamic code is 99% of the time wrong. That dynamic code opens securities hole for code injection. That dynamic code often results in severe performance penalties as the coder is clueless about what the Oracle Shared Pool is about. And so on...
    As for a basic procedure template to do this - assuming all functions get the same parameter as input and that all functions returns the same data type:
    create or replace procedure FooBarFunctions( paramVal number ) is
      .. variables and types and cursor definitions..
    begin
      for c in (
        select function_name from my_fubar_functions order by function_order
      ) loop
          plsqlBlock := 'begin :result := '||c.function_name||'( param => :p ); end;';
          execute immediate plsqlBlock using out funcResult, in paramVal;
          .. do something with funcResult ..
      end loop;
      .. more code..
    end;
    {code}
    Looks not like a sensible approach though - and begs for justification as to why this approach is needed. What justification do you have?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • VC++ WebBrowser call Javascript function in a frame of the main page

    I can successfully call JS function in the main page from VC++, but when I call the JS function in frame, GetIDsOfNames() return DISP_E_UNKNOWNNAME. The question can be describe as below:
    main page is INDEX.HTM, loaded in webbrowser control, src:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Sample</title>    
        <script type="text/javascript">
    function FuncMain()
    alert("Main Page Function Called!");
        </script>
    </head>
    <body>
    <div>
      <div id="div_test1">
        <iframe id="page_test1" width="100%" height="100%" src="test1.htm" frameborder="0" scrolling="no"></iframe>
      </div>
      <div id="div_test2">
        <iframe id="page_test2" width="100%" height="100%" src="test2.htm" frameborder="0" scrolling="no"></iframe>
      </div>
    </div>
    </body>
    </html>
    test1.htm src:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <body>
    <div>Test1 frame page</div>
    </body>
    </html>
    test2.htm src:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript">
         function showAlert(x)
    alert(x);
     function callVC()
    window.external.VCFuncTest();
        </script>
    </head>
    <body>
    <div>Test2 frame page</div>
    <div id="test_btn" style="background-color:red;width:100px;height:100px;cursor:pointer;" onclick="callVC();">Test</div>
    </body>
    </html>
    in VC++:
    VC++ code can call JS functions by CWebPage class, I found it here:  http://www.codeproject.com/Articles/2352/JavaScript-call-from-C
    in my VC project, webPage.CallJScript(_T("FuncMain")) succeeded!
    webPage.CallJScript(_T("page_test2.showAlert") failed,  the GetIDsOfNames() return DISP_E_UNKNOWNNAME. BTW, webPage.CallJScript(_T("showAlert")
    also failed! Same error.
    any help?
    Best Regards!

    Thanks for your reply Viorel_.
    i know i can define a function in the main page: 
    function showAlert_Main(x)
            document.frames('page_test2').showAlert(x);
    then, webPage.CallJScript(_T("showAlert_Main"))
    succeeds.
    but this function is just an empty shell doing nothing, and i know there must have a way to call showAlert(x) directly.

  • Call Plugin-Function with parameters via JavaScript

    Hi!
    I have following problem: I wrote a plugin for Illustrator CS2 in C++ and now I would like to call a function of the plugin from outside of illustrator (from a JavaScript).
    This can be done with the Actionsuite. But how could I then give some parameters to my function?
    For example:
    In the plugin, I have a function "void myFun(char * test)" and I want to call this function in JavaScript with test="Hello World" for example.
    The only possible way right now seems to write parameters into a file and open that file in the plugin to "receive" them.

    Hi,
    Could you send your plugin coding.
    Regards,
    Maria

  • I am trying to call a function with LABVIEW developed in CCS compiler

    I used MPLAB (CCS compiler) to develop c code that is used to transmit and receive messages to and from an automotive display. It works great as a stand alone. I would like to call this function from LABVIEW but am having difficulty doing so. Does anyone have experience calling a MPLAB developed project from LABVIEW? Thanks in advance.
    Matt

    PTE wrote:
    I used MPLAB (CCS compiler) to develop c code that is used to transmit and receive messages to and from an automotive display. It works great as a stand alone. I would like to call this function from LABVIEW but am having difficulty doing so. Does anyone have experience calling a MPLAB developed project from LABVIEW? Thanks in advance.
    Matt
    MPLab is for programming PICs if I'm not mistaken. I'm not sure how you would want to call a function compiled in MPLab from LabVIEW directly. MPLab will create binary code for execution on PICs and there is no LabVIEW that could run on a PIC. On the other hand I didn't think you could create standard Windows DLLs, Mac shared libraries or similar in MPLab at all.
    You will have to recompile your code in a C compiler that can create the standard shared library format for the plaform you want to call it from LabVIEW.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for

  • Error during SC to PO: Recipient not found

    Hi Gurus,   I am working on SAP SRM 7.0. The SRM system is configured in such a way all shopping carts (SC) will create a PR in ECC , but according to requirement for some conditions SC will create PO in ECC system. I have implemented 2 BADI's (BBP_T

  • NEWBIE NEED HELP INSTALLING SOLARIS 8

    I have a Sparc 20 workstation and having difficulty setting the OS. I have download the installation CD and the 2 software CDs. During the installation, when it gets to the kiosk, there should be a welcome screen asking to insert the first software c

  • VM inventory with PowerCLI - number of virtual sockets

    Hi to everyone. I am relatively new to PowerCLI although I have experience in working with PowerShell so logic behind PowerCLI is familiar to me. Today I was given a task to create a report for all virtualized SQL servers containing info about number

  • Download Dreamweaver CC Trial

    Hello I want to download Dreamweaver CC trial version. I have logged in to my account but I can see oly the Join button \s as active. The 30 days Trial Button is inactive and am not able to see the download option for Dreamweaver CC Can you please he

  • Exchange 2013 mailflow and the Hosts file

    Hello!  Recently I expirienced the issue with missing messages ( http://social.technet.microsoft.com/Forums/en-US/20745ec5-e311-4bc0-b1bd-aff3f7c82fd1/missing-messages?forum=exchangesvradmin ) and although that thread is not answered yet I would like