...
>I need to get my project running on the web. So, I need to embed the
>JFrame in the JApplet, so that instead of calling the JFrame from the
>JApplet, i can call another JApplet which has this JFrame.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
> ..
>
[quoted text clipped - 29 lines]
>
> Message posted viahttp://www.javakb.com
Hi,
Yes Andrew, I control the source to all the applets and frames.
And how do I convert between applets and frames??
This is my snippet code:
class chess1 extends JFrame implements MouseListener
{
int x=0,count1=0,y=0,x1,y1,bx=0,by=0,rx=0,ry=0;
int game=0,px,py,mov=0;
public int c_trails=0;
static int pre=0;
public int flg=0,load1=0,pawn=0;
public int m1[][]= new int[8][8];
public int m2[][]= new int[8][8];
FrameDemo fd = new FrameDemo();
Image imgb[] = new Image[10];
Image imgw[] = new Image[10];
Font headlineFont = new Font("Courier", Font.BOLD+Font.ITALIC, 20);
Image img1 = Toolkit.getDefaultToolkit().getImage("bg.gif");
Image img2 = Toolkit.getDefaultToolkit().getImage("b9.jpg");
Image img3 = Toolkit.getDefaultToolkit().getImage("b10.jpg");
Image img4 = Toolkit.getDefaultToolkit().getImage("w9.jpg");
Image img5 = Toolkit.getDefaultToolkit().getImage("w10.jpg");
Image img6 = Toolkit.getDefaultToolkit().getImage("win.jpg");
chess1()
{
super(" CHESS PUZZLE ");
getContentPane().setLayout(new FlowLayout());
addMouseListener(this);
pre=1;
setSize(1000,1000);
setVisible(true);
for(int i=0;i<8;i++)
for(int j=0;j<8;j++)
{
m1[i][j]=0;
m2[i][j]=0;
}
loadw();
loadb();
loadinggame();
}
public static void main(String args[])
{
int g=0;
start_play F = new start_play();
//if(pre==1){
/*chess1 frame = new chess1();
frame.setSize(700,700);
frame.setVisible(true);*/
return;
}
(Other methods follow)
This part basically loads the chess board, the white and black pieces
(all jpg files) into the frame.
Im able to call this frame from an applet, but as I said earlier,I
want this part to be a part of an applet.
How do I go about that???
Andrew Thompson - 18 Apr 2007 07:52 GMT
...
>And how do I convert between applets and frames??
For a 'frame to applet', move whatever is in the frame's
constructor into the init() method of the applet.
Whatever the frame does on minimise or restore
can be put in stop() and start() respectively, while
the things it does on shutdown are moved to
destroy().
If the frame constructor takes arguments, they cannot
be passed to the applet in init() (which takes no args),
but instead whould be configured using getParameter().
For an applet to frame, do the opposite.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Andrew Thompson - 18 Apr 2007 08:20 GMT
..
>And how do I convert between applets and frames??
See also
<http://java.sun.com/docs/books/tutorial/deployment/applet/getStarted.html>
HTH

Signature
Andrew Thompson
http://www.athompson.info/andrew/
pramodsa - 22 Apr 2007 16:50 GMT
> .
>
[quoted text clipped - 9 lines]
>
> Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-gui/200704/1
Hey,
Thanks Andrew...
I kind of got ur idea to work, but theres still seems to be a problem.
The applet gets loaded now, but im not able to load the images on to
the applet.
Im trying to use the following statements to load the images:
Image img1 =
Toolkit.getDefaultToolkit().getImage("bg.gif");
I also tried to use the below two:
Image img1 = getImage(getDocumentBase(),"bg.gif") ;
Image img1 = getImage(getCodeBase(),"bg.gif");
But, im unsuccessful.
I tried placing these statements in init() as well as outside init().
Please Help,
Thank You.
Andrew Thompson - 22 Apr 2007 17:24 GMT
...
>I kind of got ur idea to work, ..
It is not so much my idea, as the way to go about converting
a frame to an applet. (And that word is 'your'.)
>..but theres still seems to be a problem.
>The applet gets loaded now, but im not able to load the images on to
[quoted text clipped - 9 lines]
>
>But, im unsuccessful.
Where is the applet? Can you give us the URL to the web
page it is in? Where are the images? What is the codebase
and document base? If the applet is not available on the net,
describe exactly the structure of the directories and the
paths to the images.*
If the image is found, it might be that you are attempting to
display it before it is loaded.
(I have no crystal ball, here - so I'm just guessing without
the information above)
* What do those statements produce as URL's?
Print them out to the console. Try along these lines..
System.out.println( "Image via codebase: " +
new URL(getCodeBase() + "blah.gif") );
( Do the same for the others. )
When you get URL's, try pasting them in the browser address
bar and do a 'direct fetch' and check the ibrowser can load the
image.
Note also that this is fairly basic stuff (finding resources and
basic debugging). For those learning Java, a good group is
comp.lang.java.help.

Signature
Andrew Thompson
http://www.athompson.info/andrew/