You can get the width and height of a component using the getWidth() and getHeight() methods, or alternatively call the getSize() method to get a dimension object containing the width and height.
...