D
David Cogen
Hi, this seems like a "chicken and egg" problem, but I am sure there is a way to
do this:
In order to compute the height of a JPanel I want to instantiate I need to know
the height of a line of text, which I could do using
JPanel.getGraphics().getFontMetrics().getHeight().
But that doesn't work until I call JPanel.setVisible() (null pointer exception).
But before I can make it visible I need to know its size!
Any suggestions?
do this:
In order to compute the height of a JPanel I want to instantiate I need to know
the height of a line of text, which I could do using
JPanel.getGraphics().getFontMetrics().getHeight().
But that doesn't work until I call JPanel.setVisible() (null pointer exception).
But before I can make it visible I need to know its size!
Any suggestions?