Executing Javascript into java GUI

Hello Everyone
I need to make some gauges and indicators to be shown in a java gui industrial application. I did not found good and free(that permits using the library in commercial apps) libraries for importing gauges and indicators in java.
I have found a very good site, that offers some free nice gauges written in javascript and intended to be shown on html pages:
http://www.bindows.net/free_gauges/
Is not there any workaround to import such javascript gauges into a java GUI application ??
Thanks

"The Mozilla Rhino engine for the JavaScript programming language, however, is currently included as a feature in the JDK 6 and JRE 6 libraries." (source: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/)
However, the problem here is that Java is not a web browser. These GUI elements would likely make use of HTML, CSS and APIs that are only implemented in a browser. To use them outside of a browser would, as already stated, require most of a browser to be coded. Quite a large effort just for some pretty GUI elements.

Similar Messages

  • How do i show javascript into  java application?

    hi
    ( please help me!!!!!!!!!!!!!!!!!)
    how do i run javascript into java application ?( looks like microsoft frontpage )
    thank you ?

    There is a JavaScript interpreter called Rhino implemented in Java, maybe you can use it: http://www.mozilla.org/rhino/

  • Embed VLC media player into java GUI

    Hi
    Does anybody knows how to embed VLC media player into java GUI.
    thanks

    palakk wrote:
    Hi
    Does anybody knows how to embed VLC media player into java GUI.
    thanksWhat did you find when you googled it?

  • Integrating Another Program Into A Java GUI

    HI
    I have 3 classes here. One is a Java GUI, the other two are involed in
    stripping and processing of information off a webpage.
    Of these latter two classes, one contains a main method which connects
    to a webpage and reads the info off it, it calls the other class which
    parses this information and holds the variables I need to create
    buttons for the main gui!
    Is it possible at all to integrate, the class that reads the webpage,
    into, the Java GUI class.I need to do this to access the variables
    that the parsing class is holding, as previously I have had to create
    an instance of this class in the webpage reader class, but this was no
    good to me as the GUI could not access this information, i.e can I
    create an instance of this stripper at the begining of main in the GUI
    class so as I can use the results for this for producing my buttons?
    I've tried to do this but I am getting unresolved symbol errors. I was
    wondering should I use global variables to hold the needed info also ?
    Any help at all greatly appreciated,
    Thanks
    Gerry

    I did what you're describing. Sounded simple enough. You put the same logic in main() into the applets init() and you can run as app or applet. Worked well in my IDE. Then the troubles start.
    Visit
    http://www.martinrinehart.com
    and read the Article, Launching Applets. That will get you started on launching a Swing application. (Try my Sample, DawnPainter, to give you an idea about how nice this can be when it works.) I promise but don't deliver (yet) an article on the javascript library I wrote that solves all the problems. For non-commercial use you can get your own copy:
    http://www.martinrinehart.com/examples/launchApplet.js

  • Design GUI in VB, put it into Java code !!!!

    Hi Guys!
    I have just developed software named Xtreme VB2J that builds java classes from the Visual Basic form files (.frm). Java does not have any built-in Integrated Development Environment (IDE) for Graphical User Interface (GUI) design; on the other hand, Visual Basic (VB) has a very nice and easy IDE for GUI design. This software is just an preliminary approach to integrate the power of EASY-GUI-Design of VB and Java to reduce wastage of a-lot-of time in software development.
    Before Running VB2J
    Since this software originally has been designed in Visual Basic, before running, your computer must have Visual Basic Runtime files or Visual Basic itself installed. You may obtain it from MyDownload section of my website or directly from: http://download.microsoft.com/download/vb60pro/install/6/Win98Me/EN-US/VBRun60.exe
    Hope you won�t be sick of Layout Managers anymore!! :)
    Try it today from the MyDownload section at: www.tanzimsaqib.tk
    Happy GUI design!! :D
    Thank you!
    -- Md. Tanzim Saqib
    [ www.tanzimsaqib.tk ]

    Obviously Zim you are not up to date on what is available for Java GUI building and what IDEs are out there. There are a host of products already available for free that far surpass anything I've used in VB (and I've developed with all flavors of VB for over 10 years now).
    Come away from the dark side and into the light.
    BTW: you don't have to use layout managers in Java either, but then just why wouldn't you want your application to resize smoothly?

  • Execute Javascript from our JAVA code

    Hi all,
    I have a question:
    It's possible to execute a javascript code from the back bean page. For example , we execute a button action (Conect to a db, insert data) and if all it's ok we execute a simple alert ("The insert is ok!!");
    Any way to do this??
    Thx!

    I don't know enough about Javascript, but I don't think it can be executed from within Java code.
    If you can't, an alternative is to provide a status code and/or status message that is accessible to the page. There are a number of ways to do this. One option is to put the information in a hidden field. Another option is to put the information in a session bean and add appropriate JSP code to your page to get that information.
    You can link a Javascript function to the page's onLoad event. The function can get the status code/status message and create the alert.

  • Compiling and executing with differente Java version

    Hello,
    I'd like to know what problems might cause compiling with a versión (1.4.2) and executing the program with a different version of Java (1.5 for example).
    Or where can I find tha information
    thanks!

    sabre150 wrote:
    da.futt wrote:
    Care to elaborate?I have enough trouble remembering my own name never mind stuff over two years old. There's a name for that, you know? Though I seem to have forgotten what it was.
    I do remember having to re-write all the bespoke renderers and to have to change the layout approach due to changes in default Font sizes.Ooh, nasty! Must have quite a quagmire, that code.
    On the other hand and getting back to the OP's question, that's more of a difference in the platform than the interpreter, isn't it? I suppose you could run into the same trouble "porting" a Java GUI to, say, *nix, when it had been tailored to peculiarities of the Windoze L&F.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • COMMUNICATION BETWEEN JAVASCRIPT AND JAVA APPLET: US$20 AWARD FOR SOLUTION!

    COMMUNICATION BETWEEN JAVASCRIPT AND JAVA APPLET PROBLEM (Easy Filter Java Applet) -
    US$20 TO ANYONE WHO CAN RESOLVE THE PROBLEM
    To forum visitors:
    I am prepared to pay a standard shareware fee of US$20 to a user who can resolve this technical problem.
    If your advice resolves the problem, I'll forward the payment to your postal address (include your
    address with your reply, and also your email address)
    I am attempting to enable a HTML button (using Javascript's onClick command) to directly input a number into one of the parameter text boxes in the Easy Filter Java applet (ie, enter a new color value number in the text field of the standard Colors Multiplicator Filter interface).
    The applet is Freeware and can be downloaded at: http://www.javazoom.net/applets/easyfilter10/EasyFilter10.html
    (It is a very effective bitmap display and editing utility)
    To achieve this, I am trying to access the part of the applet that defines and sets the textbox. The text box is defined in the .class file by accessing the parameter details in the genericfilter.txt file (accompanies the .class files). I need to access 'private String appletInitialize()' and then one of the 'textFieldParameters' which sets the textbox.
    I understand the basic syntax for referencing the applet:
    document.appletname.setString("An example"). However, accessing the text fields in this applet is more complex!!
    Please can you recommend the correct Javascript syntax to achieve communication with the applet.
    Thank you for your kind assistance.
    JM Graham
    [email protected]
    The Java source code for the applet: EasyFilter.class
    # Easy Filter - E.B/JavaZOOM 1999 #
    # Contact: [email protected] #
    # http://javazoom.hypermart.net #
    /* Originally compiled from EasyFilter.java */
    import java.awt.*;
    import java.io.*;
    import java.net.*;
    import java.applet.Applet;
    import java.awt.event.KeyEvent;
    import java.awt.event.KeyListener;
    import java.awt.image.MemoryImageSource;
    import java.awt.image.PixelGrabber;
    import java.util.Vector;
    public synchronized class EasyFilter extends Applet implements KeyListener
    private String paramFileName;
    private Color bgColor;
    private Color fgColor;
    private Color parColor;
    private Color sepColor;
    private Color titleColor;
    private Color helpColor;
    private int WinWidth;
    private int WinHeight;
    private String title;
    private String logoFileName;
    private String originalImageFileName;
    private String filteredCaption;
    private String originalCaption;
    private Vector paramsName;
    private Vector paramsValue;
    private Vector paramsComment;
    private Panel panelParameters[];
    private Label labelParameters[];
    private TextField textFieldParameters[];
    private Label labelComments[];
    private int nbParameters;
    private ScrollPane scrollPaneParams;
    private Panel panelParams;
    private Image theLogo;
    private Image theOriginalImage;
    private Image theFilteredImage;
    private int theOriginalPixelArray[];
    private int logoWidth;
    private int logoHeight;
    private int imageWidth;
    private int imageHeight;
    private drawCanvas canvasTitle;
    private Panel panelTitle;
    private Label labelTitle;
    private Panel panelImages;
    private Panel panelOriginalImage;
    private drawCanvas canvasOriginalImage;
    private Label labelOriginalImage;
    private Panel panelFilteredImage;
    private drawCanvas canvasFilteredImage;
    private Label labelFilteredImage;
    private Panel panelHelp;
    private Label labelHelp;
    private int Yspc;
    private FilterImplementation theFilter;
    public void init()
    String string = null;
    string = appletInitialize();
    setBackground(bgColor);
    if (string != null)
    removeAll();
    setBackground(Color.white);
    setForeground(Color.black);
    Label label = new Label(new StringBuffer("Error: ").append(string).toString(), 1);
    Panel panel = new Panel();
    panel.add(label);
    add(panel);
    setLayout(new FlowLayout(1, 5, Yspc));
    public void keyPressed(KeyEvent keyEvent)
    panelHelp.removeAll();
    boolean flag = true;
    if (KeyEvent.getKeyText(keyEvent.getKeyCode()).equals("Enter"))
    for (int i = 0; i < nbParameters; )
    try
    paramsValue.setElementAt(new Double(textFieldParameters.getText()), i);
    i++;
    catch (NumberFormatException e)
    labelHelp.setText(labelParameters[i].getText() + ": Not a Number");
    flag = false;
    break;
    if (flag == 1)
    labelHelp.setText(" .... Running, please wait .... ");
    labelHelp.setAlignment(1);
    panelHelp.add(labelHelp);
    panelHelp.doLayout();
    theFilter.updateParameters(paramsValue);
    theFilter.computeFilter();
    theFilteredImage = createImage(new MemoryImageSource(theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight(), theFilter.getFinalImageBuffer(), 0, theFilter.getFinalImageWidth()));
    canvasFilteredImage.setImage(theFilteredImage);
    canvasFilteredImage.setBounds(0, 0, theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight());
    canvasFilteredImage.repaint();
    panelHelp.removeAll();
    labelHelp.setText("- Done -");
    else
    labelHelp.setText("- Press Enter to run the Filter -");
    labelHelp.setAlignment(1);
    panelHelp.add(labelHelp);
    panelHelp.doLayout();
    public void keyReleased(KeyEvent keyEvent)
    public void keyTyped(KeyEvent keyEvent)
    private String appletInitialize()
    WinWidth = size().width;
    WinHeight = size().height;
    if (getParameter("bgcolor") == null)
    bgColor = new Color(0, 0, 40);
    else
    bgColor = new Color(Integer.parseInt(getParameter("bgcolor"), 16));
    if (getParameter("fgcolor") == null)
    fgColor = new Color(255, 255, 255);
    else
    fgColor = new Color(Integer.parseInt(getParameter("fgcolor"), 16));
    if (getParameter("sepcolor") == null)
    sepColor = new Color(158, 128, 128);
    else
    sepColor = new Color(Integer.parseInt(getParameter("sepcolor"), 16));
    if (getParameter("parcolor") == null)
    parColor = new Color(24, 24, 24);
    else
    parColor = new Color(Integer.parseInt(getParameter("parcolor"), 16));
    if (getParameter("titlecolor") == null)
    titleColor = new Color(255, 255, 0);
    else
    titleColor = new Color(Integer.parseInt(getParameter("titlecolor"), 16));
    if (getParameter("helpcolor") == null)
    helpColor = new Color(0, 255, 255);
    else
    helpColor = new Color(Integer.parseInt(getParameter("helpcolor"), 16));
    paramsName = new Vector();
    paramsValue = new Vector();
    paramsComment = new Vector();
    paramFileName = getParameter("paramfile");
    String string = readParams(paramFileName);
    if (string != null)
    return string;
    MediaTracker mediaTracker = new MediaTracker(this);
    theOriginalImage = getImage(getDocumentBase(), originalImageFileName);
    mediaTracker.addImage(theOriginalImage, 0);
    if (logoFileName != null)
    theLogo = getImage(getDocumentBase(), logoFileName);
    mediaTracker.addImage(theLogo, 1);
    try
    mediaTracker.waitForAll();
    catch (InterruptedException e1)
    return "Error while loading image";
    if (mediaTracker.isErrorAny())
    return "Error while loading image";
    if (logoFileName != null)
    logoWidth = theLogo.getWidth(this);
    logoHeight = theLogo.getHeight(this);
    imageWidth = theOriginalImage.getWidth(this);
    imageHeight = theOriginalImage.getHeight(this);
    theOriginalPixelArray = new int[imageWidth * imageHeight];
    PixelGrabber pixelGrabber = new PixelGrabber(theOriginalImage, 0, 0, imageWidth, imageHeight, theOriginalPixelArray, 0, imageWidth);
    try
    pixelGrabber.grabPixels();
    panelTitle = new Panel();
    canvasTitle = new drawCanvas();
    labelTitle = new Label();
    panelTitle.setLayout(new FlowLayout(1, 10, Yspc));
    add(panelTitle);
    panelTitle.setBackground(bgColor);
    panelTitle.add(canvasTitle);
    canvasTitle.setImage(theLogo);
    canvasTitle.setBounds(0, 0, logoWidth, logoHeight);
    labelTitle.setText(title);
    catch (InterruptedException e2)
    return "Internal Error, Try RELOAD !";
    if (title != null)
    panelTitle.add(labelTitle);
    labelTitle.setForeground(titleColor);
    labelTitle.setFont(new Font("Dialog", 1, 14));
    panelImages = new Panel();
    panelOriginalImage = new Panel();
    canvasOriginalImage = new drawCanvas();
    labelOriginalImage = new Label();
    panelFilteredImage = new Panel();
    canvasFilteredImage = new drawCanvas();
    labelFilteredImage = new Label();
    panelImages.setLayout(new FlowLayout(1, 10, Yspc));
    add(panelImages);
    panelImages.setBackground(bgColor);
    panelOriginalImage.setLayout(new BorderLayout(0, 2));
    panelImages.add(panelOriginalImage);
    panelOriginalImage.setBackground(Color.black);
    panelOriginalImage.add("Center", canvasOriginalImage);
    canvasOriginalImage.setImage(theOriginalImage);
    canvasOriginalImage.setBounds(0, 0, imageWidth, imageHeight);
    labelOriginalImage.setText(originalCaption);
    labelOriginalImage.setAlignment(1);
    panelOriginalImage.add("South", labelOriginalImage);
    labelOriginalImage.setBackground(Color.lightGray);
    labelOriginalImage.setForeground(Color.black);
    labelOriginalImage.setFont(new Font("SansSerif", 0, 10));
    panelFilteredImage.setLayout(new BorderLayout(0, 2));
    panelImages.add(panelFilteredImage);
    panelFilteredImage.setBackground(Color.black);
    panelFilteredImage.add("Center", canvasFilteredImage);
    theFilter = new FilterImplementation(paramsValue, theOriginalPixelArray, imageWidth, imageHeight);
    theFilter.computeFilter();
    theFilteredImage = createImage(new MemoryImageSource(theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight(), theFilter.getFinalImageBuffer(), 0, theFilter.getFinalImageWidth()));
    canvasFilteredImage.setImage(theFilteredImage);
    canvasFilteredImage.setBounds(0, 0, theFilter.getFinalImageWidth(), theFilter.getFinalImageHeight());
    labelFilteredImage.setText(filteredCaption);
    labelFilteredImage.setAlignment(1);
    panelFilteredImage.add("South", labelFilteredImage);
    labelFilteredImage.setBackground(Color.lightGray);
    labelFilteredImage.setFont(new Font("SansSerif", 0, 10));
    scrollPaneParams = new ScrollPane(0);
    panelParams = new Panel();
    nbParameters = paramsName.size();
    int i = WinHeight - (33 + 7 * Yspc + logoHeight + imageHeight + 23);
    if (i < Yspc + 2 + 24)
    i = Yspc + 2 + 24;
    scrollPaneParams.setBounds(0, 0, WinWidth - 10, i);
    panelParams.setLayout(new GridLayout(nbParameters, 1, 5, Yspc / 2));
    scrollPaneParams.add(panelParams);
    panelParams.setBackground(sepColor);
    panelParameters = new Panel[nbParameters];
    labelParameters = new Label[nbParameters];
    textFieldParameters = new TextField[nbParameters];
    labelComments = new Label[nbParameters];
    for (int j = 0; j < nbParameters; j++)
    panelParameters[j] = new Panel();
    panelParameters[j].setLayout(new FlowLayout(0, 5, 1));
    panelParams.add(panelParameters[j]);
    panelParameters[j].setBackground(parColor);
    labelParameters[j] = new Label();
    labelParameters[j].setText((String)paramsName.elementAt(j));
    panelParameters[j].add(labelParameters[j]);
    labelParameters[j].setForeground(fgColor);
    labelParameters[j].setFont(new Font("Dialog", 1, 12));
    textFieldParameters[j] = new TextField(8);
    textFieldParameters[j].setText(paramsValue.elementAt(j).toString());
    panelParameters[j].add(textFieldParameters[j]);
    textFieldParameters[j].setBackground(fgColor);
    textFieldParameters[j].addKeyListener(this);
    labelComments[j] = new Label();
    labelComments[j].setText((String)paramsComment.elementAt(j));
    panelParameters[j].add(labelComments[j]);
    labelComments[j].setForeground(fgColor);
    add(scrollPaneParams);
    panelHelp = new Panel();
    labelHelp = new Label();
    panelHelp.setLayout(new FlowLayout(1, 5, 0));
    add(panelHelp);
    panelHelp.setBackground(bgColor);
    labelHelp.setText(" Change colour values and press enter ");
    labelHelp.setAlignment(1);
    panelHelp.add(labelHelp);
    labelHelp.setForeground(helpColor);
    return null;
    private String readParams(String string1)
    Object object1;
    String string2;
    if (string1 == null)
    return "Filename of filter's parameters needed";
    try
    URL uRL = new URL(getDocumentBase(), string1);
    URLConnection uRLConnection = uRL.openConnection();
    uRLConnection.setDoInput(true);
    uRLConnection.setUseCaches(false);
    BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(uRLConnection.getInputStream()));
    string2 = null;
    catch ()
    return object1.getMessage();
    catch ()
    return object1.getMessage();
    catch ()
    return object1.getMessage();
    if (bufferedReader != null)
    Object object2;
    try
    for (object2 = bufferedReader.readLine(); object2 != null && string2 == null; object2 = bufferedReader.readLine())
    string2 = extractFormat(object2);
    catch ()
    string2 = object2.getMessage();
    finally
    bufferedReader.close();
    if (string2 != null)
    return string2;
    else
    return null;
    private String extractFormat(String string1)
    if (string1.length() == 0)
    return null;
    int i = 0;
    int j = string1.indexOf(" ", i);
    if (j == -1)
    return "Bad format error (space missing)";
    String string2 = string1.substring(i, j);
    if (string2.equals("TITLE"))
    i = j;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in TITLE missing)";
    i = j + 1;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in TITLE missing)";
    title = string1.substring(i, j);
    return null;
    if (string2.equals("ORIGINALCAPTION"))
    i = j;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in ORIGINALCAPTION missing)";
    i = j + 1;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in ORIGINALCAPTION missing)";
    originalCaption = string1.substring(i, j);
    return null;
    if (string2.equals("FILTEREDCAPTION"))
    i = j;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in FILTEREDCAPTION missing)";
    i = j + 1;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in FILTEREDCAPTION missing)";
    filteredCaption = string1.substring(i, j);
    return null;
    if (string2.equals("LOGO"))
    i = j + 1;
    j = string1.length();
    logoFileName = string1.substring(i, j);
    return null;
    if (string2.equals("ORIGINALIMAGE"))
    i = j + 1;
    j = string1.length();
    originalImageFileName = string1.substring(i, j);
    return null;
    if (!string2.equals("PARAM"))
    return null;
    i = j;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format in a PARAM line";
    i = j + 1;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format in a PARAM line";
    paramsName.addElement(string1.substring(i, j));
    i = j + 2;
    j = string1.indexOf(32, i);
    if (j == -1)
    return "Bad format in a PARAM line";
    try
    paramsValue.addElement(new Double(string1.substring(i, j)));
    j = string1.indexOf(34, i);
    catch (NumberFormatException e)
    return "Bad format in a PARAM line";
    if (j == -1)
    return "Bad format (Double quote in PARAM comment missing)";
    i = j + 1;
    j = string1.indexOf(34, i);
    if (j == -1)
    return "Bad format (Double quote in PARAM comment missing)";
    paramsComment.addElement(string1.substring(i, j));
    return null;
    public EasyFilter()
    logoHeight = 33;
    Yspc = 5;

    Addition to my above submission
    To clarify, I'll offer the US$20 to the FIRST person who offers me a workable solution to the problem, not to everyone!!!
    JMGRAHAM

  • Error in executing servlet JSPRunner: java.lang.NullPointerException

    I have some problems with my jsp files.
    I am using iAS6sp4 and iWS 6 on W2K.
    I created a EJB jar file and an empty WAR file (No JSP, Servlet, just web.xml & ias-web.xml) and pack them into a ear file for deployment. It was successful.
    Then I copy some jsp files to <iasinstall>/ias6/ias/APPS/<app name>/<war name>
    and restart the ias and iws server.
    When I try the URL: "http://myserver/NASApp/<app name>/myjsp.jsp", I got this error message from kjs.
    JSPRunner: init
    Exception: SERVLET-execution_failed: Error in executing servlet JSPRunner: java.lang.NullPointerException
    My jsp didn't include any java code, just pure htm code. I want to give it a test. But even though I tried with a proper jsp i still got this message. pls advise.
    Alan

    Hi,
    I got this working. Here are the steps that I followed and the output...
    Steps
    1. Deployed the helloworld application
    2. Invoked the application to see if it works fine
    3. Copied the myjsp.jsp to the C:\iPlanet\ias6\ias\APPS\helloworld\helloworld directory
    4. Shutdown the iAS and iWS and started again
    5. Invoked the .jsp file by typing http://sundts2.india.sun.com:81/NASApp/helloworld/myjsp.jsp in the browser.
    Output of KJS
    [16/Mar/2002 14:46:06:5] info: ENGINE-ready: ready: 10819
    **********Registered ebnls interceptor ...!
    [16/Mar/2002 14:46:22:4] info: --------------------------------------
    [16/Mar/2002 14:46:22:4] info: JSPRunner: init
    [16/Mar/2002 14:46:22:4] info: --------------------------------------
    [16/Mar/2002 14:46:26:4] info: --------------------------------------
    [16/Mar/2002 14:46:26:4] info: jsp.APPS.helloworld.myjsp: init
    [16/Mar/2002 14:46:26:4] info: --------------------------------------
    The myjsp.jsp coding is...
    <HTML>
    <BODY>
    <H1>This is a .jsp file for testing</H1>
    </BODY>
    </HTML>
    I believe the problem in your case must be that the .jsp file has been placed in a directory where iAS is not able to recognise. I'm sure this will help. Please feel free to raise questions on this.
    Regards
    Ganesh .R
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • Using "Execute Javascript" to mark a course as Complete. 

    I am using a 3rd party Flash-based player (Flashform) to
    bundle Captivate and Flash made SWF files into a SCORM 1.2 package.
    My final SWF is a Captivate assessment, which, if passed, should
    change the course lesson status to “completed”. Can I
    accomplish this by using “Execute Javascript” on a
    button and run something like:
    “FSCommand("LMSSetValue","cmi.core.lesson_status,completed");”
    Any advice is greatly appreciated.
    Jon

    If you were using only the Captivate-published files for
    SCORM, it would likely be fairly straightforward to do what you're
    looking for.
    Unfortunately, since you're using a 3rd-party player, you'll
    have to consult the documentation for the player to determine which
    capabilities it exposes and how you can access those capabilities.

  • JAVA GUI window content does not fill out when window is enlarged (Win,Mac)

    I've been using the SAP JAVA GUI on a Windows XP workstation as well as a couple of MacBooks running OS X over the last year and a half or so, running versions from 7.10 r 7(maybe earlier) thru 7.10 r 10 (installed today.) The GUI has performed generally well on these platforms, but has one major irritation.
    When I open certain pop-up windows, such as the SPAD [List of Output Requests > Status Description |http://img171.imageshack.us/i/screenshot20091006at241.png/|screenshot], it usually does not open a  large enough window to display all the data - one must scroll horizontally and/or vertically to see the entire window content.  The real aggravation is that if [one enlarges the window|http://img101.imageshack.us/i/screenshot20091006at242.png/|screenshot] so as to see more data, the resizing is ignored.  The contents of the window are still displayed within the original window boundaries instead of filling out the expanded window.   It is not possible to get the entire window contents displayed, it is still necessary to scroll around.
    What am I missing here?   How can I get window resizing to work correctly?   (Or is there a way to make such windows at least open up at a larger initial size??)
    I only found one other thread in this forum, Sap gui screen size in ubuntu., which seemed to be addressing the same problem, but the suggestion was to apply the latest patch to the GUI and get JAVA 1.6.   One would think that since that post in 2008, any patches would have made it into the latest revisions.  I'm already running Java 1.6.
    SAPGUI for Java 7.10 rev 10
    (Version ID 071000041000)
    Tue Sep 8 09:49:53 MEST 2009
    uw1059, 710_REL, 1093492
    Java VM: Apple Inc. Version 1.6.0_15
    OS: Mac OS X(i386) Version 10.6.1
    SAPGUI for Java 7.10 rev 10
    (Version ID 071000041000)
    Tue Sep 8 09:49:53 MEST 2009
    uw1059, 710_REL, 1093492
    Java VM: Sun Microsystems Inc. Version 1.6.0_15
    OS: Windows XP(x86) Version 5.1
    Any suggestions?  Anyone else even seeing this?
    Thanks!
    Rich

    I'm now running
    SAPGUI for Java 7.10 rev 11
    (Version ID 071000041100)
    Tue Dec 8 16:04:41 MET 2009
    uw1059, 710_REL, 1119101
    Java VM: Apple Inc. Version 1.6.0_17
    OS: Mac OS X(i386) Version 10.6.2
    I've also updated my XP system to 7.10 rev 11 and both continue to display the same failure to resize corrrectly.  
    Here's a [video capture of this behavior|http://img163.yfrog.com/i/sapresizebug.mp4/].
    Given that installs on two separate operating systems have consistently misbehaved like this, I have a hard time believing it is something  we are doing.  (But not that hard...)  I find it hard to believe that is the way these screens present on most SAP sites...
    Any comments or suggestions would be welcome!
    Rich

  • Cannot connect a Java GUI client to an EJB

    I am having problems trying to make a Java GUI client connect to an EJB. I am using JRun4.
    At first, I tried making the Java GUI client a part of the enterprise application that I am building (of which the EJB is a part of). I included the client as a Java module in the application.xml of the enterprise application.
    However, when I try to start the server, containing this application, I get an error saying:
    Application authentication required. Incorrect method call.
    Now when I try to execute the application from the console, it works fine except when it comes to the part when it has to connect to the EJB. At this point I get an java.lang.reflect.UndeclaredThrowableException. Here's the stack trace:
    java.lang.reflect.UndeclaredThrowableException
    at $Proxy1.create(Unknown Source)
    at mds.Caller.actionPerformed(Caller.java:135)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: jrun.ejb.invocation.ContainerNotFoundException: The EJB container for boss-ejb#Boss could not be found.
    at jrun.ejb.invocation.AbstractInvocationProxy.findContainer(AbstractInvocationProxy.java:58)
    at jrun.ejb.invocation.LocalInvocationProxyImpl.invoke(LocalInvocationProxyImpl.java:53)
    at jrun.ejb.invocation.ClientInvocationHandlerImpl.invoke(ClientInvocationHandlerImpl.java:198)
    ... 25 more
    Since the bean is local, I am using a local reference to the bean in the lookup in the code of the client:
    Object o = context.lookup("local/BeanTest")
    I tried to use:
    Object o = context.lookup("java:comp/env/ejb/BeanTest")
    and added an ejb-local-ref in the application-client.xml file of the client. But when I try executing the client in this case, I get an error saying:
    No such binding: ejb
    I wish someone can help me out with this. My main aim is to get the app client talk to the EJB. Thanks a lot in advance.
    Soham

    I am not sure of a tool to view the JNDI tree. I have one in Weblogic console. But you can check the JNDI names with a small sample code.
    import java.util.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    public class TestEnvironment {
        public static void main(String[] args) {
            Context context   = null;
            Object object     = null;
            // Hashtable for environment properties.
            Hashtable env = new Hashtable();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
            env.put(Context.PROVIDER_URL, "t3://localhost:7001");
            try {
                context   = new InitialContext(env);
                NamingEnumeration enum = context.listBindings("");
                while (enum.hasMore()) {
                    Binding binding = (Binding) enum.next();
                    System.out.println("Name: " + binding.getName());
                    System.out.println("Type: " + binding.getClassName());
                    System.out.println("Value: " + binding.getObject());
            } catch (Exception exception) {
                exception.printStackTrace();
    }Hope this helps.

  • Reading Txt File into a GUI

    Hi,
    Direction on how to read a text file consisting of rows and columns with 1's and 0's into a GUI would be useful.
    I can ask user for filename and display the file in a DOS window but unsure of how I would use a text box to ask for a filename and then display the contents of it into the GUI.
    Im fairly new to Java, Where do I start?
    Thanks.

    Alternatively, take a look at this:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    class Editor extends JFrame
        private BorderLayout borderLayout1 = new BorderLayout();
        private JScrollPane jScrollPane1 = new JScrollPane();
        private JTextArea jTextArea1 = new JTextArea();
        private JMenuBar jMenuBar1 = new JMenuBar();
        private JMenu jMenu1 = new JMenu();
        private JMenuItem jMenuItem1 = new JMenuItem();
        private JMenuItem jMenuItem2 = new JMenuItem();
        public static void main(String[] args)
            Editor editor=new Editor();
            editor.setBounds(100,100,400,400);
            editor.setVisible(true);
        public Editor()
            try
                jbInit();
            catch(Exception e)
                e.printStackTrace();
            this.pack();
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        private void jbInit() throws Exception
            this.getContentPane().setLayout(borderLayout1);
            this.setJMenuBar(jMenuBar1);
            jMenu1.setText("File");
            jMenuItem1.setText("Open");
            jMenuItem1.addActionListener(new java.awt.event.ActionListener()
                public void actionPerformed(ActionEvent e)
                    jMenuItem1_actionPerformed(e);
            jMenuItem2.setText("Save");
            jMenuItem2.addActionListener(new java.awt.event.ActionListener()
                public void actionPerformed(ActionEvent e)
                    jMenuItem2_actionPerformed(e);
            this.getContentPane().add(jScrollPane1, BorderLayout.CENTER);
            jScrollPane1.getViewport().add(jTextArea1, null);
            jMenuBar1.add(jMenu1);
            jMenu1.add(jMenuItem1);
            jMenu1.add(jMenuItem2);
        void jMenuItem1_actionPerformed(ActionEvent e)
            JFileChooser fileSelectDialog=new JFileChooser();
            fileSelectDialog.setDialogTitle("Open file");
            fileSelectDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
            fileSelectDialog.setCurrentDirectory(new File("."));
            int result=fileSelectDialog.showDialog(this, null);
            if(result==fileSelectDialog.APPROVE_OPTION)
                File file=fileSelectDialog.getSelectedFile();
                if(file!=null)
                    try
                        FileInputStream fileInputStream=new FileInputStream(file);
                        byte[] data=new byte[(int)file.length()];
                        fileInputStream.read(data);
                        jTextArea1.setText(new String(data));
                    catch(IOException ex)
                        showExceptionMessage(ex);
        void jMenuItem2_actionPerformed(ActionEvent e)
            JFileChooser fileSelectDialog=new JFileChooser();
            fileSelectDialog.setDialogTitle("Save file");
            fileSelectDialog.setDialogType(JFileChooser.SAVE_DIALOG);
            fileSelectDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
            fileSelectDialog.setCurrentDirectory(new File("."));
            int result=fileSelectDialog.showDialog(this, null);
            if(result==fileSelectDialog.APPROVE_OPTION)
                File file=fileSelectDialog.getSelectedFile();
                if(file!=null)
                    try
                        FileOutputStream fileOutputStream=new FileOutputStream(file,false);
                        fileOutputStream.write(jTextArea1.getText().getBytes());
                    catch(IOException ex)
                        showExceptionMessage(ex);
        public void showExceptionMessage(Exception ex)
            StringWriter stringWriter=new StringWriter();
            PrintWriter printWriter=new PrintWriter(stringWriter);
            ex.printStackTrace(printWriter);
            JOptionPane.showMessageDialog(this,stringWriter.toString().replace('\t',' ').replace('\r',' '),"Exception!",JOptionPane.ERROR_MESSAGE);
    }

  • Including JavaScript into a JSP Page

    Hi,
    How do i include a piece of JavaScript <SCRIPT> stuff into a JSP Page?
    Right now i have an HTML Page that includes some <SCRIPT> code. Now many other HTML files use this piece of <SCRIPT> stuff. How do i remove it , put it in one place(I mean where to put it and what would that file be called) and in a JSP page call this <SCRIPT> code?
    Please help . i'm pretty new to JSP and JavaScript.
    Thanks in Advance.
    Phani
    /**** CODE
    <SCRIPT language=javascript>
    <!--
         if ((document.images) && ("Netscape" != navigator.appName) && (navigator.appVersion.indexOf('Mac') == -1))
         document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/1.css\">");
         else if ((document.images) && ("Netscape" != navigator.appName) && (navigator.appVersion.indexOf('Mac') > 1))
         document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/5.css\">");
         else if (("Netscape" == navigator.appName) && (parseInt(navigator.appVersion) == 4) && (navigator.appVersion.indexOf('Mac') == -1))
         document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/2.css\">");
         else if (("Netscape" == navigator.appName) && (parseInt(navigator.appVersion) == 4) && (navigator.appVersion.indexOf('Mac') > 1))
         document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/3.css\">");
         else if (("Netscape" != navigator.appName) && ("Microsoft Internet Explorer" != navigator.appName))
         document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/6.css\">");
    // -->
    </SCRIPT>

    Ok, first let us make clear the demarcation between java and javascript.
    Java runs on the server, and produces an HTML page which is sent to the client.
    That HTML page may contain javascript code on it to run on the client side.
    As the page is loaded, javascript may be compiled/run on the client.
    So you have some javascript code which you want to include on every page as template text?
    I would do this in JSP by using the include directive to add that bit of template text to every single JSP page.
    ie
    header.jspf
    <SCRIPT language=javascript>
    <!--
    if ((document.images) && ("Netscape" != navigator.appName) && (navigator.appVersion.indexOf('Mac') == -1))
    document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/1.css\">");
    else if ((document.images) && ("Netscape" != navigator.appName) && (navigator.appVersion.indexOf('Mac') > 1))
    document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/5.css\">");
    else if (("Netscape" == navigator.appName) && (parseInt(navigator.appVersion) == 4) && (navigator.appVersion.indexOf('Mac') == -1))
    document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/2.css\">");
    else if (("Netscape" == navigator.appName) && (parseInt(navigator.appVersion) == 4) && (navigator.appVersion.indexOf('Mac') > 1))
    document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/3.css\">");
    else if (("Netscape" != navigator.appName) && ("Microsoft Internet Explorer" != navigator.appName))
    document.write("<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"http://www.telia.se/tews/css/6.css\">");
    // -->
    </SCRIPT>
    <noscript>
      // stuff here for when the browser does not support javascript
    </noscript>And then in every jsp page
    <%@ page include="header.jspf" %>
    // rest of the JSP pageThe file "header.jspf" will be included with every jsp page served, and you only need to update that page in one place.
    If you have a JSP2.0 container you can define a jsp prelude which will be the same as having the <%@ page include="header.jspf" %> on every page.
    You do this in the web.xml file:
    Something like this:
      <jsp-property-group>
         <url-pattern>*.jsp</url-pattern>
         <include-prelude>/WEB-INF/jspf/prelude1.jspf</include-prelude>
      </jsp-property-group>The specified file will be loaded into every JSP page without the JSP page having to define the import itself.
    Hope this helps,
    evnafets

  • How to write javascript in java class method

    Hi,
    any one please resolved this,
    i want to write javascript window closing code into java class method, in that method i want to write javascript code & wanted to call in jsf page on commandButton action event,
    my code is below but it is not working properly
    public void closeWindowClicked(ActionEvent event) {
              try
         FacesContext facesContext = FacesContext.getCurrentInstance();
         String javaScriptText = "window.close();";
         // Add the Javascript to the rendered page's header for immediate execution
         AddResource addResource = AddResourceFactory.getInstance(facesContext);
         addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, javaScriptText);
    catch(Exception e)
         System.out.println(""+e);
    for calling into jsf code is below
    <h:commandButton action="#{parentBean.closeWindowClicked}" value="OK" />
    /*Note- i want to closed the window by caling method contain javascript only, i don't want any ajax code in method */
    please any one can resolved this.
    Thanks

    /*Note- i want to closed the window by caling method contain javascript only, i
    don't want any ajax code in method */ When the user presses your button, do your business logic and then send them to a page containing the following (note: untested code ahead):
    <html>
    <head>
        function onLoadHandler()
            window.close();
    </head>
    <body onload="onLoadHandler();">
        <p>Window closing....</p>
    </body>
    </html>

Maybe you are looking for

  • Placing word documents with embedded metafiles

    Hello, I have a Word document with Windows Metafile embedded pictures (with .EPS extensions). The pictures are math formulas, and I am not sure what tool they were created with. I open the document with Word 2010. I tried saving the document in both

  • Macpro dont start up after restart

    Hi, i buy a macpro 1.1 and today i install i few programs, after the install the mac tell me to restart and i acept that. the mac shut down and after that i hear a short sound ( maybe the disc???), the monitor is black, without any signal and the mac

  • ITunes Store Movie Purchase Play Immediately ?

    I bought a movie from the iTunes Store and it said it was going to take about an hour to download. After 10 minutes I tried and could play it in iTunes on my computer but I could not get it to show up on Apple TV until the whole movie had been downlo

  • Fair Useage Policy - email received re. exceeded u...

    Help I have just spent 3 hours on the phone over the last two days trying to sort this out. We are on Option 1. Yesterday we received an email stating that we had used 7GB of our 10GB usage and that we would be charged if we exceeded the agreement. H

  • Date of when a user is added to BPC.

    All, We have a situation where we need to find out when and who added a user to BPC.  Are there any tables or reports that can provide this information?. Thanks