Compare commits

...

2 Commits

3 changed files with 5 additions and 4 deletions

View File

@ -17,7 +17,8 @@ public class DrawingArtillery {
public void Init(int speed, float weight, Color bodyColor, int rollersCount) { public void Init(int speed, float weight, Color bodyColor, int rollersCount) {
artillery = new EntityArtillery(); artillery = new EntityArtillery();
artillery.Init(speed, weight, bodyColor); artillery.Init(speed, weight, bodyColor);
drawingRollers = new DrawingRollers(rollersCount, bodyColor); drawingRollers = new DrawingRollers();
drawingRollers.Init(rollersCount, bodyColor);
} }
public void SetPosition(int x, int y, int width, int height) { public void SetPosition(int x, int y, int width, int height) {

View File

@ -4,9 +4,9 @@ public class DrawingRollers {
private RollersCount rollersCount; private RollersCount rollersCount;
private Color color; private Color color;
public DrawingRollers(int rollersCount, Color rollersColor) { public void Init(int rollersCount, Color bodyColor) {
setRollersCount(rollersCount); setRollersCount(rollersCount);
color = rollersColor; color = bodyColor;
} }
public void setRollersCount(int num) { public void setRollersCount(int num) {

View File

@ -42,7 +42,7 @@ public class FormArtillery extends JFrame {
pictureBox.addComponentListener(new ComponentAdapter() { pictureBox.addComponentListener(new ComponentAdapter() {
@Override @Override
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
if (_artillery != null) _artillery.changeBorders(e.getComponent().getWidth(), e.getComponent().getHeight()); if (_artillery != null) _artillery.changeBorders(pictureBox.getWidth(), pictureBox.getHeight());
repaint(); repaint();
} }
}); });