ComboBox width before setVisible??



HI

I'm using a comboBox and need to know his size before i set the frame
visible, i did more or less this code:

JFrame frame = new Frame();
.............
JComboBox combo = new JComboBox( {"small text","a more long text"} );
combo.setSelectedIndex(0);
............
int x = combo.getWidth(); // x is 0 here.
frame.setVisible();
int y = combo.getWidth(); // y is the size of the comboBox with the
option "a more long text"

But i want to know his width before to resize a panel.
Anyone knows how can i do it??

.



Relevant Pages

  • Re: Frame mit Panelwechsel
    ... Ich habe ein JFrame frame. ... In diesem JFrame, gibt es ein Panel panelStd. ...
    (de.comp.lang.java)
  • Re: Frame mit Panelwechsel
    ... Ich habe ein JFrame frame. ... In diesem JFrame, gibt es ein Panel panelStd. ...
    (de.comp.lang.java)
  • Frame mit Panelwechsel
    ... Ich habe ein JFrame frame. ... In diesem JFrame, gibt es ein Panel panelStd. ...
    (de.comp.lang.java)