public GeneralPanel() { // SET THE POSITION IN THE SCREEN OF EVERY COMPONENT IN THE LAYERED PANE this.setFocusable(true); this.setBounds(0, 0, m.programWidth, m.programHeight); designer.setBounds(0, 0, m.programWidth, m.programHeight); designer.setOpaque(true); timePanel.setBounds(15, 10, timePanel.width, timePanel.height); timePanel.setOpaque(true); zoomPanel.setBounds(15, 25 + timePanel.height, zoomPanel.width, zoomPanel.height); zoomPanel.setOpaque(true); spaceshipPanel.setBounds(m.programWidth / 2 - 506 / 2, m.programHeight - 300, 506, 275); spaceshipPanel.setOpaque(true); corpPanel.setBounds( m.programWidth - (10 + corpPanel.width), 10, corpPanel.width, corpPanel.height); corpPanel.setOpaque(true); solarSystemMenu.setBounds( 10, 50 + timePanel.height + zoomPanel.height, solarSystemMenu.width + 10, solarSystemMenu.height); solarSystemMenu.setOpaque(true); selecPanel.setBounds( m.programWidth / 2 - selecPanel.width / 2, m.programHeight / 2 - selecPanel.height / 2, selecPanel.width, selecPanel.height); selecPanel.setOpaque(true); selecPanel.setVisible(false); spaceshipFactoryPanel.setBounds( m.programWidth / 2 - 418 / 2, m.programHeight / 2 - 436 / 2, 418, 436); spaceshipFactoryPanel.setOpaque(true); // DISPLAY SATELLITE MENU for (SolarSystemMenu ssm : solarSystemSatelliteMenu) { if ((60 + timePanel.height + zoomPanel.height + solarSystemMenu.height + ssm.height) > m.programHeight) ssm.setBounds( 10 + solarSystemMenu.width, 60 + timePanel.height + zoomPanel.height, solarSystemMenu.width + ssm.width + 10, ssm.height); else ssm.setBounds( 10, 60 + timePanel.height + zoomPanel.height + solarSystemMenu.height, ssm.width + 10, ssm.height); ssm.setOpaque(true); } displayLayer(); }
public void refreshLayer() { // CORP PANEL REFRESH if ((m.cameraXTranslation < 100) && (m.cameraYTranslation < 100) && (m.cameraXTranslation > -100) && (m.cameraYTranslation > -100) && (!m.freeViewMode)) { if (!containCorpPanel) { corpPanel.setVisible(true); containCorpPanel = true; } } else { corpPanel.setVisible(false); containCorpPanel = false; } // BOUNDS OF THE TITLE titleJLabel.setBounds( m.programWidth / 2 - titleJLabel.getText().length() * 12, 30, m.programWidth / 2, 100); if (displayTitle) titleJLabel.setVisible(true); else titleJLabel.setVisible(false); // SATELLITE MENU REFRESH DEPENDING ON THE CORP SELECTED for (SolarSystemMenu ssm : solarSystemSatelliteMenu) { if ((ssm.relatedPlanetMenu != null) && (m.selectedCorp.equals(ssm.relatedPlanetMenu))) { ssm.setVisible(true); addCorpButton.setBounds( 10, 60 + timePanel.height + zoomPanel.height + solarSystemMenu.height + ssm.height + 10, 100, 20); resetButton.setBounds( 10, 60 + timePanel.height + zoomPanel.height + solarSystemMenu.height + ssm.height + 40, 100, 20); } else { // IF THE SELECTED CORP IS A SATELLITE THEN PUT THE PLANET MENU RELATED if (m.selectedCorp.type == 4) { Satellite s = (Satellite) m.selectedCorp; if (s.relatedPlanet.equals(ssm.relatedPlanetMenu)) { ssm.setVisible(true); addCorpButton.setBounds( 10, 60 + timePanel.height + zoomPanel.height + solarSystemMenu.height + ssm.height + 10, 100, 20); resetButton.setBounds( 10, 60 + timePanel.height + zoomPanel.height + solarSystemMenu.height + ssm.height + 40, 100, 20); } } else { ssm.setVisible(false); if (m.selectedCorp.type == 1) { if (((Planet) m.selectedCorp).satelliteOfThisPlanet.size() == 0) { addCorpButton.setBounds( 10, 60 + timePanel.height + zoomPanel.height + solarSystemMenu.height, 100, 20); resetButton.setBounds( 10, 90 + timePanel.height + zoomPanel.height + solarSystemMenu.height, 100, 20); } } else { addCorpButton.setBounds( 10, 60 + timePanel.height + zoomPanel.height + solarSystemMenu.height, 100, 20); resetButton.setBounds( 10, 90 + timePanel.height + zoomPanel.height + solarSystemMenu.height, 100, 20); } } } } }