Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Last edited by sundeep; June 25th, 2013 at 09:41 PM. Reason: More complex
It might be a good idea to post a small, compilable, example which illustrates the problem. (for instance you don't need the list cell renderer unless it contributes to the problem). And say what it means for the combobox to not be displayed "properly".
Thank you for your reply!!..
My problem is JComboBox is not working as i required, like i need to select some data and it should be focus on that list.
JComboBox domainNamesBox = new JComboBox();
domainNamesBox.setModel(new DefaultComboBoxModel(new String[] {"a", "b", "c", "d"}));
//Arrange the above GUI components to GroupLayout...
GroupLayout gl_contentPane = new GroupLayout(contentPane);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.TRAIL ING)
.addGroup(gl_contentPane.createSequentialGroup()
.addContainerGap()
.addGroup(gl_contentPane.createParallelGroup(Align ment.TRAILING, false)
.addComponent(lblDomainName, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18)
.addGroup(gl_contentPane.createParallelGroup(Align ment.LEADING)
.addComponent(domainNamesBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
.addGap(41))))
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.TRAIL ING)
.addGroup(gl_contentPane.createSequentialGroup()
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(gl_contentPane.createParallelGroup(Align ment.TRAILING)
.addComponent(domainNamesBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addComponent(lblDomainName))
.addPreferredGap(ComponentPlacement.RELATED)
.addContainerGap())
);
PFA enclosed on following thread :-)
we have to use method for comboBox.updateUI(). it will work as it is.
If you are still having problems with this consider my suggestion of posting a SSCCE and a description of what the problem is: ie how the output or other behaviour of the program differs from your intentions.
It's not my (vain) intention to tell you how to post. But, for my part, I need code, not images. And some elaboration about what "not displaying properly" means.