• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Monitor Size

 
chiru
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to Calculate the size of Monitor like 17" 15"
 
Maneesh Godbole
Saloon Keeper
Posts: 11073
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by chiru:
How to Calculate the size of Monitor like 17" 15"


The Toolkit class will has methods to get the screen size as well as the screen resolution, based on which you can compute the Monitor size.
 
chiru
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm calculateing like this but i think it is not giveing exact value if i change the resolution of dispaly
Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
int pixelPerInch=java.awt.Toolkit.getDefaultToolkit().getScreenResolution();
double height=screen.getHeight()/pixelPerInch;
double width=screen.getWidth()/pixelPerInch;
double x=Math.pow(height,2);
double y=Math.pow(width,2);
jLabel1.setText("Res"+screen.getHeight()+"X"+screen.getWidth()+"Pixel/Inch"+pixelPerInch+" "+x+" "+y+"="+Math.sqrt(x+y));
 
Mark Newton
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you think is wrong with it? I've just run it and seem to get realistic output.

I assume you're not expecting an exact answer like 15 inches - a 15 inch monitor will have an actual screen size of slightly less.

[Edit: punctuation]
[ February 07, 2008: Message edited by: David Payne ]
 
chiru
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but if i run this code in 17" monitor which is having same resolution it is giving 15. somthing..
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chiru.

Please check your private messages.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic