Can I get the right JComponent size before it's shown?
问题 When is the size of the JComponent is calculated? After being shown in the screen or before that? if I send .getSize() message before .setVisible(true) , would it give me the right answer? Thanks 回答1: I sometimes check the sizes of my components when debugging to find out why I can't see them for instance. In most cases, the sizes will be realized when the GUI has been rendered . This can occur when pack() or setVisible(true) has called on the top-level window. My usual sequence of method