Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Replacing a JTextField by a JComboBox

  Asked By: Leon    Date: Nov 15    Category: Java    Views: 1061
  

I want to replace a JTextField by a JComboBox in a JPanel when some
button is clicked. I tried using a JComponent object common to both
the JTextField and the JComboBox like this:

JComponent jtfOrJcb = null;

jtfOrJcb = new JTextField("...");

...When handling an event...

jtfOrJcb = new JComboBox(...);

but that didn't work. I tried repaint() for all panels but the
JTextField just remained there i.e. wasn't replaced by JComboBox.

Did anyone encounter the same problem.

If anyone knows what to do or has a clue on what's goin on then
please tell me.

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Replacing a JTextField by a JComboBox Or get search suggestion and latest updates.




Tagged: