Reputation: 777
I am trying to build a Swing application that shows a login panel as a glasspane if no user is loggeg in. If i try to hide to login glass pane it remains visible, but won't react to any user interactions.
Do you see any problems here?
public class HauptFrame implements SessionListener {
private static final long serialVersionUID = 7985854311368619704L;
public HauptFrame() {
initialize();
}
public void initialize() {
Session.get().addSessionListener(this);
setSize(1024, 768);
setVisible(true);
startAndCheck();
}
public void startAndCheck() {
if (!DatabaseManager.doesConfigExist()) {
setNewGlassPane(new SetupGlassPanel(this));
}
else if (new UserDAO().getAllUser().size() == 0) {
setNewGlassPane(new FirstUserGlassPane(this));
}
else if (Session.get().getUser() == null) {
setNewGlassPane(new LoginGlassPanel());
} else {
setNewGlassPane(null);
}
}
public void setNewGlassPane(JPanel glassPane) {
if (glassPane != null) {
getGlassPane().setVisible(false);
setGlassPane(glassPane);
getGlassPane().setVisible(true);
}
else {
if (getGlassPane().isVisible()) {
getGlassPane().setVisible(false);
}
}
}
@Override
public void userSignedIn(User user) {
removeAll();
startAndCheck();
}
@Override
public void userSignedOff() {
startAndCheck();
}
Upvotes: 0
Views: 378
Reputation: 109823
Do you see any problems here?
Upvotes: 1