I want to get the height and width of my JFrame so that a graphic should be at the same relative position even if the window is resized. To do this, I am trying to get the height and width in my constructor, but it always returns 0. What is the best way to do this?
public class FireworkComponent extends JComponent {
public FireworkComponent() {
//some variables ....
this.getHeight();
this.getWidth();
}
}