I'm trying to switch into windows and "closing" the last window. But, I want to have a shortcut (Ctrl+I) to open a new window, and if I put the setVisible(false)
at the ActionPerformed of the (Ctrl+I), it gives me an error.
How can I hide the last window?
Error says:
create method setVisible(boolean) in
<anonymous javax.swing.AbstractAction>
Here's the code:
jBNew.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_I, InputEvent.CTRL_DOWN_MASK), "new");
jBNew.getActionMap().put("new", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
this.setVisible(false);(here i have the error)****
new NextOrderWindow(codLastOrder()).setVisible(true);
}
});