How to implements Item Listener in java Frams
How to implements Item Listener in java Frams. Here you will learn that how can we implement implements Item Listener in java Frams using AWT classes. Here is a complete java program that will show you that how we can apply ItemListener in java.
You can say that this complied java program will teach you that how you can create a frame or window in java that is looking like you are are creating a paint window.
Its means that you are developing a program to create a paint programe after some changing.

import java.awt.event.*;
import java.awt.*;
class myframe extends Frame implements ItemListener
{
Checkbox redchk,greenchk;
CheckboxGroup grp;
TextField txt;
myframe()
{
super(“Show the selected”);
setBounds(100,100,500,500);
setBackground(new Color(245,25,25));
setLayout(null);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
grp=new CheckboxGroup();
redchk=new Checkbox(“red”,grp,true);
redchk.setBounds(40,100,100,25);
redchk.addItemListener(this);
greenchk=new Checkbox(“green”,grp,false);
greenchk.setBounds(40,150,100,25);
greenchk.addItemListener(this);
txt=new TextField(30);
txt.setBounds(40,190,200,30);
setLayout(null);
add(redchk);
add(greenchk);
add(txt);
setVisible(true);
}
public void itemStateChanged(ItemEvent ie)
{
if (ie.getSource()==redchk)
{
txt.setText(“Red Selected (By Kaleem)”);
}
if(ie.getSource()==greenchk)
{
txt.setText(“Green Selected(By Kaleem)”);
}
}
}
class sajjad
{
public static void main(String str[])
{
myframe f=new myframe();
}
}
Here is also different java and asp.net programs like:
- How to connect java with database|Using JDBC-ODBC Connection string
- 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#
You are doing a great job by sharing complied programs of java.
thanks
Thanks Dear we will try to our best to provide you updated solution of Java, Asp.Net ,Php and as well as Oracle and SQL databases