Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JComboBox in panel

 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have comboBox in my panel.
and i want it to be display as normal as below:



but, after i run it, i got this :



the box of scrolling down is missing, still it can scroll down to select item.
I just want the box appear in normal display.

my code is fine rite?
here is it is:


so where is it wrong?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
works OK for me.

post a working sample program, which displays the problem.
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the sample after i run it:


i separate the panel and frame as different class.

here is my panel class:
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got this in my frame class:


when i change it to "com.sun.java.swing.plaf.motif.MotifLookAndFeel", it works on that.
how come metallookandfeel not displaying well?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shows up normally on my PC
winxp pro sp2, java 1.5.0_05

if you are using a different os, search sun's bug database, keywords
[os name] JComboBox Arrow ArrowButton
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
winxp home sp2, java 1.5.0_05
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"javax.swing.plaf.metal.MetalLookAndFeel"

also works OK (default for 1.5??)
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
weird, the only diff is home vs pro, which, to me, shouldn't make a difference

here's your code stripped down to just the combobox and separators, which
runs OK on my pc

run on yours, see if it still shows incorrectly

 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
your code runs ok.
so something wrong with my separator?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the separators are OK - I left them in only for 'dressing'

must be something else in your code, something you haven't posted.

as mentioned earlier, post something that we can copy/paste/compile/run and
see the problem.

unfortunately I'm off to work now, so I won't be able to check back for a while.
someone else might be able to isolate the problem.
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok. thanks for your posts.
now i will included all my coding needed :




[ October 16, 2006: Message edited by: Nicky Eng ]
[ October 16, 2006: Message edited by: Nicky Eng ]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
swap these

th.setVisible(true);
th.addCustPanel();

to

th.addCustPanel();
th.setVisible(true);
 
Nicky Eng
Ranch Hand
Posts: 378
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
works now.
REALLY thank you for spending time on my problem.
thanks alot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic