我用了一个jSplitPane,左边是导航面板,有按钮,右边是空的面板,我想点击左边的导航按钮,右边就显示响应的面板窗口,可是,我使用一下事件响应却运行出错。
private void goodsButtonActionPerformed(java.awt.event.ActionEvent evt) {
repaint();
if(goodsButton==evt.getSource()){
mainPanel.add(spdialog);
}
}
请问是否应该这样写?
spdialog是一个jDialog,mainPanel就是右边那个空面板。
请问我可不可以当一个左边导航按钮事件,响应成往右边的空面板中加载一个面板?我想在右边实现panel加载,当点击左边的按钮时,同时关闭前一个页面
private void goodsButtonActionPerformed(java.awt.event.ActionEvent evt) {
repaint();
if(goodsButton==evt.getSource()){
mainPanel.add(spdialog);
}
}
请问是否应该这样写?
spdialog是一个jDialog,mainPanel就是右边那个空面板。
请问我可不可以当一个左边导航按钮事件,响应成往右边的空面板中加载一个面板?我想在右边实现panel加载,当点击左边的按钮时,同时关闭前一个页面
A CardLayout object is a layout manager for a container. It treats each component in the container as a card. Only one card is visible at a time, and the container acts as a stack of cards. The first component added to a CardLayout object is the visible component when the container is first displayed