锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
鍚庢潵鎯沖湪JAVA涓簲璇ヤ篃鍙互鐨?浠婂ぉ涓婂崍灝卞姩鎵嬭瘯浜嗕竴涓?
鍦ㄧ獥浣撲笅鏈変釜闈㈡澘錛?br>1銆佷竴涓猙utton
2銆佷竴涓猵ane錛宲ane涓湁鍑犱釜buttton
3銆佺敤button浜嬩歡鐩戝惉錛屽垵濮媝ane鍙璁句負 false.榪欓噷鐢ㄤ簡涓涓妧宸э紝鍋氳繃JAVA鍚庨潰涓婃満鐨勮綆楀櫒緇冧範灝辮兘鏄庣櫧銆備唬鐮佸涓嬶細
}
}
}
if (s == 0) {
JOptionPane.showMessageDialog(null, "浣犵偣鐨勬槸紜畾錛?);
}
if (s == 1) {
JOptionPane.showMessageDialog(null, "浣犵偣鐨勬槸鍚︼紒");
}
if (s == 2) {
JOptionPane.showMessageDialog(null, "浣犵偣鐨勬槸鍙栨秷錛?);
}
鏃ユ湡鏍煎紡鍖?br>//鑾峰彇褰撳墠緋葷粺鏃ユ湡鍜屾椂闂寸殑鏂規硶
import java.text.SimpleDateFormat;
import java.util.Date;
public class TestDate {
public static void main(String[] args) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //鏍煎紡涓虹壒鏈夌殑,API鏂囨。涓湁
SimpleDateFormat sdf = new SimpleDateFormat("yyyy騫碝M鏈坉d鏃?HH:mm:ss");//
Date d = new Date();
System.out.println(sdf.format(d));
}
}
/**
* 鏌ョ湅API鏂囨。
java.text
Class SimpleDateFormat
java.lang.Object
java.text.Format
java.text.DateFormat
java.text.SimpleDateFormat
*/
ByteSizeException() {
System.out.println("\n瓚呭嚭瀛楄妭鑼冨洿鐨勬暟瀛?);
}
}
public class TestException {
protected TestException() {
}
public static void main(String args[]) throws ByteSizeException{ //鍙互涓嶅啓
try {
int num = Integer.parseInt(args[0]);
if (num <= 127 && num >= -128 ) {
System.out.println("\n瀛楄妭鍊?"+num);
}
else {
throw new ByteSizeException();
}
} catch (Exception e) {
System.out.println("浣犺緭鍏ョ殑涓嶆槸鏁板瓧");
}
}
}
try{
……
}
catch(寮傚父綾誨悕 瀵硅薄鍚?{
……
}
catch(寮傚父綾誨悕 瀵硅薄鍚?{
……
} finally{
……
}
JTable | |
JTree | |
JList | |
JToolTip | |
JComboBox | |
JMenu | |
JTabbedPane | |
Border | |
JSlider |