java中的比较大小的代码
package aaa;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* <p>Title: 条件语句</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2006</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
public class aaaFrame1 extends JFrame {
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
JTextField jTextField1 = new JTextField();
//Construct the frame
public aaaFrame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
double d1=36.2;
double d2=58.4;
if(d2>=d1)
jTextField1.setText(d2+">="+d1);
else
jTextField1.setText(d1+">="+d2);
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("Frame Title");
contentPane.add(jTextField1, BorderLayout.NORTH);
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
}