From e67eb12d09abe4291d7ae980d51c2bd005d6e796 Mon Sep 17 00:00:00 2001 From: MauveCloud Date: Sat, 1 Nov 2014 19:27:27 -0700 Subject: [PATCH] Added display of environmental effect thresholds. --- nbproject/private/private.xml | 2 - src/Ic2ExpReactorPlanner/Reactor.java | 3 + .../ReactorPlannerFrame.form | 501 +++++++++--------- .../ReactorPlannerFrame.java | 33 +- 4 files changed, 296 insertions(+), 243 deletions(-) diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 4599ad9..e7e6cdd 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -4,8 +4,6 @@ file:/E:/GitHub/Ic2ExpReactorPlanner/src/Ic2ExpReactorPlanner/ReactorPlannerFrame.java - file:/E:/GitHub/Ic2ExpReactorPlanner/src/Ic2ExpReactorPlanner/Reactor.java - file:/E:/GitHub/Ic2ExpReactorPlanner/src/Ic2ExpReactorPlanner/Simulator.java diff --git a/src/Ic2ExpReactorPlanner/Reactor.java b/src/Ic2ExpReactorPlanner/Reactor.java index 14c95db..20168fb 100644 --- a/src/Ic2ExpReactorPlanner/Reactor.java +++ b/src/Ic2ExpReactorPlanner/Reactor.java @@ -46,6 +46,9 @@ public void setComponentAt(int row, int column, ReactorComponent component) { public void clearGrid() { for (int row = 0; row < grid.length; row++) { for (int col = 0; col < grid[row].length; col++) { + if (grid[row][col] != null) { + grid[row][col].removeFromReactor(); + } grid[row][col] = null; } } diff --git a/src/Ic2ExpReactorPlanner/ReactorPlannerFrame.form b/src/Ic2ExpReactorPlanner/ReactorPlannerFrame.form index f98e4a8..485e302 100644 --- a/src/Ic2ExpReactorPlanner/ReactorPlannerFrame.form +++ b/src/Ic2ExpReactorPlanner/ReactorPlannerFrame.form @@ -112,259 +112,280 @@ - - - - - - - - - + - + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + - - + + - - - - - - - - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Ic2ExpReactorPlanner/ReactorPlannerFrame.java b/src/Ic2ExpReactorPlanner/ReactorPlannerFrame.java index 9e910c5..ada1fa0 100644 --- a/src/Ic2ExpReactorPlanner/ReactorPlannerFrame.java +++ b/src/Ic2ExpReactorPlanner/ReactorPlannerFrame.java @@ -59,6 +59,7 @@ public void actionPerformed(ActionEvent e) { reactor.setComponentAt(finalRow, finalCol, componentToPlace); materialsArea.setText(reactor.getMaterials().toString()); maxHeatLabel.setText(String.format("/%,.0f", reactor.getMaxHeat())); + temperatureEffectsLabel.setText(String.format("Burn: %,d Evaporate: %,d Hurt: %,d Lava: %,d Explode: %,d", (int) (reactor.getMaxHeat() * 0.3), (int) (reactor.getMaxHeat() * 0.5), (int) (reactor.getMaxHeat() * 0.7), (int) (reactor.getMaxHeat() * 0.85), (int) (reactor.getMaxHeat() * 1.0))); SpinnerModel model = heatSpinner.getModel(); if (model instanceof SpinnerNumberModel) { ((SpinnerNumberModel)model).setMaximum(reactor.getMaxHeat()); @@ -101,6 +102,7 @@ public void mouseClicked(MouseEvent e) { reactor.setComponentAt(finalRow, finalCol, null); materialsArea.setText(reactor.getMaterials().toString()); maxHeatLabel.setText(String.format("/%,.0f", reactor.getMaxHeat())); + temperatureEffectsLabel.setText(String.format("Burn: %,d Evaporate: %,d Hurt: %,d Lava: %,d Explode: %,d", (int) (reactor.getMaxHeat() * 0.3), (int) (reactor.getMaxHeat() * 0.5), (int) (reactor.getMaxHeat() * 0.7), (int) (reactor.getMaxHeat() * 0.85), (int) (reactor.getMaxHeat() * 1.0))); SpinnerModel model = heatSpinner.getModel(); if (model instanceof SpinnerNumberModel) { ((SpinnerNumberModel) model).setMaximum(reactor.getMaxHeat()); @@ -171,6 +173,8 @@ private void initComponents() { jSplitPane2 = new javax.swing.JSplitPane(); reactorPanel = new javax.swing.JPanel(); jSplitPane3 = new javax.swing.JSplitPane(); + temperatureAndComponentsPanel = new javax.swing.JPanel(); + temperatureEffectsLabel = new javax.swing.JLabel(); componentsPanel = new javax.swing.JPanel(); emptyButton = new javax.swing.JToggleButton(); fuelRodUraniumButton = new javax.swing.JToggleButton(); @@ -237,6 +241,14 @@ public void componentResized(java.awt.event.ComponentEvent evt) { jSplitPane3.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); jSplitPane3.setResizeWeight(0.8); + temperatureAndComponentsPanel.setLayout(new java.awt.GridBagLayout()); + + temperatureEffectsLabel.setText("Burn: 4,000 Evaporate: 5,000 Hurt: 7,000 Lava: 8,500 Explode: 10,000"); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + temperatureAndComponentsPanel.add(temperatureEffectsLabel, gridBagConstraints); + componentsPanel.setMinimumSize(new java.awt.Dimension(160, 80)); componentsPanel.setPreferredSize(new java.awt.Dimension(160, 80)); componentsPanel.setLayout(new java.awt.GridLayout(4, 7)); @@ -370,7 +382,14 @@ public void componentResized(java.awt.event.ComponentEvent evt) { lzhCondensatorButton.setActionCommand("lzhCondensator"); componentsPanel.add(lzhCondensatorButton); - jSplitPane3.setLeftComponent(componentsPanel); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2); + temperatureAndComponentsPanel.add(componentsPanel, gridBagConstraints); + + jSplitPane3.setTopComponent(temperatureAndComponentsPanel); jPanel1.setLayout(new java.awt.GridBagLayout()); @@ -539,6 +558,11 @@ private void clearGridButtonActionPerformed(java.awt.event.ActionEvent evt) {//G outputArea.setText(null); materialsArea.setText(reactor.getMaterials().toString()); maxHeatLabel.setText(String.format("/%,.0f", reactor.getMaxHeat())); + temperatureEffectsLabel.setText(String.format("Burn: %,d Evaporate: %,d Hurt: %,d Lava: %,d Explode: %,d", (int)(reactor.getMaxHeat() * 0.3), (int)(reactor.getMaxHeat() * 0.5), (int)(reactor.getMaxHeat() * 0.7), (int)(reactor.getMaxHeat() * 0.85), (int)(reactor.getMaxHeat() * 1.0))); + SpinnerModel model = heatSpinner.getModel(); + if (model instanceof SpinnerNumberModel) { + ((SpinnerNumberModel) model).setMaximum(reactor.getMaxHeat()); + } changingCode = true; codeField.setText(null); changingCode = false; @@ -587,6 +611,11 @@ private void updateReactorButtons() { } materialsArea.setText(reactor.getMaterials().toString()); maxHeatLabel.setText(String.format("/%,.0f", reactor.getMaxHeat())); + temperatureEffectsLabel.setText(String.format("Burn: %,d Evaporate: %,d Hurt: %,d Lava: %,d Explode: %,d", (int)(reactor.getMaxHeat() * 0.3), (int)(reactor.getMaxHeat() * 0.5), (int)(reactor.getMaxHeat() * 0.7), (int)(reactor.getMaxHeat() * 0.85), (int)(reactor.getMaxHeat() * 1.0))); + SpinnerModel model = heatSpinner.getModel(); + if (model instanceof SpinnerNumberModel) { + ((SpinnerNumberModel) model).setMaximum(reactor.getMaxHeat()); + } refrfeshSimulationButtonActionPerformed(null); } @@ -653,6 +682,8 @@ public void run() { private javax.swing.JButton refrfeshSimulationButton; private javax.swing.JMenuItem resourcePackItem; private javax.swing.JToggleButton rshCondensatorButton; + private javax.swing.JPanel temperatureAndComponentsPanel; + private javax.swing.JLabel temperatureEffectsLabel; private javax.swing.JToggleButton thickNeutronReflectorButton; // End of variables declaration//GEN-END:variables }