急求这段代码的注释public class kuhu extends Applet implements Runnable {private boolean isStandalone = false;JLabel jLabel1 = new JLabel();JTextField jTextField1 = new JTextField();JLabel jLabel2 = new JLabel();JButton jButton1 = new JButton

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 22:13:12
急求这段代码的注释publicclasskuhuextendsAppletimplementsRunnable{privatebooleanisStandalone=false;JLabeljLabe

急求这段代码的注释public class kuhu extends Applet implements Runnable {private boolean isStandalone = false;JLabel jLabel1 = new JLabel();JTextField jTextField1 = new JTextField();JLabel jLabel2 = new JLabel();JButton jButton1 = new JButton
急求这段代码的注释
public class kuhu extends Applet implements Runnable {
private boolean isStandalone = false;
JLabel jLabel1 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel2 = new JLabel();
JButton jButton1 = new JButton();
DataInputStream m_in; //消息输入流
DataOutputStream m_out; //消息输出流
JScrollPane jScrollPane1 = new JScrollPane();
JTextArea jTextArea1 = new JTextArea();
JLabel jLabel3 = new JLabel();
//Get a parameter value
public String getParameter(String key,String def) {
return isStandalone System.getProperty(key,def) :
(getParameter(key) = null getParameter(key) :def);
}

急求这段代码的注释public class kuhu extends Applet implements Runnable {private boolean isStandalone = false;JLabel jLabel1 = new JLabel();JTextField jTextField1 = new JTextField();JLabel jLabel2 = new JLabel();JButton jButton1 = new JButton
package com.test;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
/*
* EventQueue处理机制
*/
public class test extends JFrame implements ActionListener{
//定义所需组件
boolean clicked = false;
final JLabel javaLabel = new JLabel();
//主函数
public static void main(String args[]) {
EventQueue.invokeLater(new Runnable() {
//线程调用函数run()
public void run() {
try {
test frame = new test();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* 初始化JFrame
*/
public test() {
super();
getContentPane().setLayout(null);
setBounds(100,100,341,236);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
javaLabel.setText("JAVA");
javaLabel.setFont(new Font("",Font.PLAIN,22));
javaLabel.setBounds(70,33,198,69);
getContentPane().add(javaLabel);
final JButton boldButton = new JButton();
boldButton.setText("bold");
boldButton.addActionListener(this);
boldButton.setBounds(28,132,106,28);
getContentPane().add(boldButton);
final JButton italicButton = new JButton();
italicButton.setText("italic");
italicButton.addActionListener(this);
italicButton.setBounds(185,132,106,28);
getContentPane().add(italicButton);
}
//响应函数的重写
@Override
public void actionPerformed(ActionEvent e) {
// 当点击的键值为bold
if(e.getActionCommand().equals("bold")){
if(clicked == false){
clicked = true;
javaLabel.setFont(new Font("",Font.BOLD,22));
}
else{
javaLabel.setFont(new Font("",Font.BOLD | Font.ITALIC,22));
}
}
//当点击的键值为italic
if(e.getActionCommand().equals("italic")){
if(clicked == false){
clicked = true;;
javaLabel.setFont(new Font("",Font.ITALIC,22));
}
else{
javaLabel.setFont(new Font("",Font.BOLD | Font.ITALIC,22));
}
}
}
}