int (int width, int height) { if (myBaselineComponent == null) { myBaselineComponent = new JLabel(); myBaselineComponent.setFont(getFont()); } myBaselineComponent.setText(getText()); Dimension size = myBaselineComponent.getPreferredSize(); return myBaselineComponent.getBaseline(size.width, size.height); }