Create combo box in Java – Complete Coding
Create combo box in Java – Complete Coding. Here is complete coding of java program. this program contains coding of java program for creation of combo box in java.
How to create combo box in java for integrating him with textbox in java.
complete coding for java combo box connected with textbox. fetch combo box value in textbox through java programming.
import java.awt.;
import javax.swing.;
import java.awt.event.*;
class comboframe extends JFrame implements ItemListener
{
JTextField txt;
Choice ch;
comboframe()
{
super(“kaleem”);
setBounds(100,100,500,500);
setLayout(null);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
dispose();
}
});
ch=new Choice();
ch.setBounds(40,40,200,40);
ch.addItemListener(this);
ch.add(“Red”);
ch.add(“Green”);
ch.add(“Blue”);
ch.add(“Pink”);
ch.add(“Black”);
txt=new JTextField(40);
txt.setBounds(250,40,200,30);
add(ch);
add(txt);
setVisible(true);
}
public void itemStateChanged(ItemEvent ie)
{
if(ie.getSource()==ch)
{
txt.setText(ch.getSelectedItem());
}
}
}
class combo
{
public static void main(String str[])
{
comboframe f=new comboframe();
}
}
Here is also different java and asp.net programs like:
- How to Create combo box in java|Complete Coding
- Java program to calculate Age from Date of birth
- How to create a Recruitment or job announcement page in asp.net | Complete front end designing and backend coding
- How to Add multiple textbox values and showing their sum
- Employee Registration form | Creation of Registration form in visual studio using c# and asp.net
- How add new webpage in a website using C#, asp.net in visual studio.
- How to create login page using asp.net and C#