14:50
0
Here is the code of program:
//Làm tròn số
DecimalFormat df=new DecimalFormat("0"); // Định dạng cho số thập phân của bạn
df.setRoundingMode(RoundingMode.UP); // Làm tròn lên, ngoài ra còn rất nhiều mode cho bạn chọn, check java doc nhé 
System.out.println("Tong luong = " + df.format(tongluong));

//Vị trí xuất hiện của JFrame
setLocationRelativeTo(null);//Giữa màn hình
this.setLocation(100, 100);// Vị trí trái trên cùng là x = 100, y = 100

//Sử dụng Date trong java
List lst = new ArrayList();
SimpleDateFormat fm=new SimpleDateFormat("dd-MM-yyyy");
lst.add(new NhanVienSanXuat(150, "A",fm.parse("01-01-1992"),"abced"));


Date date = new Date();
String strDateFormat = "dd/MM/yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(strDateFormat);
System.out.println("Hôm nay là ngày : " + simpleDateFormat.format(date));

//KeyEvent
String str = "Key released: " + event.getKeyText(event.getKeyCode());

evt.getKeyCode() == KeyEvent.VK_ENTER
//JTable
jTable1.getColumnModel().getColumn(0).setPreferred Width(300);

getColumn(0) <-- trỏ đến cột có index = 0
setPreferredWidth(300) <-- set độ rộng = 300

0 nhận xét:

Đăng nhận xét