Index:
[thread]
[date]
[subject]
[author]
From: Garrett Mitchener <wgm2@duke.edu>
To :
Date: 15 Apr 1999 19:27:05 -0400
Re: quiz clients
I think a better idea is to write things in terms of Panels, and then
add a Panel to your Frame or Applet. You should try to write whatever
classes are involved so that they don't depend on being in an applet.
Instead of getting images file names from an applet context directly,
you should factor that part out into subclasses:
public interface ImageTable
{
public Image getImageFromName( String name );
}
public class AppletContextImageTable implements ImageTable
{
...
}
public class PlainFileImageTable implements ImageTable
{
...
}
public class MyApplication
{
public setImageTable( ImageTable t )
...
}
Then when you run it as a stand-alone program, you give it one kind of
image table, and when you run it from an Applet, you give it the other
one.
-- Garrett :-)
Nisha Kapur <nishak@kinglet.cs.duke.edu> writes:
> On Wed, 14 Apr 1999, Huned M. Botee wrote:
>
> > Just a small, possibly irrelevant, note.
> >
> > It is possible to convert an applet into an application just by giving
> > it someplace to live within a GUI (ie, a Frame). So, theoretically,
> > (although I don't recommend it necessarily and without reservations) you
> > can write everything you do as an applet. Then give it a place to live
> > (a frame or something) and it magically becomes an applciation.
> >
> > I think that's right. Anyone see anything wrong w/ the above? I've only
> > done it a couple times, but it is possible.
>
> I have done this and it works except for the fact that I have to specify
> the complete path for the images that I am loading - is there a way of
> specifying relative paths. We use a getDocumentBase() function to get the
> path and add it to the image name in applets - is there soemthing like
> this if you wanted to do it with a Frame?
>
> > >
> > > when we turn the quiz in, does we need to have written both main and applet
> > > type clients, or just one?
>
> Oh well, I have done both.
>
> Nisha
Index:
[thread]
[date]
[subject]
[author]