Its working, but the contents of the JComboBox are partially visible, is there any way to display the whole content... I mean JComboBox width is fixed but its content should expand w.r.t contents length
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
comboBox.setPrototypeDisplayValue(widestItem);
Abhishek Reddy
Ranch Hand
Joined: Mar 28, 2006
Posts: 259
posted
0
thanks for the reply...i have done this way comboBox.setPreferredSize(new Dimension(10,20)) comboBox.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
but still the content is not visible completely..
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32654
4
posted
0
Preferred size 10, 20? You are lucky to see the combo box at all when it's that small!
Abhishek Reddy
Ranch Hand
Joined: Mar 28, 2006
Posts: 259
posted
0
leave the size..... let me know, whether it is possible to display the entire content or not
Originally posted by Abhishek Reddy: leave the size..... let me know, whether it is possible to display the entire content or not
Abhiskek,
I don't think that was really nice on your part. I understand, you might be rushed to get this thing done, or frustrated at not getting it right on your own, inspite of numerous attempts; all of us have been through that phase.
However, you need to remember, statements like these, might make people think twice before helping you out in the future. You need to be careful about such things buddy
iam sorry for that .... thanks for the reply...............
here is the sample code
look for the codes inside //---------------------------//
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
your problem is probably GroupLayout (which I don't use, and can't compile your code to confirm)
here's your code, stripped of all unnecessary stuff, leaving the frame as a default Borderlayout.
I've added another combobox (no prototype display), just for comparison, and added a few extra XXX's to make it stand out
compile/run the code, note the differing widths, then comment out the setPrototypeDisplayValue line, recompile/rerun and you'll notice the 'aaaaaa...' item fully displayed, so it does appear GroupLayout is causing all your problems
Abhishek Reddy
Ranch Hand
Joined: Mar 28, 2006
Posts: 259
posted
0
thanks...for the reply i have understood the usage of setPrototypeDisplayValue(prototypeValue);
But i want to display the JComboBox in the following way