4个回答
展开全部
用jbuilder试试吧,直接支持拖拽的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
289816836@qq
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-05-03
展开全部
package net.pzw;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Test extends JFrame{
private static final long serialVersionUID = 1L;
JFrame frame=new JFrame();
JPanel panel=new JPanel();
JTextField field1=new JTextField(5);
JTextField field2=new JTextField(5);
JTextField field3=new JTextField(5);
JButton button1=new JButton("+");
JButton button2=new JButton("-");
JButton button3=new JButton("*");
JButton button4=new JButton("/");
public Test() {
panel.add(field1);
panel.add(field2);
panel.add(field3);
panel.add(button1);
panel.add(button2);
panel.add(button3);
panel.add(button4);
frame.add(panel);
frame.setSize(450,80);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
button1.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt){
int x=Integer.parseInt(field1.getText())+Integer.parseInt(field2.getText());
field3.setText(Integer.toString(x));
}
});
button2.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt){
int x=Integer.parseInt(field1.getText())-Integer.parseInt(field2.getText());
field3.setText(Integer.toString(x));
}
});
button3.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt){
int x=Integer.parseInt(field1.getText())*Integer.parseInt(field2.getText());
field3.setText(Integer.toString(x));
}
});
button4.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt){
int x=Integer.parseInt(field1.getText())/Integer.parseInt(field2.getText());
field3.setText(Integer.toString(x));
}
});
}
public static void main(String[] args) {
new Test();
}
}
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Test extends JFrame{
private static final long serialVersionUID = 1L;
JFrame frame=new JFrame();
JPanel panel=new JPanel();
JTextField field1=new JTextField(5);
JTextField field2=new JTextField(5);
JTextField field3=new JTextField(5);
JButton button1=new JButton("+");
JButton button2=new JButton("-");
JButton button3=new JButton("*");
JButton button4=new JButton("/");
public Test() {
panel.add(field1);
panel.add(field2);
panel.add(field3);
panel.add(button1);
panel.add(button2);
panel.add(button3);
panel.add(button4);
frame.add(panel);
frame.setSize(450,80);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
button1.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt){
int x=Integer.parseInt(field1.getText())+Integer.parseInt(field2.getText());
field3.setText(Integer.toString(x));
}
});
button2.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt){
int x=Integer.parseInt(field1.getText())-Integer.parseInt(field2.getText());
field3.setText(Integer.toString(x));
}
});
button3.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt){
int x=Integer.parseInt(field1.getText())*Integer.parseInt(field2.getText());
field3.setText(Integer.toString(x));
}
});
button4.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent evt){
int x=Integer.parseInt(field1.getText())/Integer.parseInt(field2.getText());
field3.setText(Integer.toString(x));
}
});
}
public static void main(String[] args) {
new Test();
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
发我邮箱里吧,我们也是刚学,共同研究一下。326655400@qq.com
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询