Re: JFrame as JApplet?



On Mon, 27 Jun 2005 15:26:05 +0200, Thomas Weidenfeller wrote:

> Thomas Fritsch wrote:
>> Seems that you refer to this article:
>> http://java.sun.com/developer/technicalArticles/Programming/TurningAnApplet/
>
> I really don't remember :-) But that one looks indeed like a good start.

For hosting an existing applet (with no source) in an application,
I agree, but the OP has the means to go a much easier route.

Since they control the code, they can implement it this GUI as a
Container/(J)Panel which can then be used in whatever it is needed.

Note that article ends with..
"The AppletStub technique is easier to do than rearchitecting, "

*

"...but may still not work completely if your applet depends on the
AppletContext for anything. "

Implementing an applet context that is even half way reasonable
is no easy matter. I wrote one that went slightly further than
the applet context provided for the applet viewer (mine hooked in
to BrowserLauncher to implement showDocument(URL)), but that took
some time to get right, and did not go to the more complex
abilities such as getting an enumeration of all applets (only one
could be opened at a time anyway), getting the stream keys, etc..

When you consider how tricky it is to reimplement some of
the aspects of the applet context that are commonly used by applets,
it becomes clear that it is easier to do the GUI as a Container
and use it as and when necessary, whether that usage is in a
(J)Applet, (J)Frame, (J)Window, (J)Dialog, another Container or
(J)Panel *or* JOptionPane.

* And I disagree with '..easier to do than rearchitecting,'
(unless you lack the source to the applet) because most applets
_do_ depend on the applet context.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
.



Relevant Pages

  • Re: Can I combine GUI & Applet?
    ... a JApplet (just add the components to the JApplet, ... Yes, I did that to produce an applet from the command line utility/GUI application, pausing only to strip out a lot of no-longer needed stuff such as mainand all the menu-bar related code. ... However, there are a few cases, mostly small applications, where it would be nice to be able to execute the same code as a command line utility, a stand-alone GUI application or embed it in a web page. ...
    (comp.lang.java.programmer)
  • Re: perl/tk + html
    ... information which it portrays visually on the map in the GUI. ... server so that the interface could be viewed remotely from any client. ... You would like to have a "perl-tk applet", ... You create a VNC server on your computer, and use a Java embedded VNC ...
    (comp.lang.perl.tk)
  • Re: help - accidentally creating floating applet
    ... code generated by it is the generic applet templete, ... I have done various Java applications, but this is my first GUI & ... That leaves me with a dead HTML page. ... unreasonable since it was simply showing basic GUI initialization. ...
    (comp.lang.java.help)
  • Re: Please thiHelp
    ... You can't put windows forms in an applet. ... Java is not as "friendly" as windows when it comes to GUI ... If you don't use layout managers, your applet will look funny on other ...
    (microsoft.public.dotnet.vjsharp)
  • Re: Applet problems in adding a bgImage
    ... > I am in the early stages of designing an applet and am having some ... What 'trouble'. ... If this comes from a 'GUI' book. ... > public void paint{ ...
    (comp.lang.java.programmer)