How can I watch my applet?

Hi, I tried to view how my applet is looking, but I can't. I tried>

1. Creating an html page, but it says "Loading applet failed"

2. Using the appletviewer, but when I open the .exe, it closes inmediately and doesn't give me a chance to type anything

3. Using a dos window: start, run, cmd, cd .., etc... ,but it doesn't work either

4. Using a main code inside the applet (it creates itself when I choose "run standalone" when using the applet wizard that offers Jdeveloper). This option kind of works, but I'm not sure if it takes all the changes I make in the applet...

Any other ideas? Thanks

[639 byte] By [kandua] at [2007-11-27 8:37:25]
# 1
HiCan you please post your applets code as well as your html code, so we can see where you're having the issue?:)
monk3ya at 2007-7-12 20:34:45 > top of Java-index,Desktop,Core GUI APIs...
# 2

Thank you monk3y,

I just did watch the applet. I satarted working with Borland JBuilder X instead of with JDeveloper, and it worked, but thanks.

Anyways, I'm still having a problem with my applet. I am trying to drag and drop JButtons, but when I do, it leaves a mark behind (where it's been dragged). I think there might be a problem with the repaint, update or validate methods, but I'm not sure of what. I've read some things but can't find the answer...

I would appreciate it of you could run my applet in your Java and see what I'm talking about. Thnaks in advance, here are the codes of my two classes.

HERE IS THE APPLET CODE

package proyectoreal;

import java.awt.*;

import java.awt.event.*;

import java.applet.*;

import com.borland.jbcl.layout.*;

import javax.swing.*;

import javax.swing.border.*;

/**

*

Title:

*

Description:

*

Copyright: Copyright (c) 2007

*

Company:

* @author not attributable

* @version 1.0

*/

public class Appletprueba extends Applet {

private boolean isStandalone = false;

XYLayout xYLayout1 = new XYLayout();

TitledBorder titledBorder1;

JButton jButton2 = new JButton();

//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 Appletprueba() {

}

//Initialize the applet

public void init() {

try {

jbInit();

}

catch(Exception e) {

e.printStackTrace();

}

}

public void update(Graphics g){

}

//Component initialization

private void jbInit() throws Exception {

titledBorder1 = new TitledBorder("");

this.setBackground(new Color(0, 233, 216));

this.setForeground(Color.black);

this.setVisible(true);

this.setLayout(xYLayout1);

jButton2.setText("jButton2");

jButton2.addMouseListener(new Appletprueba_jButton2_mouseAdapter(this));

this.add(jButton2, new XYConstraints(72, 27, 79, 31));

//this.repaint();

}

//Get Applet information

public String getAppletInfo() {

return "Applet Information";

}

//Get parameter info

public String[][] getParameterInfo() {

return null;

}

void jButton2_mouseClicked(MouseEvent e) {

botonquesedraga ani = new botonquesedraga();

this.add(ani, new XYConstraints(50,50,79,31));

this.validate();

//this.repaint();

//repaint();

}

}

class Appletprueba_jButton2_mouseAdapter extends java.awt.event.MouseAdapter {

Appletprueba adaptee;

Appletprueba_jButton2_mouseAdapter(Appletprueba adaptee) {

this.adaptee = adaptee;

}

public void mouseClicked(MouseEvent e) {

adaptee.jButton2_mouseClicked(e);

}

}

HERE IS THE OTHER CLASS I'M USING (CALLING FROM APPLET)

package proyectoreal;

import java.awt.*;

//import java.awt.event.*;

//import java.applet.*;

//import com.borland.jbcl.layout.*;

import javax.swing.*;

import java.awt.event.*;

//import javax.swing.border.*;

class botonquesedraga extends JButton{

public botonquesedraga() {

try {

jbInit();

}

catch(Exception e) {

e.printStackTrace();

}

}

private void jbInit() throws Exception {

this.setBackground(Color.pink);

this.addMouseMotionListener(new botonquesedraga_this_mouseMotionAdapter(this));

}

void this_mouseDragged(MouseEvent e) {

this.setLocation(this.getX()+e.getX(),this.getY()+e.getY());

//revalidate();

}

}

class botonquesedraga_this_mouseMotionAdapter extends java.awt.event.MouseMotionAdapter {

botonquesedraga adaptee;

botonquesedraga_this_mouseMotionAdapter(botonquesedraga adaptee) {

this.adaptee = adaptee;

}

public void mouseDragged(MouseEvent e) {

adaptee.this_mouseDragged(e);

}

}

Thank you

kandua at 2007-7-12 20:34:45 > top of Java-index,Desktop,Core GUI APIs...
# 3

[nobr]By the way, my html code is: (just in case you need it)

<html>

<head>

<title>

HTML Test Page

</title>

</head>

<body>

proyectoreal.Appletprueba will appear below in a Java enabled browser.<br>

<applet

codebase = "."

code= "proyectoreal.Appletprueba.class"

name= "TestApplet"

width= "800"

height= "600"

hspace= "0"

vspace= "0"

align= "middle"

>

</applet>

</body>

</html>

[/nobr]

kandua at 2007-7-12 20:34:45 > top of Java-index,Desktop,Core GUI APIs...