I would like to get the effective screen size. That is: the size of the screen without the taskbar (or the equivalent on Linux/Mac).
I am currently using...
GraphicsEnvironment has a method which returns the maximum available size, accounting all taskbars etc. no matter where they are aligned:
GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds()
Note: On multi-monitor systems, getMaximumWindowBounds() returns the bounds of the entire display area. To get the usable bounds of a single display, use GraphicsConfiguration.getBounds() and Toolkit.getScreenInsets() as shown in other answers.