📄 clothesinandoutcountdialogtreeaction.java
字号:
package view.control.viewaction;
import java.awt.CardLayout;
import javax.swing.JPanel;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import view.dialog.countmanage.ClothesInAndOutCountDialog;
public class ClothesInAndOutCountDialogTreeAction implements TreeSelectionListener {
private ClothesInAndOutCountDialog dialog;
public ClothesInAndOutCountDialogTreeAction() {
}
public ClothesInAndOutCountDialogTreeAction(ClothesInAndOutCountDialog dialog) {
this.dialog = dialog;
}
public void setDialog(ClothesInAndOutCountDialog dialog){
this.dialog = dialog;
}
public void valueChanged(TreeSelectionEvent e) {
// 获得选中的节点
DefaultMutableTreeNode node = (DefaultMutableTreeNode) dialog.getJTree()
.getLastSelectedPathComponent();
// 获得选中的节点的字符串内容
String nodeStr = node.getUserObject().toString();
if (node.isLeaf()) {
JPanel panel = dialog.buildInfoPanel();
CardLayout cl = dialog.getCardLayout();
if (nodeStr.equals("收衣取衣记录")) {
cl.show(panel, "1");
} else if (nodeStr.equals("收衣数量金额统计")) {
cl.show(panel, "2");
} else if (nodeStr.equals("索赔衣物记录")) {
cl.show(panel, "3");
} else if (nodeStr.equals("返回重洗记录")) {
cl.show(panel, "4");
} else if (nodeStr.equals("过期未取走衣物")) {
cl.show(panel, "5");
}
panel.revalidate();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -