I want to dispose()
my current jFrame
and move to the next jFrame(StudentProfilepage()).But it shows error at this.dispose()
.
How can i do that.Here i used MouseListner
a jLabel l1
My code as follows
l1.setCursor(Cursor.getDefaultCursor());
l1.addMouseListener(new MouseAdapter() {
@Override
public void mouseReleased(MouseEvent e) {
//added check for MouseEvent.BUTTON1 which is left click
if (e.isPopupTrigger() || e.getButton() == MouseEvent.BUTTON1) {
this.dispose(); //error here(i want to close my current frame and move to StudentProfile() page
new StudentProfilePage().setVisible(true);
}
}
});