Skip to content

Commit

Permalink
java-practice-pushed
Browse files Browse the repository at this point in the history
  • Loading branch information
rajjitlai committed Nov 21, 2024
1 parent 2e5c052 commit d38c943
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Binary file added Java/practice/AWTCheckboxExample.class
Binary file not shown.
Binary file added Java/practice/CheckboxExample2$1.class
Binary file not shown.
Binary file added Java/practice/CheckboxExample2$2.class
Binary file not shown.
Binary file added Java/practice/CheckboxExample2.class
Binary file not shown.
16 changes: 8 additions & 8 deletions Java/practice/CheckboxExample2.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import java.awt.*;
import java.awt.event.*;

public class CheckboxExample2{
CheckboxExample2(){
public class CheckboxExample2 {
CheckboxExample2() {
Frame f = new Frame("Checkbox example");
final Label label = new Label();

Expand All @@ -17,22 +17,22 @@ public class CheckboxExample2{
f.add(label);

checkbox1.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e){
public void itemStateChanged(ItemEvent e) {
label.setText("C++ Checkbox: " + (e.getStateChange() == 1 ? "checked" : "unchecked"));
}
})
});
checkbox2.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e){
public void itemStateChanged(ItemEvent e) {
label.setText("Java Checkbox: " + (e.getStateChange() == 1 ? "checked" : "unchecked"));
}
})
});

f.setSize(400,400);
f.setSize(400, 400);
f.setLayout(null);
f.setVisible(true);
}

public static void main(String args[]){
public static void main(String args[]) {
new CheckboxExample2();
}
}

0 comments on commit d38c943

Please sign in to comment.