I had design a JFrame
with some components. In that JCheckBox
component I had given a name but the full name is not displayed when I run the application. I want display the given name.
Code
public class FindDemo extends JFrame
{
Label l1;
JCheckBox matchCase,MatchWholeWords;
TextField tf;
JButton find_next,cancel;
public FindDemo()
{
l1 = new Label("Find What: ");
matchCase=new JCheckBox();
matchCase.setText("Match Case ");
MatchWholeWords=new JCheckBox("Match Whole Words ");
tf = new TextField(30);
find_next = new JButton("Find Next");
cancel = new JButton("Cancel");
setLayout(null);
int label_w = 80;
int label_h = 20;
int tf_w = 120;
l1.setBounds(10,10, label_w, label_h);
add(l1);
tf.setBounds(10+label_w, 10, tf_w, 20);
add(tf);
matchCase.setBounds(10, 10+label_h+10, label_w, label_h);
add(matchCase);
MatchWholeWords.setBounds(10, 10+label_h+35, label_w, label_h);
add(MatchWholeWords);
find_next.setBounds(250, 10, 100, 20);
add(find_next);
cancel.setBounds(250, 40, 100, 20);
add(cancel);
int w = 400;
int h = 200;
setSize(w,h);
Point center = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
setLocation(center.x-w/2, center.y-h/2);
setVisible(true);
}
public static void main(String args[]){
new FindDemo();
}
}