if (o instanceof ClientModel) {
ClientModel c = (ClientModel) o;
currentPane = new NetworkTankView(this, 1, c);
}
if (o instanceof HostModel) {
HostModel c = (HostModel) o;
currentPane = new NetworkTankView(this, 0, c);
}
System.out.println("changeview with o:" + o);
body.removeAll();
body.add(currentPane, "NETWORKTANKVIEW");
CardLayout c1 = (CardLayout) body.getLayout();
c1.show(body, "NETWORKTANKVIEW");
for (Component co : body.getComponents()) {
if (co == currentPane) {
currentPane.requestFocusInWindow();
}
}
this.setBackground(Color.black);
this.setSize(1180, 750);
this.setLocationRelativeTo(null);
// this.setExtendedState(this.MAXIMIZED_BOTH);
break;
case LAN:
this.setBackground(Color.white);
previousPane = currentPane;
currentPane = new LanView(this);
body.removeAll();
body.add(currentPane, "LAN");
this.setLocationRelativeTo(null);
this.setSize(650, 400);
break;
case PREVIOUS:
JPanel temp = previousPane;
previousPane = currentPane;
currentPane = temp;
if (currentPane instanceof LanView)
changeView(Views.LAN, null);
if (currentPane instanceof TitleView)
changeView(Views.TITLE, null);
if (currentPane instanceof TankView)
changeView(Views.TANKVIEW, null);
body.removeAll();
body.add(currentPane, v.name());
if (currentPane instanceof TitleView) {
this.setLocation(50, 50);
this.setSize(640, 600);
}
repaint();
break;
case TANKVIEW:
if (currentLevel == 1) {
currentPane = new TankView(this, new Level1());
}
if (currentLevel == 2) {
currentPane = new TankView(this, new Level2());
}
if (currentLevel == 3) {
currentPane = new TankView(this, new Level3());
}
if (currentLevel == 4) {
currentPane = new TankView(this, new Level4());
}
if (currentLevel == 5) {
currentPane = new TankView(this, new Level5());
}
body.add(currentPane, "TANKVIEW");
CardLayout c = (CardLayout) body.getLayout();
c.show(body, "TANKVIEW");
for (Component co : body.getComponents()) {
if (co == currentPane) {
currentPane.requestFocusInWindow();
}
}