Skupiny Google už nepodporují nová předplatná ani příspěvky Usenet. Historický obsah lze zobrazit stále.

Applet width and height

3 zobrazení
Přeskočit na první nepřečtenou zprávu

Kirill Richine

nepřečteno,
12. 1. 1997 3:00:0012.01.97
komu:

Hi!

I was wondering if the applet is aware of its width and height
specified in the corresponding html page in the tag

<APPLET code="SomeClass.class" width = 150 height = 50>

I suppose I could just duplicate them using special params, e.g.

<PARAM name="width" value = "150">
...

but is there a more straightforward way?

Thank you.
k&

Wayne Holder

nepřečteno,
12. 1. 1997 3:00:0012.01.97
komu:

In article <5bbgk9$9...@scapa.cs.ualberta.ca>, kir...@cs.ualberta.ca (Kirill
Richine) wrote:

int width = size().width;
int height = size().height;

Spend a few bucks and invest in the new book, The Java Class Libaries; An
Annotated Reference by Chan and Lee.

Wayne

--
Give me Limbaugh or give me . . . well not death, but life would be
pretty boring without my daily dose.

Curtis Keisler

nepřečteno,
12. 1. 1997 3:00:0012.01.97
komu:

Kirill Richine wrote:
>
> Hi!
>
> I was wondering if the applet is aware of its width and height
> specified in the corresponding html page in the tag
>
> <APPLET code="SomeClass.class" width = 150 height = 50>
>
> I suppose I could just duplicate them using special params, e.g.
>
> <PARAM name="width" value = "150">
> ...

Applet extends Panel
Panel extends Container
Container extends Component
Component has the method size() which returns Dimension which is what
you were looking for ... its all about geneology <g> ... just study the
tree ...!!!!

Later,
Curt

Curtis Keisler

nepřečteno,
12. 1. 1997 3:00:0012.01.97
komu:

Wayne Holder wrote:
> Spend a few bucks and invest in the new book, The Java Class Libaries; An
> Annotated Reference by Chan and Lee.

About 50+ to be exact but in my opinion worth it! However, the
information needed to solve this problem is in the html docs ( I prefer
the pdfs.) which are um ... FREE <G> .

Later,
Curt

dog

nepřečteno,
13. 1. 1997 3:00:0013.01.97
komu:

Kirill Richine <kir...@cs.ualberta.ca> wrote :

> I was wondering if the applet is aware of its width and height
> specified in the corresponding html page in the tag
>
> <APPLET code="SomeClass.class" width = 150 height = 50>
>
> I suppose I could just duplicate them using special params, e.g.
>
> <PARAM name="width" value = "150">
> ...
>
> but is there a more straightforward way?

yes: Applet is a subclass of Panel (a Component). thus, you can call
getSize() (jdk1.1beta) or size() (jdk1.02) on it (returns a Dimension).

dog
| d...@dog.net.uk
| http://dog.net.uk
| cheeky as buggery


Ian Taylor

nepřečteno,
14. 1. 1997 3:00:0014.01.97
komu:

How do I get an environment varaible from within java 1.1 ?
System.getenv() is now obsolete and I get the error :-

java.lang.Error: getenv no longer supported, use properties and -D instead: GRID_HOME
at java.lang.System.getenv(System.java)
at grid.ocl.Env.home(Env.java:162)
at grid.ocl.Env.properties(Env.java:239)

if I try to use it. The above message isn't very helpful. I presume it means use
a -D option when you use the System.getProperty() method but I've tried all
permutations I could think of and it didn't work. Does anybody know how to
do this ?

thanks

email : I.Ta...@astro.cf.ac.uk

Ian


David Brown

nepřečteno,
14. 1. 1997 3:00:0014.01.97
komu:

What it means is that you can define properties by passing -D options
to the java interpreter on the command-line:

shell-prompt> java -Dfoo=bar -DmyProp=myVal my.java.Main [args-to-java-main]

Starting the interpreter like this means that you'll get "bar" and "myVal"
when you call System.getProperty("foo") and System.getProperty("myProp"),
respectively. Note the distinction between options to the interpreter and
options to the java program itself, (here, "my.java.Main"), the one that
defines public static void main(String[] argv): anything on the command-line
that occurs before the classname is passed as an option to the interpreter,
anything after the classname goes into argv.

This is of course a bit clumsy for a user to type in. The syntax is meant
to be used in a wrapper shell/batch script. You can use such a script to
define the whole environment in the shell that starts the interpreter as
java properties, and get the same basic behavior as getenv(). Also, you
can explictly load properties from a flat text file (actually from any
InputStream), with a bunch of lines of the form key=value. Lines in such
a stream that start with '#' are considered comments. Check out the
documentation for java.util.Properties and java.lang.System.setProperties().

Hope this helps,

-Dave Brown

Alan Weiner

nepřečteno,
15. 1. 1997 3:00:0015.01.97
komu:

int width=Integer.valueOf(getParameterI("width")).intValue();
int height=Integer.valueOf(getParameterI("height")).intValue();

On 12 Jan 1997 20:12:57 GMT, kir...@cs.ualberta.ca (Kirill Richine)
wrote:

>Hi!
>


>I was wondering if the applet is aware of its width and height
>specified in the corresponding html page in the tag
>
><APPLET code="SomeClass.class" width = 150 height = 50>
>
>I suppose I could just duplicate them using special params, e.g.
>
><PARAM name="width" value = "150">
>...
>
>but is there a more straightforward way?
>

>Thank you.
>k&


Alex McManus

nepřečteno,
16. 1. 1997 3:00:0016.01.97
komu:


Ian Taylor <I.Ta...@astro.cf.ac.uk> wrote in article
<E3zyq...@cf.ac.uk>...


>
> How do I get an environment varaible from within java 1.1 ?
> System.getenv() is now obsolete and I get the error :-
>
> java.lang.Error: getenv no longer supported, use properties and -D
instead: GRID_HOME
> at java.lang.System.getenv(System.java)
> at grid.ocl.Env.home(Env.java:162)
> at grid.ocl.Env.properties(Env.java:239)
>

I believe the -D refers to the java command line - this enables you to see
properties when you start the java app.

e.g. start the program with...
java -Dmy.dir=c:\Alex MyApp
...and...
System.getProperty( "my.dir" )
...will return...
"c:\Alex"

In other words, you have to set the properties explicitly from the command
line, perhaps through a shell script/batch file.

Alex McManus (a...@aber.ac.uk).

Chris Trueman

nepřečteno,
22. 1. 1997 3:00:0022.01.97
komu:

On 12 Jan 1997 20:12:57 GMT, kir...@cs.ualberta.ca (Kirill Richine)
wrote:

Why not use size().width and size().height

0 nových zpráv