📄 sandy.java
字号:
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class Sandy extends JFrame implements ItemListener,ActionListener{
JPanel p1=new JPanel();
JPanel p2=new JPanel();
JPanel p3=new JPanel();
JPanel p=new JPanel();
JLabel lb1=new JLabel("");
JLabel lb2=new JLabel("感谢参与");
JLabel lb3=new JLabel("希望方向?");
JCheckBox ch1=new JCheckBox(".NET");
JCheckBox ch2=new JCheckBox(".JAVA EE");
public Sandy(){
super("IT调研");
setSize(400,250);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
p1.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
p1.add(lb3);
p1.add(ch1);
p1.add(ch2);
p2.setLayout(new FlowLayout());
p2.add(lb2);
p3.setLayout(new FlowLayout());
p3.add(lb1);
//ch1.addItemListener(this);
//ch2.addItemListener(this);
ch1.addActionListener(this);
ch2.addActionListener(this);
p.setLayout(new BorderLayout());
p.add("North",p1);
p.add("South",p2);
p.add("Center",p3);
setContentPane(p);
}
public void actionPerformed(ActionEvent e)
{
lb1.setText("");
if(ch1.isSelected()==true)
{
lb1.setText("您希望从事.NET 平台的开发!");
}
if(ch2.isSelected()==true)
{
lb1.setText("您希望从事JAVA平台的开发!");
}
if(ch1.isSelected()==true&&ch2.isSelected()==true){
lb1.setText("您希望从事.NET和JAVA 平台的开发!");
}
}
public void itemStateChanged(ItemEvent e){
lb1.setText("");
if(ch1.isSelected()==true)
{
lb1.setText("您希望从事.NET 平台的开发!");
}
if(ch2.isSelected()==true)
{
lb1.setText("您希望从事JAVA平台的开发!");
}
if(ch1.isSelected()==true&&ch2.isSelected()==true){
lb1.setText("您希望从事.NET和JAVA 平台的开发!");
}
}
public static void main(String[]args){
Sandy s=new Sandy();
s.show();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -