Ok, I need to be able to get the current size of a component. I have attempted to use the component's getWidth() method, getHeight() method, getSize() method, and the getPreferredSize() method but they all return 0 or dimensions that have a height and width of 0 (depending on the method).
My components have not been given a specific size by me, they should be getting their size based on what they contain or specifications on construction. For example, the size of a JLabel is the length of the String given to it. The size of a JTextField is the number of columns given to. The size of a JButton is the length of the String given to it. And those sorts of things.
I believe that because of this setup, I am getting 0 because I have not explicitly set a size or a preferred size. And for what I am doing, I shouldnt be sending it a size or a preferred size anyway.
As well as getting the sizes of normal components, I want to be able to get the size of a JPanel when I send it one. I havent managed to get that to work either.
Is anyone able to send me in the correct direction?