Toolkit toolKit = Toolkit.getDefaultToolkit(); Dimension dimension = toolKit.getScreenSize(); int screenWidth = dimension.width; int imgWith = screenWidth;