Maybe?
Toolkit.getDefaultTolkit().getScreenSize().getWidth()
and
Toolkit.getDefaultTolkit().getScreenSize().getHeight()
Those will be doubles though, so you may need to cast them to int, depending on your use.
(int)Toolkit.getDefaultTolkit().getScreenSize().getWidth()
(int)Toolkit.getDefaultTolkit().getScreenSize().getHeight()
I'm basing this off of the info at http://www.javacoffeebreak.com/faq/faq0015.html and the Java API for the Dimension class.
tkiesel gave you a good starting point. Have a look in the Java API documentation on the Toolkit class - you can get the screen dimensions, resolution, and insets, which is enough to calculate all you need.
Height (inches) = height (pixels) * resolution (pixels/inch)
etc.
What tkiesel said works... All you need is the toolkit. Here is simple mock up, for instance:
----------------------
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Dimension;
import java.awt.Toolkit;
/**
* Write a description of class goo here.
*
* @author Takashi
* @version 1
*/
public class goo extends World{
public goo(){
super((int)Toolkit.getDefaultToolkit().getScreenSize().getWidth(),
(int)Toolkit.getDefaultToolkit().getScreenSize().getHeight(),1);
//Debug
System.out.println("Debug: World Dimensiions = (" + getWidth()+","+ getHeight()+")");
}
}
------------------
cheers,
Takashi