New in Java: java applet program using multithreading

I am trying to write a program, which should move the words "Java Platform2" from left to right every time we 'refresh'.
Can you please advise what is wrong in the logic??
import java.applet.*;
import java.awt.*;
import java.lang.*;
public class Ch61appth extends Applet implements Runnable
int i=30;
int x=10;
int y=30;
Thread t,cur;
     public void start()
          t=new Thread(this);
          t.start();
     public void paint(Graphics g)
          g.setColor(Color.blue);
          g.drawString("Java Platform2",x+i,y);
     public void run()
               if ((x+i)<400)
                    {     i=i+20;
                    else
                    {     i=20;
          //cur=new Thread.currentThread();
          repaint();

thanks for reply
i tried using for loop. Earlier also i had tried using while loop with condition t==Thread.currentThread()
The problem i am facing is the string just does not move and even after clicking refresh, it appears at same locations.
CAN U ADVISE>
bye
kumar

Similar Messages

  • �� I have a java applet program (yanhua.java) need help!!!

    �� I have a java applet program (yanhua.java) that use mouse click a area show a fireworks, the applet program that a java fan mail me. Now i find some bug in the program, can you help me? thank in advance!
    The backdrop of the question: The yanhua.java applet program works well. But one day, i install j2re 1.4.1 plugin for my microsfot Internet Explorer, i run the yanhua.java applet program again, it show difficult(i move my mouse in the area, slowness), the fireworks is not fluent. Then i try my best to find the cause , i get some information, the following: yanhua.java run in j2re 1.4.1 plugin,it will deplete 100% cpu; else yanhua.java does not run in j2re 1.4.1 plugin, it will deplete 90%--95% cpu too; but my computer c3 1G cpu and 256MB memory, without running other program at that time. So i can have the assurance to say that the yanhua.java have some bug or error. can you help me to find all bug in yanhua.java? thank you very much!!!
    i want to solve the question: finding all bug in yanhua.java
    NOTE:
    1��fireworks show specially good effect(a yanhua.java applet) you can look at:
    http://www.3ren.net/down/java/yanhua.html
    2��all program you can get from http://www.3ren.net/down/java/yanhua.rar
    /*************************yanhua.java******************************
    import java.applet.Applet;
    import java.applet.AudioClip;
    import java.awt.*;
    import java.awt.image.MemoryImageSource;
    import java.util.Random;
    public class yanhua extends Applet
    implements Runnable
    private int m_nAppX;
    private int m_nAppY;
    private int m_centerX;
    private int m_centerY;
    private int m_mouseX;
    private int m_mouseY;
    private int m_sleepTime;
    private boolean isError;
    private boolean m_isPaintFinished;
    boolean isRunning;
    boolean isInitialized;
    Thread runner;
    int pix0[];
    MemoryImageSource offImage;
    Image dbImg;
    int pixls;
    int pixls2;
    Random rand;
    int bits;
    double bit_px[];
    double bit_py[];
    double bit_vx[];
    double bit_vy[];
    int bit_sx[];
    int bit_sy[];
    int bit_l[];
    int bit_f[];
    int bit_p[];
    int bit_c[];
    int bit_max;
    int bit_sound;
    int ru;
    int rv;
    AudioClip sound1;
    AudioClip sound2;
    public yanhua()
    m_mouseX = 0;
    m_mouseY = 0;
    m_sleepTime = 5;
    isError = false;
    isInitialized = false;
    rand = new Random();
    bits = 10000;
    bit_px = new double[bits];
    bit_py = new double[bits];
    bit_vx = new double[bits];
    bit_vy = new double[bits];
    bit_sx = new int[bits];
    bit_sy = new int[bits];
    bit_l = new int[bits];
    bit_f = new int[bits];
    bit_p = new int[bits];
    bit_c = new int[bits];
    ru = 50;
    rv = 50;
    public void init()
    String s = getParameter("para_bits");
    if(s != null)
    bits = Integer.parseInt(s);
    s = getParameter("para_max");
    if(s != null)
    bit_max = Integer.parseInt(s);
    s = getParameter("para_blendx");
    if(s != null)
    ru = Integer.parseInt(s);
    s = getParameter("para_blendy");
    if(s != null)
    rv = Integer.parseInt(s);
    s = getParameter("para_sound");
    if(s != null)
    bit_sound = Integer.parseInt(s);
    m_nAppX = this.getSize().width;
    m_nAppY = this.getSize().height;
    m_centerX = m_nAppX / 2;
    m_centerY = m_nAppY / 2;
    m_mouseX = m_centerX;
    m_mouseY = m_centerY;
    resize(m_nAppX, m_nAppY);
    pixls = m_nAppX * m_nAppY;
    pixls2 = pixls - m_nAppX * 2;
    pix0 = new int[pixls];
    offImage = new MemoryImageSource(m_nAppX, m_nAppY, pix0, 0, m_nAppX);
    offImage.setAnimated(true);
    dbImg = createImage(offImage);
    for(int i = 0; i < pixls; i++)
    pix0[i] = 0xff000000;
    sound1 = getAudioClip(getDocumentBase(), "firework.au");
    sound2 = getAudioClip(getDocumentBase(), "syu.au");
    for(int j = 0; j < bits; j++)
    bit_f[j] = 0;
    isInitialized = true;
    start();
    public void run()
    while(!isInitialized)
    try
    Thread.sleep(200L);
    catch(InterruptedException interruptedexception) { }
    do
    for(int j = 0; j < pixls2; j++)
    int k = pix0[j];
    int l = pix0[j + 1];
    int i1 = pix0[j + m_nAppX];
    int j1 = pix0[j + m_nAppX + 1];
    int i = (k & 0xff0000) >> 16;
    int k1 = ((((l & 0xff0000) >> 16) - i) * ru >> 8) + i;
    i = (k & 0xff00) >> 8;
    int l1 = ((((l & 0xff00) >> 8) - i) * ru >> 8) + i;
    i = k & 0xff;
    int i2 = (((l & 0xff) - i) * ru >> 8) + i;
    i = (i1 & 0xff0000) >> 16;
    int j2 = ((((j1 & 0xff0000) >> 16) - i) * ru >> 8) + i;
    i = (i1 & 0xff00) >> 8;
    int k2 = ((((j1 & 0xff00) >> 8) - i) * ru >> 8) + i;
    i = i1 & 0xff;
    int l2 = (((j1 & 0xff) - i) * ru >> 8) + i;
    int i3 = ((j2 - k1) * rv >> 8) + k1;
    int j3 = ((k2 - l1) * rv >> 8) + l1;
    int k3 = ((l2 - i2) * rv >> 8) + i2;
    pix0[j] = i3 << 16 | j3 << 8 | k3 | 0xff000000;
    rend();
    offImage.newPixels(0, 0, m_nAppX, m_nAppY);
    try
    Thread.sleep(m_sleepTime);
    catch(InterruptedException interruptedexception1) { }
    } while(true);
    public void update(Graphics g)
    paint(g);
    public void paint(Graphics g)
    g.drawImage(dbImg, 0, 0, this);
    public void start()
    if(isError)
    return;
    isRunning = true;
    if(runner == null)
    runner = new Thread(this);
    runner.start();
    public void stop()
    if(runner != null)
    runner.stop();
    runner = null;
    public boolean mouseMove(Event event, int i, int j)
    m_mouseX = i;
    m_mouseY = j;
    return true;
    public boolean mouseDown(Event event, int i, int j)
    m_mouseX = i;
    m_mouseY = j;
    int k = (int)(rand.nextDouble() * 256D);
    int l = (int)(rand.nextDouble() * 256D);
    int i1 = (int)(rand.nextDouble() * 256D);
    int j1 = k << 16 | l << 8 | i1 | 0xff000000;
    int k1 = 0;
    for(int l1 = 0; l1 < bits; l1++)
    if(bit_f[l1] != 0)
    continue;
    bit_px[l1] = m_mouseX;
    bit_py[l1] = m_mouseY;
    double d = rand.nextDouble() * 6.2800000000000002D;
    double d1 = rand.nextDouble();
    bit_vx[l1] = Math.sin(d) * d1;
    bit_vy[l1] = Math.cos(d) * d1;
    bit_l[l1] = (int)(rand.nextDouble() * 100D) + 100;
    bit_p[l1] = (int)(rand.nextDouble() * 3D);
    bit_c[l1] = j1;
    bit_sx[l1] = m_mouseX;
    bit_sy[l1] = m_nAppY - 5;
    bit_f[l1] = 2;
    if(++k1 == bit_max)
    break;
    if(bit_sound > 1)
    sound2.play();
    return true;
    public boolean mouseExit(Event event, int i, int j)
    m_mouseX = i;
    m_mouseY = j;
    return true;
    void rend()
    boolean flag = false;
    boolean flag1 = false;
    boolean flag2 = false;
    for(int k = 0; k < bits; k++)
    switch(bit_f[k])
    default:
    break;
    case 1: // '\001'
    bit_vy[k] += rand.nextDouble() / 50D;
    bit_px[k] += bit_vx[k];
    bit_py[k] += bit_vy[k];
    bit_l[k]--;
    if(bit_l[k] == 0 || bit_px[k] < 0.0D || bit_py[k] < 0.0D || bit_px[k] > (double)m_nAppX || bit_py[k] > (double)(m_nAppY - 3))
    bit_c[k] = 0xff000000;
    bit_f[k] = 0;
    } else
    if(bit_p[k] == 0)
    if((int)(rand.nextDouble() * 2D) == 0)
    bit_set((int)bit_px[k], (int)bit_py[k], -1);
    } else
    bit_set((int)bit_px[k], (int)bit_py[k], bit_c[k]);
    break;
    case 2: // '\002'
    bit_sy[k] -= 5;
    if((double)bit_sy[k] <= bit_py[k])
    bit_f[k] = 1;
    flag2 = true;
    if((int)(rand.nextDouble() * 20D) == 0)
    int i = (int)(rand.nextDouble() * 2D);
    int j = (int)(rand.nextDouble() * 5D);
    bit_set(bit_sx[k] + i, bit_sy[k] + j, -1);
    break;
    if(flag2 && bit_sound > 0)
    sound1.play();
    void bit_set(int i, int j, int k)
    int l = i + j * m_nAppX;
    pix0[l] = k;
    /*********************************end*******************************

    no one help me???????????

  • Which java applets are used for..........................

    hi,
    i want to ask that which java applets are used for receving sms on website.?????????????????????????
    or how can we receive sms on website by using which java applets? or tell me any other method for doing this task.
    thanx in advanced

    Hi,
    For general ledger :
    http://help.sap.com/saphelp_nw70/helpdata/en/57/dd153c4eb5d82ce10000000a114084/frameset.htm
    This is the best how-to guide on AP,AR,GL and TAX.
    http://help.sap.com/saphelp_nw04/helpdata/en/af/16533bbb15b762e10000000a114084/frameset.htm
    Hope it helps.
    Regards,
    Srikanth.

  • Checkpoint SSL Network extender stuck on Java applet when using firefox 4.0.1

    I use check point SSL network extender on my mac to access my company's VPN. Since upgrading to 4.0.1, I get the message "Please confirm the use of this Java applet and then refresh or reopen the window.
    If you have already disapproved using this applet, you might need to restart your browser before attempting to connect again"
    I'll accept, refresh, wait, and then the message comes back. I never get through. I just uninstalled 4.0.1 and went back to 3.6.17 and it's working fine on the old version.

    The first thing I notice is that you are using Firefox 4 and that is now out of date, it is not considered secure so it would make sense to upgrade to Firefox 5 (Or Firefox 6 if you read this after the 16th)
    You mention Firefox 3.6.17, and although Firefox 3.6 is still (for possibly only a limited time) supported I believe the current version is 3.6.20 (it is certainly at least 3.6.18) so again you are using an out of date version. I am not a Mac user but IIRC some of the recent updates were Mac specific and fixed Mac problems, possibly problems relating to Java.
    If you wish to use more than one version of Firefox to test problems developers tend to use separate profiles and custom installs but for ordinary users it may be worth considering firefox [http://portableapps.com/apps/internet/firefox_portable portable] versions. (that tip is applicable mainly to Windows users, no doubt there is also a poratable version for firfox5 Mac users somewhere)

  • Brand New to Java and Programming

    I'm brand new, ( RAW ) to software programming at this time. I'm starting from scratch, I work on a Help Desk for the government so I can perform some software functionality but nothing as far as programming.. I would like recommendations for someone starting out brand new.. Books to read (JAVA for Dummies?) any beginner courses? What steps would you take if you were starting out brand new as I am myself.. Thanks..
    PS, I plan on taking courses after I get the beginning stuff out of the way, just don't want to go in with no knowledge base..

    For a nice list of stock answers: The One to Torment Newbies with
    Sun's basic Java tutorial
    Sun's New To Java Center. Includes an overview of what Java is, instructions for setting up Java, an intro to programming (that includes links to the above tutorial or to parts of it), quizzes, a list of resources, and info on certification and courses.
    http://javaalmanac.com . A couple dozen code examples that supplement The Java Developers Almanac.
    jGuru. A general Java resource site. Includes FAQs, forums, courses, more.
    JavaRanch. To quote the tagline on their homepage: "a friendly place for Java greenhorns." FAQs, forums (moderated, I believe), sample code, all kinds of goodies for newbies. From what I've heard, they live up to the "friendly" claim.
    Bruce Eckel's Thinking in Java (Available online.)
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java.
    James Gosling's The Java Programming Language. Gosling is
    the creator of Java. It doesn't get much more authoritative than this.

  • What's the easiest way to save info from a java applet to use it later?

    How can a java applet take info from a user (text, binary, picture, or some other form), and save it (like on my computer), then bring it up when another user views the same applet?

    flounder
    "Did you try it?
    Do you have a file called Stuff.txt?
    Does the file contain "Testing outstream"?"
    Yes I compiled and ran the code as a Java applet, nothing happened. I was expecting a write error becase java applets are not inally allowed to write to a file. Yes I have file a Stuff.txt in the same directory as the program. No, nothing happened to the file, it stays blank.
    paulcw
    "And if you tested it, how did you test it?
    (Hint: the code you've shown doesn't need to extend Applet.) "
    If it does not extend applet then I get a class cast exception when I try to compile it as an applet.

  • Creating variables in a java swing program useing event

    This is my code:
    *Old School Calculator
    *@Collin Doering
    *Version 2.00
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class OSC {
         private static void createAndShowGUI() {
              int first = 0;
              int second = 0;
              int third = 0;
              int fourth = 0;
              int fifth = 0;
              int answer;
              System.out.println ("Calculations");
              System.out.println ("-------------");
              JFrame.setDefaultLookAndFeelDecorated(true);
              JFrame frame = new JFrame("OSC");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JButton button1 = new JButton("1");
    button1.setMnemonic(1);
    button1.addActionListener
         new ActionListener() {
              public void actionPerformed (ActionEvent e) {
    first = 1;
    //This is when the error says "Local variable first is accesed from
    with in inner class; needs to be declared final;
                   System.out.println ("first = ");
    JButton button2 = new JButton("2");
    button2.setMnemonic(2);
    button2.addActionListener
         new ActionListener() {
              public void actionPerformed (ActionEvent e) {
                   System.out.println ("Second = ");
    JButton buttonx = new JButton("x");
    buttonx.addActionListener
         new ActionListener() {
              public void actionPerformed (ActionEvent e) {
                   System.out.println ("answer: ");
    JPanel panel = new JPanel(new GridLayout(10,10));
    panel.add(button1);
              panel.add(button2);
              panel.add(buttonx);
              frame.getContentPane().add(panel);
    panel.setBorder(BorderFactory.createEmptyBorder(
    30, //top
    30, //left
    10, //bottom
    30) //right
    frame.pack();
    frame.setVisible(true);
         public static void main(String[] args) {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    I am trying to create variables so i can make a calculator (right now i only have buttons 1, 1 and multiply). //This is when the error says "Local variable first is accesed from
    with in inner class; needs to be declared final; then when i declare it final it says <identifier expected>. Could some one please help me. thanx.

    Please post code within code tags (press the "code" button).
    Why are you using an inner class? Simplify:
    public class OSC implements ActionListener {
    button1.addActionListener( this );
    public void actionPerformed( ActionEvent e ) {
        if ( e.getSource() == button1 ) . . .

  • Java/jsp programing using timer

    what I want to do is say
    at 8am every day
    send email news letter to all members on the database.
    without the press of a button on my side.
    anyone done such programing with java?
    Sample codes will bve much appreciated.
    Thanks in advance

    This sounds a good idea nut that means the hosting co
    have to allow the OS job to trigger it az 8 pm on
    their system because something has to be on
    permanently for it to happen.Well, that is information you might have given right away. In that case, you might be short of luck for a reliable way to do it. At least I can't think of a way - if all you can do is call a servlet, you'll need to activate it on 8 am yourself daily. I don't think you can make the servlet run in an endless loop that keeps it "alive" for eternity, to repeatedly trigger the mailing. I mean you probably can, but my bet is that it gets killed by the container after a certain timeout.

  • Need Help w/ Java Applet Program

    Hello, first time on fourms. I've taken one year of Java(Poorly instructed) and I am currently trying to build a simple program, my brother is a really good gymnast so the object of this program is two drop down menus with selections, and based on the selections, an output. It has been a while since i've done anything, i've looked for reference at old work i've done and I just have gotten lost, I just need a few pointers. I'm also having compile problems such as, "Cannot find symbol", it is frustrating me, any help would be greatly appreciated!
    Here is what i've got so far, based on the above "requirements" can anyone help me out? PS. The odd names I gave them are based on another similar program I wrote a while back. Thanks again!
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.*;
    public class gymnastics extends JFrame
    private JComboBox equationTypeComboBox;
    private JComboBox equationTypeComboBox2;
    private JTextField answerTextField;
    public gymnastics()
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         setUpInfoPanel();
         setUpInfoPanel2();
         setUpEquationPanel();
    setSize(300,340);
    answerTextField.requestFocus();
    private void setUpInfoPanel()
    JPanel infoPanel = new JPanel();
    infoPanel.setLayout(new BoxLayout(infoPanel, BoxLayout.Y_AXIS));
    JPanel typePanel = new JPanel();
    typePanel.add(new JLabel("Event type: "));
    equationTypeComboBox = new JComboBox("Floor", "Pommel", "Vault", "Rings", "PBars", "High Bar");
              typePanel.add(equationTypeComboBox);
    infoPanel.add(typePanel);
    getContentPane().add(infoPanel, BorderLayout.NORTH);
         private void setUpInfoPanel2()
              JPanel infoPanel2 = new JPanel();
              infoPanel2.setLayout(new BoxLayout(infoPanel2, BoxLayout.Y_AXIS));
              JPanel typePanel = new JPanel();
              typePanel2.add(new JLabel("Group Code: "));
              equationTypeComboBox2 = new JComboBox("I","II","III","IV","V");
              typePanel.add(equationTypeComboBox2);
              infoPanel.add(typePanel);
              getContentPane().add(infoPanel2, BorderLayout.CENTER);
         public void setUpEquationPanel();
         equationPanel.add(new JLabel("Output: "));
         answerTextField = new JTextField();
         answerTextField = ("Test Output");
    equationPanel.add(answerTextField);
    getContentPane().add(equationPanel, BorderLayout.SOUTH);
              public static void main(String args[])
         new gymnastics().setVisible(true);
    }

    Sorry about the code problem and thanks for the encouragement, it is just a bit frustrating at times.
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.*;
    public class gymnastics extends JFrame
    private JComboBox equationTypeComboBox;
    private JComboBox equationTypeComboBox2;
    private JTextField answerTextField;
    public gymnastics()
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setUpInfoPanel();
    setUpInfoPanel2();
    setUpEquationPanel();
    setSize(300,340);
    answerTextField.requestFocus();
    private void setUpInfoPanel()
    JPanel infoPanel = new JPanel();
    infoPanel.setLayout(new BoxLayout(infoPanel, BoxLayout.Y_AXIS));
    JPanel typePanel = new JPanel();
    typePanel.add(new JLabel("Event type: "));
    equationTypeComboBox = new JComboBox("Floor", "Pommel", "Vault", "Rings", "PBars", "High Bar");
    typePanel.add(equationTypeComboBox);
    infoPanel.add(typePanel);
    getContentPane().add(infoPanel, BorderLayout.NORTH);
    private void setUpInfoPanel2()
    JPanel infoPanel2 = new JPanel();
    infoPanel2.setLayout(new BoxLayout(infoPanel2, BoxLayout.Y_AXIS));
    JPanel typePanel = new JPanel();
    typePanel2.add(new JLabel("Group Code: "));
    equationTypeComboBox2 = new JComboBox("I","II","III","IV","V");
    typePanel.add(equationTypeComboBox2);
    infoPanel.add(typePanel);
    getContentPane().add(infoPanel2, BorderLayout.CENTER);
    public void setUpEquationPanel();
    equationPanel.add(new JLabel("Output: "));
    answerTextField = new JTextField();
    answerTextField = ("Test Output");
    equationPanel.add(answerTextField);
    getContentPane().add(equationPanel, BorderLayout.SOUTH);
    public static void main(String args[])
    new gymnastics().setVisible(true);
    }

  • New to Java - Wrapper program

    Hi there, I'm trying to do something really basic. I want to be able to take data from the user e.g =]'999 and print only the integer so I tried the following...
    package assignment2;
    import java.util.*;
    * @author Aaron
    public class WrapperTwo {
    * @param args the command line arguments
    public static void main(String[] args) {
    // TODO code application logic here
    Scanner scan = new Scanner(System.in);
    String line;
    int num;
    System.out.println("Enter a number: ");
    line = scan.nextLine();
    num = Integer.parseInt(line);
    System.out.println("" + num);
    When I enter just a number e.g 45, it'll print that number. If I enter 45]] or 45p it sends out the following errors:
    Exception in thread "main" java.lang.NumberFormatException: For input string: "p99"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    at java.lang.Integer.parseInt(Integer.java:447)
    at java.lang.Integer.parseInt(Integer.java:497)
    at assignment2.WrapperTwo.main(WrapperTwo.java:25)
    Java Result: 1
    If anyone could tell me where I'm going wrong that would be great. Thanks in advance!

    Hi all, thanks for helping!
    Before re-checking this post I figured out how to do it. Scan in the string, then take a substring from it before parsing it as an integer as only the first character can be non-numeric. I did it like this:-
    package assignment2;
    import java.util.*;
    * @author Aaron
    public class WrapperTwo {
    * @param args the command line arguments
    public static void main(String[] args) {
    // TODO code application logic here
    Scanner scan = new Scanner(System.in);
    String firstString;
              String firstString2;
    int firstNumber;
              System.out.println ("Enter a string: ");
              firstString = scan.nextLine();
              firstString2 = firstString.substring (1);
              firstNumber = Integer.parseInt(firstString2);
              System.out.println ("" + firstNumber);
    }

  • New to Java Wireless Programming - Help needed!

    I'm currently finishing my 4 java programmign class in university, and i'm not looking to expand my knowledge in the this language. I would like to learn the how to code for wireless devices. I've already downloaded the Java Wireless Toolkit, but I would really appreciate some direction on what I should read to know where to start with this. Any info that anyone may have is greatly appreciated!
    Thanks
    Al

    Googling J2ME tutorials or MIDP tutorials will give you plenty to read.
    but here's a start:
    http://www.developer.com/java/j2me/article.php/10934_1561591_1
    http://developers.sun.com/techtopics/mobility/midp/samples/index.html#getstart

  • Java Network Programming using UDP protocol

    I am trying to send the object using UDP protocol.
    In my client class it is giving me NullPointer excetion at clientSocket.send(sendPacket); although sendPacket is not null it has the value that I am passing.
    Here is the code :
    private boolean clientSrvrComm(AuditorData audData) throws Exception
              boolean result = false;
              ByteArrayOutputStream barray_out = new ByteArrayOutputStream();
              ObjectOutputStream obj_out = new ObjectOutputStream(barray_out);
              obj_out.flush();
              obj_out.writeObject(audData);
              obj_out.flush();
              // sending the data to the server
              byte[] sendData = barray_out.toByteArray();
              DatagramPacket sendPacket = new DatagramPacket(sendData,sendData.length,IPAddress,serverPort);
              clientSocket.send(sendPacket); // getting exception at this line
              return result;
         } // method end
    I am passing audData through main method.
    Any help would be appreciate.
    Thanks,
    Swati

    actually it shouldn't give the null pointer exception and send the object to the server.
    I am not able to get, why it is throwing the exception, even there is no class for debugging.

  • Java applet programming

    How could we move images that are brought in to an applat viewer with the help of mouse one at a time?
    the one to which the mouse pointere is pointed?
    please do explain it I am a beginner.
    Edited by: Afzal_a_s on May 8, 2009 3:10 AM

    Cut/copy/paste are not a security issue. I use these as a good way to get around security - my applet writes code into JTextArea, users copy this and then paste into their own code.
    Why not just go on a single click?
    If you stick with a TextArea (no Swing) your applet will work in MSIE which has a 1.1 JVM. JTextArea would be much better, but you'll have to wrestle with EMBED and OBJECT tags. (You'll have to wrestle with that in a couple years when the Microsoft license expires.) This is all laid out at:
    http://martinrinehart.com, Articles, Launching Applets.
    As you're academic, everything there is freeware. The javascript that solves all the launch issues is
    http://martinrinehart.com/examples/launchApplet.js

  • Create a file at a Windows Vista using java applets

    I have created a java applet which is downloaded to create local file at a Windows Vista PC. The java codes are:
    File out = new File("c:/users/test/hkuesd.properties");
    FileWriter fw = new FileWriter(out);
    PrintWriter pw = new PrintWriter(fw, true);
    pw.println("#sample property file");
    pw.println("key_path=C:/");
    pw.close();
    fw.close();
    If I turn off "Users Account Control" under "Control Panel" --> "User Accounts", the file "hkuesd.properties" is created at c:\users\test and can be found using windows explorer.
    However, if I turn on "Users Account Control", I can not find the file "hkuesd.properties" using windows explorer. But the file can be detected if I run another java applet program with the following codes:
    File xpdir = new File("c:/users/test/hkuesd.properties");
    FileInputStream fis = null;
    if (xpdir.exists()) {
    try {
    fis = new FileInputStream("c:/users/test/hkuesd.properties");
    Properties p = new Properties();
    p.load(fis);
    fis.close();
    privateKeyPath = p.getProperty("key_path", "no value");
    catch (Exception e) {}
    Interestingly, if "Users Account Control" is on and I created the file "c:\users\test\hkuesd.properties" manually, the file creation codes
    mentioned above seems to create another "hkuesd.properties" at the same "c:\users\test". The evidence is I run the second java applet program which can detect the one created by the first java applet but not the one I created manually.

    I agreed that it is hardly explained in words. I
    suggested to write two
    simple java applets using the codes and you will see
    the effects:
    (1) the first applet can create a file
    "hkuesd.properties"
    (2) cannot find the file using windows explorer to
    search the whole drive.
    (3) However, can read the content of the file using
    second applet.You still haven't address your problem of swallowing exceptions. Your code might be throwing an exception that tells you exactly what the problem is. Change your code to display or log that exception.

  • Using external libraries over signed Java applet: InvocationTargetException when running locally with 7u51

    We have a signed Java applet that uses external libraries, specifically the OpenOffice application libraries.
    We have a problem running Java applet with 7u51 of "InvocationTargetException" when use these libraries OpenOffice, that is not signed; regardless of the browser used (Mozilla Firefox, Explorer, Chrome).
    Please, as you could solve this problem?   This problem can not arose with 7u40 and earlier..
    Best regards.

    In  java - JRE 1.7.0_51-b13 and signed applet - Stack Overflow found solution. I've missed to add in external jars manifest this: 
    Trusted-Library: true

Maybe you are looking for

  • User gets odd behavior when print previewing calendar

    User calls with an odd problem. She is using 32 bit IE 9 with our SP 2010 farm. She goes to her department calendar. She sees events. She presses Print Preview. No events are shown on the page. She tries to export the data to Outlook - it tells her t

  • Bootcamp Windows 7 Sleep Display question?

    Hey guys, I have a 27" iMac running Boot Camp with both Mac OS X Mountain Lion and Windows 7 Ultimate. When I'm in Windows, is there a way that I can turn off the display? Currently if I press the power button on the back of the machine it automatica

  • No entry found in it_accposnr for posnr 0000000734

    Dear All, While going for running assessment cycle through KSU5, we are getting dump as a part of runtime error. Below is the message getting as a part of Error : No entry found in it_accposnr for posnr 0000000734 Pls let me know abount this error an

  • Witch version are there for ppc macar I have problem with my bank swedbank it´s 3.6

    Mac G5 dual 2.0

  • XmlDom Sample

    I need to generate an XML document (HPRIM format) from an SQL query result(1 line is returned)... I'm looking for sample for PL/SQL procédure using xmldom API , to generate the document ( create document, create element, create attributs, etc.) . Ne