code: static public Rectangle getScreenWorkingArea(Window windowOrNull) {
          Insets insets;
          Rectangle bounds;
          if (windowOrNull == null) {
              GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
              insets = Toolkit.getDefaultToolkit().getScreenInsets(ge.getDefaultScreenDevice()
                  .getDefaultConfiguration());
              bounds = ge.getDefaultScreenDevice().getDefaultConfiguration().getBounds();
          } else {
              GraphicsConfiguration gc = windowOrNull.getGraphicsConfiguration();
              insets = windowOrNull.getToolkit().getScreenInsets(gc);
              bounds = gc.getBounds();
          }
          bounds.x += insets.left;
          bounds.y += insets.top;
          bounds.width -= (insets.left + insets.right);
          bounds.height -= (insets.top + insets.bottom);
          return bounds;
      }
docs: getScreenWorkingArea, This returns the working area of the screen. (The working area excludes
  any task bars.) This function accounts for multi-monitor setups. If a window is supplied,
  then the the monitor that contains the window will be used. If a window is not supplied, then
  the primary monitor will be used.