Article View: borland.public.jbuilder.java.language
Article #8781Re: How do i get Pixeels per inch from the system ??
From: Ivo B. Limmen
Date: Mon, 26 Feb 2001 12:45
Date: Mon, 26 Feb 2001 12:45
56 lines
2632 bytes
2632 bytes
The Toolkit is not static and should be instanciated before use, I
personally never used AWT but it should probably be:
---
Toolkit tk = new Toolkit();
int ScreenRess = tk.getScreenResolution();
---
Ivo
"Asger Joergensen" <Asger.P@get2net.dk> wrote in message
news:3A9A331E.DBB09B6F@get2net.dk...
> Hi John
> and thans for the reply
>
> "John McGrath [TeamB]" wrote:
>
> > On Sun, 25 Feb 2001 11:28:34 +0100, Asger Joergensen wrote:
> >
> > > i would like to be able to get the pixels per inch
> > > from the system
> >
> > See Toolkit.getScreenResolution();
>
> Yeb, that seem to be what i want, but i cant figure
> how to use it.
> Would You be so kind as to show me how to use it ??
>
> Remember i am a total beginner to this Java stuff..;-)
>
> This is the exercise i am working on:
>
> import javax.swing.JOptionPane; //Import class JOptionPane
> import java.awt.Toolkit; //Import class Toolkit
>
> public class Palindrome
> {
> public static void main(String args[])
> {
> String Text, // Return string from Dialog
> Result = ""; // Result to show
> int Length; // Length of returned string
>
> int ScreenRess = Toolkit.getScreenResolution();
>
> ------ Snip ------
>
> i get an error that sayes:
> "non-static method getScreenResolution() cannot be referenced
> from a static context"
>
> P.s. the rest of the exercise only shows a couple dialogs and then
> terminates.
>
> Thanks in advance
> Asger
>
Technical Details
Message-ID:
<97dj7n$67f$1@porthos.nl.uu.net>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.worldonline.nl!newsfeed1.news.nl.uu.net!sun4nl!reader1.news.nl.uu.net!not-for-mailReferences:
<3A98DE52.40C56298@get2net.dk> <MPG.15038c1045ad5045989fc1@forums.borland.com> <3A9A331E.DBB09B6F@get2net.dk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,dde485c2b9c97ae9 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-02-26 04:50:06 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.worldonline.nl!newsfeed1.news.nl.uu.net!sun4nl!reader1.news.nl.uu.net!not-for-mail From: "Ivo B. Limmen" <limmen@furore.nl> Newsgroups: borland.public.jbuilder.java.language Subject: Re: How do i get Pixeels per inch from the system ?? Date: Mon, 26 Feb 2001 13:45:42 +0100 Organization: UUNET-NL (http://www.nl.uu.net) Lines: 58 Message-ID: <97dj7n$67f$1@porthos.nl.uu.net> References: <3A98DE52.40C56298@get2net.dk> <MPG.15038c1045ad5045989fc1@forums.borland.com> <3A9A331E.DBB09B6F@get2net.dk> NNTP-Posting-Host: 1cust217.tnt9.rtm1.nl.uu.net X-Trace: porthos.nl.uu.net 983191607 6383 213.116.112.217 (26 Feb 2001 12:46:47 GMT) X-Complaints-To: abuse@nl.uu.net NNTP-Posting-Date: 26 Feb 2001 12:46:47 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400