Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #1470 > unrolled thread
| Started by | "pramodsa" <pramodsa@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:33 +0000 |
| Last post | 2011-04-27 15:33 +0000 |
| Articles | 7 — 2 participants |
Back to article view | Back to comp.lang.java.gui
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Embedding a Jframe in an "pramodsa" <pramodsa@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Embedding a Jframe in "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Embedding a Jframe in "pramodsa" <pramodsa@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Embedding a Jframe in "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Embedding a Jframe in "pramodsa" <pramodsa@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Embedding a Jframe in "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
Re: Embedding a Jframe in "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:33 +0000
| From | "pramodsa" <pramodsa@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Embedding a Jframe in an |
| Message-ID | <1176840757.471015.271040@n59g2000hsh.googlegroups.com> |
To: comp.lang.java.gui Hello All, I have a JFrame and a JApplet. I need to navigate from the JApplet to the JFrame. (This is not an issue). 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. Help badly needed. Thanks in advance, Pramod --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Embedding a Jframe in |
| Message-ID | <70dc60a6f2e1e@uwe> |
| In reply to | #1470 |
To: comp.lang.java.gui pramodsa wrote: .. >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. Do you control the source to all these frames and applets? If so, it would be simplest to convert between applets and frames as needed (in coding). Note that if the main GUI is made within a JPanel, the JPAnel can be used in either a JFrame or JApplet as needed. Applets can (theoretically) call showDocument() to show another web page, but note that the showDocument() has never been reliable, and provides no feedback (to the applet that makes the call). Further, applets themselves are problematic, and becoming ever more so. I recommend you re-enginerr the application so that it.. 1) Starts as a JFrame which opens.. 2) Other GUI elements contained within JDialog s as needed, and is.. 3) Launched using web start. We start applications are launched from a link and much easier to deploy than applets. Here are some examples.. <http://www.physci.org/jws/> HTH -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via http://www.javakb.com --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "pramodsa" <pramodsa@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Embedding a Jframe in |
| Message-ID | <1176869879.180824.265640@q75g2000hsh.googlegroups.com> |
| In reply to | #1473 |
To: comp.lang.java.gui
On Apr 17, 7:55 pm, "Andrew Thompson" <u32984@uwe> wrote:
> pramodsa wrote:
>
> ..
>
> >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.
>
> Do you control the source to all these frames and applets?
> If so, it would be simplest to convert between applets and frames
> as needed (in coding). Note that if the main GUI is made within
> a JPanel, the JPAnel can be used in either a JFrame or JApplet
> as needed.
>
> Applets can (theoretically) call showDocument() to show another
> web page, but note that the showDocument() has never been
> reliable, and provides no feedback (to the applet that makes the
> call). Further, applets themselves are problematic, and becoming
> ever more so.
>
> I recommend you re-enginerr the application so that it..
> 1) Starts as a JFrame which opens..
> 2) Other GUI elements contained within JDialog s as needed, and is..
> 3) Launched using web start.
>
> We start applications are launched from a link and much
> easier to deploy than applets. Here are some examples..
> <http://www.physci.org/jws/>
>
> HTH
>
> --
> Andrew Thompsonhttp://www.athompson.info/andrew/
>
> 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???
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Embedding a Jframe in |
| Message-ID | <70e0436326a0a@uwe> |
| In reply to | #1474 |
To: comp.lang.java.gui pramodsa wrote: . >And how do I convert between applets and frames?? See also <http://java.sun.com/docs/books/tutorial/deployment/applet/getStarted.html> HTH -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200704/1 --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "pramodsa" <pramodsa@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Embedding a Jframe in |
| Message-ID | <1177257019.930895.220100@e65g2000hsc.googlegroups.com> |
| In reply to | #1475 |
To: comp.lang.java.gui
On Apr 18, 3:20 am, "Andrew Thompson" <u32984@uwe> wrote:
> pramodsa wrote:
>
> .
>
> >And how do I convert between applets and frames??
>
> See also
> <http://java.sun.com/docs/books/tutorial/deployment/applet/getStarted....>
>
> HTH
>
> --
> Andrew Thompsonhttp://www.athompson.info/andrew/
>
> 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.
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Embedding a Jframe in |
| Message-ID | <71174edf22588@uwe> |
| In reply to | #1511 |
To: comp.lang.java.gui
pramodsa wrote:
..
>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
>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.
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.
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via http://www.javakb.com
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:33 +0000 |
| Subject | Re: Embedding a Jframe in |
| Message-ID | <70e0055aaf752@uwe> |
| In reply to | #1474 |
To: comp.lang.java.gui pramodsa wrote: .. >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. -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200704/1 --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web