【Java开源代码栏目提醒】:网学会员鉴于大家对Java开源代码十分关注,论文会员在此为大家搜集整理了“ko22_1.java”一文,供大家参考学习
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ko22_1 extends JApplet implements ActionListener
{
Container ctp=getContentPane();
ImageIcon icon1=new ImageIcon("ko22_1a.gif"),
icon2=new ImageIcon("ko22_1b.gif"),
icon3=new ImageIcon("ko22_1c.gif"),
icon4=new ImageIcon("ko22_1d.gif");
JLabel lb1=new JLabel("块材计:",icon1,JLabel.CENTER),
lb2=new JLabel("块材计:",icon2,JLabel.CENTER),
lb3=new JLabel("縩:",icon3,JLabel.CENTER);
JTextField tf1=new JTextField(8),
tf2=new JTextField(8),
tf3=new JTextField(15);
JButton bt=new JButton(icon4);
public void init()
{
ctp.setLayout(new FlowLayout());
ctp.add(lb1);
ctp.add(tf1);
ctp.add(lb2);
ctp.add(tf2);
ctp.add(lb3);
ctp.add(tf3);
ctp.add(bt);
bt.setRolloverIcon(icon1);
bt.setPressedIcon(icon2);
bt.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
int x,y,z;
x=Integer.parseInt(tf1.getText());
y=Integer.parseInt(tf2.getText());
z=x*y;
tf3.setText(String.valueOf(z));
}
}
上一篇:
ko21_6.java
下一篇:
最新参考文献中的标点符号