Re: ComboBox width before setVisible??



Paulo Filipe schrieb:
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??


See getPreferredWidth.

Bye
Michael
.



Relevant Pages

  • Re: Combobox height
    ... form not the frame. ... wrong scale mode and for everything to go haywire. ... Public Sub SetComboHeight(ByVal Combo As ComboBox, ... L = ScaleX(Combo.Left, Combo.Parent.ScaleMode, vbPixels) ...
    (microsoft.public.vb.general.discussion)
  • Re: api - tracking LostFocus or Exit event of a combobox
    ... I don't have access to the Combobox directly from the Userform; ... window 's class using Spy+, it seems like the combobox doesn't have a window ... assicioted with it (unlike the listbox or a frame). ...
    (microsoft.public.excel.programming)
  • UserForm ComboBox RowSource Problem
    ... On Frame 2 is a ComboBox. ... I am loading this ComboBox with one of 31 named ranges. ... I have a zipped sample which uses only two days not 31. ... TextBoxes changing as they should. ...
    (microsoft.public.excel.programming)
  • Re: api - tracking LostFocus or Exit event of a combobox
    ... I don't have access to the Combobox directly from the Userform; ... window 's class using Spy+, it seems like the combobox doesn't have a window ... assicioted with it (unlike the listbox or a frame). ...
    (microsoft.public.excel.programming)
  • Re: api - tracking LostFocus or Exit event of a combobox
    ... A ComboBox on a UserForm has both an Enter and Exit event. ... window 's class using Spy+, it seems like the combobox doesn't have a window ... assicioted with it (unlike the listbox or a frame). ...
    (microsoft.public.excel.programming)