You could have a look at Full-Screen Exclusive Mode API. This will give your program full access to the whole screen, removing any need for you to be concerned about task/dock bars and the like
Or you could do something like
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
Rectangle bounds = gd.getDefaultConfiguration().getBounds();
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gd.getDefaultConfiguration());
Rectangle safeBounds = new Rectangle(bounds);
safeBounds.x += insets.left;
safeBounds.y += insets.top;
safeBounds.width -= (insets.left + insets.right);
safeBounds.height -= (insets.top + insets.bottom);
Essentially all this does is gets the screen bounds (x/y and width/height), the screens insets for the device and updates the screen bounds to take into consideration things like the task bar and other system resources.
You could also simply try using something like Frame#setExtendedState
which will allow you to put the window into Frame.MAXIMIZED_BOTH
and let it do the work for you