Applet trouble

Hi,
I am no good at applets but i thorught i would make one.
Wel, i made one that works lovely in Applet viewer but when i run it in Opera it has no animation!
I do have java 2 installed, hence that i can see the applet. But i get no annimation as you see the thread creates 10 boxes and bounces them around the screen. It works perfect in my applet viewer. I also noticed that the mouses didnt move on the screen, i blocked that code out for now, but the solution might fix this. I think its somthing to do with my Paint method, i think its only paingting once and the paint method in my threads are being ignored.
O well, see if you can find the problem, i am not very good at applets but be most grateful for helping me!
package pong;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import java.util.Random;
public class pong extends JApplet implements Runnable {
  boolean isStandalone = false;
  int[] mouse = {250,250};
  Random r = new Random();
  int[][] pos = {{r.nextInt(400),r.nextInt(400)},
                {r.nextInt(400),r.nextInt(400)},
                {r.nextInt(400),r.nextInt(400)},
                {r.nextInt(400),r.nextInt(400)},
                {r.nextInt(400),r.nextInt(400)},
                {r.nextInt(400),r.nextInt(400)},
                {r.nextInt(400),r.nextInt(400)},
                {r.nextInt(400),r.nextInt(400)},
                {r.nextInt(400),r.nextInt(400)},
                {r.nextInt(400),r.nextInt(400)}};
  int[][] dir = {{r.nextInt(1)+1,r.nextInt(1)+1,r.nextInt(50)+1,r.nextInt(50)+1},
                {r.nextInt(1)+1,r.nextInt(1)+1,r.nextInt(50)+1,r.nextInt(50)+1},
                {r.nextInt(1)+1,r.nextInt(1)+1,r.nextInt(50)+1,r.nextInt(50)+1},
                {r.nextInt(1)+1,r.nextInt(1)+1,r.nextInt(50)+1,r.nextInt(50)+1},
                {r.nextInt(1)+1,r.nextInt(1)+1,r.nextInt(50)+1,r.nextInt(50)+1},
                {r.nextInt(1)+1,r.nextInt(1)+1,r.nextInt(50)+1,r.nextInt(50)+1},
                {r.nextInt(1)+1,r.nextInt(1)+1,r.nextInt(50)+1,r.nextInt(50)+1},
                {r.nextInt(1)+1,r.nextInt(1)+1,r.nextInt(50)+1,r.nextInt(50)+1},
                {r.nextInt(1)+1,r.nextInt(1)+1,r.nextInt(50)+1,r.nextInt(50)+1},
                {r.nextInt(1)+1,r.nextInt(1)+1,r.nextInt(50)+1,r.nextInt(50)+1}};
  //Get a parameter value
  public String getParameter(String key, String def) {
    return isStandalone ? System.getProperty(key, def) :
      (getParameter(key) != null ? getParameter(key) : def);
  //Construct the applet
  public pong() {
  //Initialize the applet
  public void init() {
    addMouseMotionListener(new b());
    try  {
      jbInit();
    catch(Exception e)  {
      e.printStackTrace();
  //Component initialization
  private void jbInit() throws Exception {
    this.setSize(new Dimension(500,400));
    /*this.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
      public void mouseMoved(MouseEvent e) {
        this_mouseMoved(e);
    cursorpic();
    new Thread(new ani()).start();
    new Thread(new display()).start();
  public void run() {
  //Get Applet information
  public String getAppletInfo() {
    return "Applet Information";
  //Get parameter info
  public String[][] getParameterInfo() {
    return null;
  //Main method
  public static void main(String[] args) {
    pong applet = new pong();
    applet.isStandalone = true;
    JFrame frame = new JFrame();
    frame.setTitle("Applet Frame");
    frame.getContentPane().add(applet, BorderLayout.CENTER);
    applet.init();
    applet.start();
    frame.setSize(500,400);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
    frame.setVisible(true);
    frame.setBackground(Color.white);
  public void cursorpic() {
    Toolkit kit = Toolkit.getDefaultToolkit();
    Image empty = kit.getImage("empty.gif");
    Cursor blankCursor = getToolkit().createCustomCursor(empty,new Point(0,0),"blankCursor");
    setCursor(blankCursor);
  public class ani implements Runnable {
    public void run() {
      while(true) {
        for (int i = 0;i!=10;i++) {
          if (dir[0] == 1) {
pos[i][0] -= dir[i][2];
else if (dir[i][0] == 2) {
pos[i][0] += dir[i][2];
if (dir[i][1] == 1) {
pos[i][1] -= dir[i][3];
else if (dir[i][1] == 2) {
pos[i][1] += dir[i][3];
if (pos[i][0] > 480) {
dir[i][0] = 1;
else if (pos[i][0] < 0) {
dir[i][0] = 2;
if (pos[i][1] > 380) {
dir[i][1] = 1;
else if (pos[i][1] < 0) {
dir[i][1] = 2;
try {
Thread.sleep(40);
} catch (InterruptedException e) {}
public class display implements Runnable {
public void run() {
while(true) {
try {
Thread.sleep(40);
} catch (InterruptedException e) {}
repaint();
public void paint(Graphics g) {
Graphics2D c = (Graphics2D)g;
c.clearRect(0,0,500,500);
c.setColor(Color.red);
//c.drawLine(mouse[0],mouse[1],mouse[0]+3,mouse[1]+10);
//c.drawLine(mouse[0],mouse[1],mouse[0]+10,mouse[1]+3);
c.setColor(Color.blue);
for (int i = 0;i!=10;i++) {
c.drawRoundRect(pos[i][0],pos[i][1],20,20,10,10);
class b extends MouseMotionAdapter
public void mouseDragged(MouseEvent e)
mouse[0] = e.getX();
mouse[1] = e.getY();
public void mouseMoved(MouseEvent e)
mouse[0] = e.getX();
mouse[1] = e.getY();

wait a minute!
Opera has tricked me into thinking i had java 2!
this is the plugins i have installed to opera:
Java Plug-in     
application/x-java-applet;version=1.1.1     -     
application/x-java-applet;version=1.1.1     -     
application/x-java-applet;version=1.1.1     -     
application/x-java-bean;version=1.1.1     -     
application/x-java-bean;version=1.1.1     -     
application/x-java-bean;version=1.1.1     -     
D:\PROGRAM FILES\Opera75\Program\Plugins\NPJava12.dll
ok, i suppose, the applet veiwer is using a different java so i suppose i need to change the code so that its compatible with the one opera is using? correct?
But then i do not know what code i need to change? any ideas?
Thanxs so far

Similar Messages

  • JavaFX + Applet Troubles

    Hey guys, you all have done a great job of answering my questions thus far, but I've got a couple architectural issues I'm trying to get through and would like some expert advice on what's going on.
    First of all, it would seem as though the absolute minimum required to get a JavaFX applet up and running is a download (presuming you haven't already run an applet using JavaFX) of a bit over 3 meg. This seems like a pretty hefty payload requirement...is there anything that be done to cut back on the initial loading cost?
    Second, I am scaling my content and it would seem as though the SwingTextField gets very odd mouse text selection issues when scaled up. Is there anything I can do fix that?
    Third, I'm getting errors every ~10th time I run the application. This inconsistency is rather worrisome. I get similar trouble when running as an Applet where it shows me the "Java downloading cycle progress display thingy" and just sits there spinning, but if I hit refresh in the browser it immediately launches the app the second time around. I'm launching via JNLP using the new JavaScript commands Sun provides.
    Thanks!

    Like any good developer I have fixed my problem.
    This blog gave me some clues and I think it comes down to how i have built and deployed it.
    http://lexique-du-net.com/blog/index.php?post/2008/12/08/Deploy-a-JavaFX-app-as-an-applet-with-the-Java-Deployement-Toolkit
    In the meantime to see it work in a browser i have opened it offline and just opened the html page that was in my dist folder created by netbeans.

  • Signed Applet Trouble.

    hi,
    Lately have been working on signing of applets, now by default
    applets are not allowed to access system resources, i.e files, etc,
    for obvious reasons. So if one has to access these resources through
    applet, the applet needs to be signed. Now i have signed the applet,
    even after doing that when i try to access the files(most of them
    are XML and property files), it gives me access denied error.
    The weird part is that it works perfectly fine in JRE1.4.1_01,
    where as it gives error in the later versions of Java i.e
    JRE1.4.2_01 or for that matter even in the latest version i.e
    JRE1.4.2_02.
    So here i need to verify, that is this really a bug, or has Java
    enhanced its security constraints.
    In either case i need to find a consistent and optimized solution
    for the same.Here in i have found a solution, using
    Java.security.AccessController and its doPrivileged method.
    Thanks in Advance
    Regards
    Vikram

    This worked fine on my win 2k machine with 1.4.2_01:
    HTML file (called test.htm):
    <APPLET CODE="test.class" archive="sTest.jar" WIDTH=0 HEIGHT=0></APPLET>
    Applet code (called test.java)"
    import java.util.Properties;
    import java.applet.Applet;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    public class test extends Applet implements Runnable {
                public test(){
                    new Thread(this).start();
             public static void main(String argv1[]) {
                  new test();
                public void run(){
                     try{
                          System.out.println(System.getProperty("java.version"));
                          System.out.println(System.getProperty("user.home"));
                         File fle = new File(System.getProperty("user.home") +
                              System.getProperty("file.separator") + "testFile.txt");
                   System.out.println("Created file: " + fle.toString());
                            FileOutputStream outFile = new FileOutputStream(fle);
                   outFile.write("hello, this is written".getBytes());
                   System.out.println("Written to file: " + fle.toString());
                   outFile.close();
                         FileInputStream inFile = new FileInputStream(fle);
                   System.out.println("Opened file: " + fle.toString());
                         int b = inFile.read();
                      while(b!=-1){
                              System.out.print((char) b);
                              b = inFile.read();
                   System.out.println("This was te content of file: " +
                        fle.toString());
                          inFile.close();
                     }catch(Exception e){
                          e.printStackTrace();
    }The batchfile that signes the applet (password is password):
    rem del *.cer
    rem del *.com
    rem del *.jar
    rem del *.class
    javac test.java
    keytool -genkey -alias alias -keypass password -keystore keystore.com -storepass password
    jar cf0 test.jar test.class
    jarsigner -keystore keystore.com -signedjar sTest.jar test.jar alias -storepass password -keypass password
    keytool -export -keystore keystore.com -alias alias -file test.cer -storepass password -keypass password
    keytool -import -alias alias -file test.cer -keystore keystore.com -storepass password -keypass password
    Output:
    1.4.2_01
    C:\Documents and Settings\user
    Created file: C:\Documents and Settings\user\testFile.txt
    Written to file: C:\Documents and Settings\user\testFile.txt
    Opened file: C:\Documents and Settings\user\testFile.txt
    hello, this is writtenThis was te content of file: C:\Documents and Settings\user\testFile.txt

  • Applet troubles(Data Table)

    I have problems creating a data table in an applet should have a table along with other components in the applet nave used grid bag Layout for the rest of the Applet.Can any one answer?

    I had seen that post, but data_table seems to have different behaviour. Another post mentions that the <verbatim> tag doesn't function properly within data_table and <output_text> was suggested.
    Using <verbatim> the cell in my HTML table is always empty.
    Using <output_text> I get the full <jsp:plugin> element in the table cell. It either displays in the browser or quietly hides, but an applet box is never created.
    Any other ideas?
    Thanks

  • Java applet coonectivity to ms access

    Hi friend i'm new to sun forums. Java applet troubling me a lot while i try to coonect it with ms access. the code of the program is as follows:-
    Ao.java
    import java.sql.*;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    <applet code="Ao" width=250 height=200>
    </applet>
    public class Ao extends Applet implements ActionListener,ItemListener
    String msg="";
    Button view,delete,create,edit,reapp,exit;
    TextField M_head;
    int x,i,ans=0,flag;
    public void init()
    setLayout(new FlowLayout(FlowLayout.CENTER,50,3));
    view = new Button("view");
    delete = new Button("delete");
    create = new Button("create");
    edit = new Button("edit");
    reapp = new Button("reapp");
    exit= new Button("exit");
    M_head = new TextField(15);
    add(view);
    add(delete);
    add(create);
    System.out.println("");
    add(edit);
    add(reapp);
    add(exit);
    System.out.println("");
    add(M_head);
    view.addActionListener(this);
    delete.addActionListener(this);
    create.addActionListener(this);
    edit.addActionListener(this);
    reapp.addActionListener(this);
    exit.addActionListener(this);
    M_head.addActionListener(this);
    public void actionPerformed(ActionEvent ae)
    String str=ae.getActionCommand();
    if(str.equals("view"))
    {msg ="1";}
    if(str.equals("delete"))
    {msg ="2";}
    if(str.equals("create"))
    {msg ="3";}
    if(str.equals("edit"))
    {msg ="4";}
    if(str.equals("reapp"))
    {msg ="5";}
    if(str.equals("exit"))
    {msg ="6";}
    if(msg=="3")
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String filename = "D:/budget/mbdTest1.mdb";
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mbd)};DBQ=";
    database+=filename.trim();
    String head = M_head.getText();
    String head1 = head.trim();
    Connection con = DriverManager.getConnection(database ,"","");
    Statement doo = con.createStatement();
    String vi ="create table "+head1+" (Reapporder integer, Amount integer)";
    doo.execute(vi);
    catch(Exception err)
    System.out.println("Error :"+err);
    public void itemStateChanged(ItemEvent ie)
    repaint();
    public void paint(Graphics g)
    g.drawString(msg,70,200); //No use
    g.drawString("ANSWER=",6,200); // No use
    I run it with a ao.txt file which contain the grant permission information:-
    Ao.txt
    grant {
    permission java.lang.RuntimePermission
    "accessClassInPackage.sun.jdbc.odbc";
    permission java.util.PropertyPermission
    "file.encoding", "read";
    My database is in the same directory as in my .java file with the name mbdTest1.mdb ( A system dsn)
    I run it with the following command:-
    appletviewer -J-Djava.security.policy=Ao.txt Ao.java
    applet run succesfully but when i enter some data in text box and click on create button it shows an Error java.sql.SQLException: data source name not found and no default driver specified.
    help needed and thanks in advance

    >
    I'm unable to understand the archieve="accessdriver.jar">It is archive, archive (only one 'e'). These things need to be correct for any hope of working!
    And while we are on the subject, the word is 'connect', not 'coonect'.
    But anyway, what I meant by accessdriver.jar, is simply the Jar that contains the sun.jdbc.odbc.JdbcOdbcDriver ..
    Oh, wait a second. I did not look at that classname closely, and did not realise it was a 'sun' class. It is more common to add a 3rd party DB driver class (AFAIU) than use a 'Sun proprietary API' class to access a DB.
    >
    As far as security file is concerned i will first try to run the applet so that it is able to create and query
    data from my ms access database after than i can modify it.>You seem very confused about accessing the DB. Noting that your original code uses a hard coded (file based) path to the DB, I can tell you you are wasting time attempting to access it that way. That will never work when the applet is on the web, since the File path will point to a place on the end user's PC file system that does not have a DB installed! The applet will need to be redesigned.
    I recommend you download and install a local server like tomcat, which can more accurately reflect a web environment. Then do all your applet testing via the local server.
    1st, before you bother with the applet, you should organise how to access the DB (at least tot the point of doing a simple query) in a web page. Before going any further. This will ensure that the DB is set-up correctly and accessible to a sand-boxed applet.
    Your comment about "..will first try to run the applet.. (before) ..modify it". If it is a security matter, it will need to be signed before you can even query the DB. If the applet can be sand-boxed (probably the case) then don't sign it at any time.

  • Having trouble limiting applet to specific JRE family

    I've just joined a new project at work and have been asked to modify an applet so it will be forced to run using JRE 1.5, since the work has not yet been able to be done to certify it with JRE 1.6. I'm having trouble getting this to behave as I'd expect, based on info I've been given and have found on the web about how to do this.
    The page containing the applet uses jsp. The applet is declared using a <jsp:plugin> tag which contains attributes:
    jreversion="1.5"
    iepluginurl="http://java.sun.com/products/plugin/1.3/jinstall-131-win32.cab"
    Based on other information I found, I've also added a <jsp:param> tag within which contains:
    name="java_version" value="1.5*"
    The generated HTML from this contains an <OBJECT> tag with an attribute:
    classid="clsid:CAFEEFAC-0015-0000-0011-ABCDEFFEDCBA"
    and inside the <OBJECT> a number of <param> tags, including:
    name="type" value="application/x-java-applet;version=1.5"
    name="java_version" value="1.5*"
    With all this in place, if I have JRE1.6 installed on my system, the applet still appears to be loaded in 1.6 (According to the Sun Java Console for the applet browser window), and it ends up failing to run in 1.6. If I remove 1.6 from the system, leaving 1.5 on my system, things work correctly.
    I can't figure out what I'm doing wrong (or failing to do right) that is causing this to not end up being within a 1.5 JRE even though the browser is using the more recent 1.6 in general.
    Any help would be greatly appreciated. Thanks!

    Then shouldn't the <jsp:plugin> processing (of the jreversion="1.5") have generated a clsid value of clsid:CAFEEFAC-0015-0000-FFFF-ABCDEFFEDCBA instead of clsid:CAFEEFAC-0015-0000-0011-ABCDEFFEDCBA as it did?

  • There si any trouble when I input Chinese to the JTextField in Applet.

    There si any trouble when I input Chinese to the JTextField in Applet.

    thanks for your help,
    my tool is form builder,
    my form version is 10.1.2.0.2
    and the field is set to CHAR ,
    when i run an easy form
    and switch the input method to chinese,
    there is no input window,the focus directly be in field, even doesn't complete input a Chinese character,
    in usually ,when switch the input to chinese,the focus will be in field when complete input a Chinese character
    i Try to do it in version is 9.0, there isn't wrong As above
    any one can tell me how to resolve it ,thanks

  • Having trouble with my signed applet(if it's properly signed that is)

    hi
    I'm having trouble with my supposedly signed applet. I'm trying to execute a specific program in this case trilian from my browser. i'm using firefox
    first my java code
    package applet;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class RunApplet extends JApplet {
        JButton jButton = new JButton();
        FlowLayout flowLayout1 = new FlowLayout();
        public RunApplet() {
            try {
                init();
            } catch (Exception ex) {
                ex.printStackTrace();
        private void init() throws Exception {
            try {
                this.getContentPane().setLayout(flowLayout1);
                this.setSize(new Dimension(100, 200));
                jButton.setText("Trillian");
                jButton.addActionListener(new RunApplet_jButton_actionAdapter(this,
                        "\"C:\\Program Files\\Trillian\\trillian.exe\""));
                this.getContentPane().add(jButton, null);
            } catch (Exception e) {
                e.printStackTrace();
    class RunApplet_jButton_actionAdapter implements ActionListener {
        private RunApplet adaptee;
        private String programPath;
        RunApplet_jButton_actionAdapter(RunApplet adaptee, String programPath) {
            this.adaptee = adaptee;
            this.programPath = programPath;
        public void actionPerformed(ActionEvent e) {
            try {
                Runtime.getRuntime().exec(this.programPath);
            } catch (IOException ex) {
    }And my applet code
    <html>
    <body>
    <!--"CONVERTED_APPLET"-->
    <!-- HTML CONVERTER -->
    <object
        classid = "clsid:CAFEEFAC-0015-0000-0005-ABCDEFFEDCBA"
        codebase = "http://java.sun.com/update/1.5.0/jinstall-1_5_0_05-windows-i586.cab#Version=5,0,50,5"
        >
        <PARAM NAME = CODE VALUE = "applet.RunApplet.class" >
        <PARAM NAME = ARCHIVE VALUE = "myfile.jar" >
        <param name = "type" value = "application/x-java-applet;jpi-version=1.5.0_05">
        <param name = "scriptable" value = "false">
        <comment>
         <embed
                type = "application/x-java-applet;jpi-version=1.5.0_05" \
                CODE = "applet.RunApplet.class" \
                ARCHIVE = "myfile.jar"
             scriptable = false
             pluginspage = "http://java.sun.com/products/plugin/index.html#download">
             <noembed>
                </noembed>
         </embed>
        </comment>
    </object>
    <!--
    <applet CODE = "applet.RunApplet.class" ARCHIVE = "myfile.jar">
    </applet>
    -->
    <!--"END_CONVERTED_APPLET"-->
    </body>
    </html>Creating my key:
    keytool -genkey -alias sitekey -keystore "C:\Program Files\Java\jdk1.5.0_05\jre\lib\security\cacerts"Now the process of creating the jar file and signing it:
    1. jar cf myfile.jar *.class
    2. jarsigner -keystore "C:\Program Files\Java\
    jdk1.5.0_05\jre\lib\security\cacerts" myfile.jar sitekeyNow this is the way i've been using then and the first time i get the "do you want to trust" screen but still i get a security exception.
    Exception in thread "AWT-EventQueue-10" java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkExec(Unknown Source)
         at java.lang.ProcessBuilder.start(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at java.lang.Runtime.exec(Unknown Source)
         at applet.RunApplet_jButton_actionAdapter.actionPerformed(RunApplet.java:73)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.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 javax.swing.JComponent.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.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)Is there anybody who have an idea what can be wrong?
    regards
    thallish

    ok i solved i myself. i assigned a different and thereby correct keystore and now it works like it should
    regards
    thallish

  • I am having trouble with my JAVA Applet. It isn't functioning on SAFARI.    It seems to have stopped working and I used it on SAFARI last year. Any suggestions ?

    I am having trouble with my JAVA Applet. It isn't functioning on SAFARI.    It seems to have stopped working and I used it on SAFARI last year. Any suggestions?

    Post in the Safari forum area.

  • I have a trouble with the clipboard inside an applet

    I have created simple text editor as applet (by JTextPane). I have a trouble with the clipboard. The clipboard works correctly inside the applet, but I'm not able to paste text from outside text editors (e.g. notepad). But I found out that clipboard works correctly inside appletviewer.
    You can visit the applet on: http://www.newlink.be/abst/
    Please help
    P.S.: I'm sorry for my bad english

    This is because applets do not have access to the system clipboard by default. The only way to get around this is to make a signed applet.

  • Trouble with applet tutorial about servers

    I downloaded the sources of this (http://java.sun.com/docs/books/tutorial/deployment/applet/clientExample.html) example and am trying to make them work. However I'm having trouble with the server program.It compiles fine but when I run it I get NullPointerException in QuoteServerThread class on this line:
    packet = new DatagramPacket(buf, 256);buf is a byte array and it's set to null.
    I don't have any experience with networking in java so if the problem is something really simple you'll know why I didn't find it.
    Oh, and the code of the thread is here http://java.sun.com/docs/books/tutorial/deployment/applet/examples/QuoteServerThread.java

    Replace
    byte[] buf = null;with
    byte[] buf = new byte[ 256 ];Other problems may happen if this sample was not tested properly.
    The problem is that the DatagramPacket requires you to supply a non-null buffer, as per:
    DatagramPacket
    public DatagramPacket(byte[] buf, int length)
    Constructs a DatagramPacket for receiving packets of length length.
    The length argument must be less than or equal to buf.length.
    Parameters:
    buf - buffer for holding the incoming datagram.
    length - the number of bytes to read.
    Edited by: baftos on Jul 18, 2008 3:38 PM

  • Trouble deploying Java Applet for animation(s) on web site

    I FTP weather radar images up to my host's server, thus onto my web site constantly. As of now, I am successfully doing so with a Java Script. However, I am wanting to do so with a Java Applet.
    The trouble I am having is that the Applet deploys in the browser once on the web site..but the radar images are not being drawn upon thus not showing up to animate. I have a username and password for my web site, but have been told by many that this would not be a prohibitive situation for the Applet to retrieve the images. Thus, I feel that I am coding something wrong causing the Applet to fail in "locating" the images to animate. All files for the Applet are in the same directory as the images I am trying to upload into the Applet, yet still no success. "GR" is the sub directory where the radar image uploaded files are contained within.
    I have attached the coding that I am/have been trying to implement. If anyone can assist I would be greatly appreciative!
    <P>
    <applet archive="aniscode.jar,png.jar" code="AniS.class" align="left" height="800" width="800">
    alt="Java must be installed and working for this animation to work">
    <param name="controls" value="startstop, looprock, toggle, zoom, step, speed, refresh ">
    <param name="backcolor" value="000000">
    <param name="forecolor" value="ffffff">
    <param name="image_window_size" value="800,800">
    <param name="auto_refresh" value="1">
    <param name="toggle_size" value="8,10,5">
    <param name="active_zoom" value="x">
    <param name="pause_percent" value="990">
    <param name="enable_png" value="true
    <param name="basename" value="anim*.png">
    <param name="no_enh" value="true">
    <param name="num_frames" value="10">
    <param name="rate" value="75">
    <param name="image_base" value="http://www.leesweather.net/GR/ ">
    <param name="filenames" value="br1_9.png,br1_8.png,br1_7.png,br1_6.png,br1_5.png,br1_4.png,br1_3.png,br1_2.png,br1_1.png,br1_0.png">
    </applet>

    I FTP weather radar images up to my host's server,
    thus onto my web site constantly. As of now, I am
    successfully doing so with a Java Script.
    However, I am wanting to do so with a Java Applet.
    e trouble I am having is that the Applet deploys in
    the browser once on the web site..but the radar
    images are not being drawn upon thus not showing up
    to animate. I have a username and password for my
    web site, but have been told by many that this would
    not be a prohibitive situation for the Applet to
    retrieve the images. Thus, I feel that I am coding
    something wrong causing the Applet to fail in
    "locating" the images to animate. All files for the
    Applet are in the same directory as the images I am
    trying to upload into the Applet, yet still no
    success. "GR" is the sub directory where the radar
    image uploaded files are contained within.
    I have attached the coding that I am/have been trying
    to implement. If anyone can assist I would be
    greatly appreciative!
    <P>
    <applet archive="aniscode.jar,png.jar"
    code="AniS.class" align="left" height="800"
    width="800">
    alt="Java must be installed and working for this
    animation to work">
    param name="controls" value="startstop, looprock,
    toggle, zoom, step, speed, refresh ">
    <param name="backcolor" value="000000">
    <param name="forecolor" value="ffffff">
    <param name="image_window_size" value="800,800">
    <param name="auto_refresh" value="1">
    <param name="toggle_size" value="8,10,5">
    <param name="active_zoom" value="x">
    <param name="pause_percent" value="990">
    <param name="enable_png" value="true
    <param name="basename" value="anim*.png">
    <param name="no_enh" value="true">
    <param name="num_frames" value="10">
    <param name="rate" value="75">
    <param name="image_base"
    value="http://www.leesweather.net/GR/ ">
    <param name="filenames"
    value="br1_9.png,br1_8.png,br1_7.png,br1_6.png,br1_5.p
    ng,br1_4.png,br1_3.png,br1_2.png,br1_1.png,br1_0.png">
    </applet>I hope you have them properly packed into a jar in which case you can
    use this method...
    Code snippet from hyperview.dev.java.net
    public Image getImageFromJar(String fileName)
    int length = 0;
       if( fileName == null )
           return null;
       Image image = null;
       try
          image = getAppletContext().getImage( getClass().getResource(fileName) );
       catch(Exception exc)
          exc.printStackTrace();
          return (Image)null;
       return image;
    } ///----- Otherwise they should be in the same codebase as the Applet
    // and you can use this call (Way slower to download)
    Image myImage = getAppletContext().getImage(new URL(getCodeBase(),"YOUR_IMAGE_NAME.gif") );Good Luck!
    (T)

  • Trouble running .java applettes from studio

    I am having trouble running javascript applettes from studio however they do work if run directly in MS explorer 6. The path for explorer exists in tools/options/sever and external tool settings/web browsers. Any suggestions?

    Do you have Java or JavaScript problems?
    Can you provide some code sample/steps to reproduce this?

  • Applet inside JSP trouble

    Hi,
    I am having trouble in configuring my application to run an applet inside my JSP pages.
    This is my dir structure:
    team/WEB-INF/classes/team/DBAccess.class
    team/WEB-INF/lib/ojdbc14.jar
    team/AppletClass/MyApplet.class
    team/reports/report.jsp
    team/main.jsp
    The Applet class MyApplet is called from within report.jsp by the following codes of line:
    <jsp:plugin type="applet" code = "MyApplet" codebase="../AppletClass/"></jsp:plugin>
    The applet works fine if I code it as a stand alone and not using DBAccess class. That is, it appear on my JSP page, however when I use elements from DBAccess class, which is inside WEB-INF/classes/team, it does not load!
    I have added D:\team\WEB-INF\classes\team into CLASSPATH variable of my win2K system.
    Please help!!! I somehow need this applet class to access DBAccess to query DB and display results on the applet.

    You are actually getting confused with server side execution and client side execution.
    Applet is something that run in client side.
    If you see your directory structure you have DBAccess.class in
    team/WEB-INF/classes/team/DBAccess.class directory
    hope you might be knowing WEB-INF is internal to app server not to the client. so applet can;t find the path for DBAccess.class file.
    You have to put that class in team/AppletClass or any other folder where the client applet can access .

  • Trouble with an applet on  a jsp page

    hi, thanx for readin it!
    im developing a webapp tha have some swing applets , the problem is that the applets dont work, they appear but dont play anything, i use the jsp:plugin to load the applets on the jsp, i also have instaled the java plugin on my win xp pc, i use tomcat 5. well i hope you can help me

    were are the applet classes? under WEB-INF? If so, then they shouldn't be as the server won't server files under that directory and the browser needs them

Maybe you are looking for

  • ERROR(No text fould) for a request loaded into InfoProvider.

    Dear Experts, I'm facing a typical problem. The regular data loads used to be fine. Since past 2 days, when the loads happen through the regular PCs, in some DSOs I find in the Datasource Name column DataSource Name and (No text Found),. The Sourcesy

  • Global Variable in Essbase unable to pull up dimension structure

    Hi! I have created a global variable in Essbase using which I want to select a dimension member in a Business rule. While trying to create the global variable in Essbase though, I cannot pull up the dimension structure in the Limits or Default value

  • Tools flyout menus out of place

    Why are the flyout menus for my Tools in the middle of the screen instead of next to the tools? I have tried to find a Preference that I might have inadvertently changed but cannot... Any help would be appreciated; this is a very annoying behavior. T

  • Atheros WiFi drivers Windows 8.1 (64bit)

    I am using a MSI FM2-A75IA-E53 mainboard. Worked fine with Windows 8. After the update to Windows 8.1 My Atheros 9271 WiFi does not work. Is there an update for the drivers? When i check the driver version it seems that Windows uses the XP driver ver

  • Can you Make A Page With Multiple Videos?

    when i try to add more than 1 video to a page. the 2nd one doesn't show up. is there anyway around this or does each video have to have its own page? thanks