如何使重繪了的JDialog在Swing? 如果我的JDialog點擊轉換按鈕我需要改變的JDialog的GUI設計,但它沒有發生?他們的任何解決方案?如何在Swing中重繪JDialog?
_convertAction = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
String para = new String();
_task.setBookTypeId(13);
initComponents();
// validate();
// repaint();
setVisible(true);
}
};
我在設置預約類型ID爲13。
if(_task.getBookTypeId()== 1){
String colnames[] = {"Leg","Departure", "Date","Time", "Arrival","Date", "Time","How","Aircraft","PIC","Copilot"};
MyTableModel mytablemodel = new MyTableModel(colnames);
legdetailsTable = new JTable(mytablemodel);
legdetailsTable.setRowSelectionAllowed(true);
}else {
System.out.println("Brokered booking table");
String colnames[] = {"Leg","Departure", "Date","Time", "Arrival","Date", "Time","How"};
MyTableModel mytablemodel = new MyTableModel(colnames);
legdetailsTable = new JTable(mytablemodel);
legdetailsTable.setRowSelectionAllowed(true);
}
使用Id我正在更改initcomponents方法中的組件。
@Jonas如果OP員額[SSCCE] (http://pscode.org/sscce.html),它保證了相關代碼的存在。但是,直到他們解決問題,大多數人*沒有使用重繪,但不知道工作相關的代碼是什麼。* –