Added and Fixed EntityWarmlyLocomotive & DrawningWarmlyLocomotive
This commit is contained in:
parent
673ba65efe
commit
4526388454
30
DrawningWarmlyLocomotive.java
Normal file
30
DrawningWarmlyLocomotive.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import java.awt.*;
|
||||||
|
public class DrawningWarmlyLocomotive extends DrawningLocomotive{
|
||||||
|
public DrawningWarmlyLocomotive(int speed, float weight, Color bodyColor, Color extraColor, boolean pipe, boolean storage)
|
||||||
|
{
|
||||||
|
super(speed, weight, bodyColor, 110, 50);
|
||||||
|
Locomotive = new EntityWarmlyLocomotive(speed, weight, bodyColor, extraColor, pipe, storage);
|
||||||
|
}
|
||||||
|
public void DrawTransport(Graphics g)
|
||||||
|
{
|
||||||
|
if (Locomotive instanceof EntityWarmlyLocomotive)
|
||||||
|
{
|
||||||
|
EntityWarmlyLocomotive warmlyLocomotive = (EntityWarmlyLocomotive) Locomotive;
|
||||||
|
//Pen pen = new(Color.Black);
|
||||||
|
//Brush extraBrush = new SolidBrush(warmlyLocomotive.ExtraColor);
|
||||||
|
super.DrawTransport((Graphics2D)g);
|
||||||
|
|
||||||
|
if (warmlyLocomotive.Pipe)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warmlyLocomotive.FuelStorage)
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
EntityWarmlyLocomotive.java
Normal file
15
EntityWarmlyLocomotive.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class EntityWarmlyLocomotive extends EntityLocomotive{
|
||||||
|
public final Color ExtraColor;
|
||||||
|
public final boolean Pipe;
|
||||||
|
public final boolean FuelStorage;
|
||||||
|
public EntityWarmlyLocomotive (int speed, float weight, Color bodyColor, Color extraColor, boolean pipe, boolean fuelStorage)
|
||||||
|
{
|
||||||
|
super(speed, weight, bodyColor);
|
||||||
|
ExtraColor = extraColor;
|
||||||
|
Pipe = pipe;
|
||||||
|
FuelStorage = fuelStorage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -47,7 +47,23 @@ public class FormLocomotive extends JComponent{
|
|||||||
repaint();
|
repaint();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
JButton modifiedButton = new JButton("Modified");
|
||||||
|
modifiedButton.addActionListener(e -> {
|
||||||
|
Random rnd = new Random();
|
||||||
|
_locomotive = new DrawningWarmlyLocomotive(rnd.nextInt(200) + 100, rnd.nextInt(1000) + 1000,
|
||||||
|
new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
|
||||||
|
new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
|
||||||
|
rnd.nextBoolean(),
|
||||||
|
rnd.nextBoolean());
|
||||||
|
_locomotive.SetPosition(10 + rnd.nextInt(90), 10 + rnd.nextInt(90), formFrame.getWidth(), formFrame.getHeight() - 75);
|
||||||
|
speedLabel.setText("Speed: " + _locomotive.Locomotive.getSpeed());
|
||||||
|
weightLabel.setText("Weight: " + (int)_locomotive.Locomotive.getWeight());
|
||||||
|
colorLabel.setText("Color: " + _locomotive.Locomotive.getBodyColor().getRed() + " " + _locomotive.Locomotive.getBodyColor().getGreen() + " " + _locomotive.Locomotive.getBodyColor().getBlue() );
|
||||||
|
repaint();
|
||||||
|
});
|
||||||
|
|
||||||
statusPanel.add(createButton);
|
statusPanel.add(createButton);
|
||||||
|
statusPanel.add(modifiedButton);
|
||||||
statusPanel.add(speedLabel);
|
statusPanel.add(speedLabel);
|
||||||
statusPanel.add(weightLabel);
|
statusPanel.add(weightLabel);
|
||||||
statusPanel.add(colorLabel);
|
statusPanel.add(colorLabel);
|
||||||
@ -84,6 +100,8 @@ public class FormLocomotive extends JComponent{
|
|||||||
formFrame.getContentPane().add(this);
|
formFrame.getContentPane().add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void paintComponent(Graphics g) {
|
protected void paintComponent(Graphics g) {
|
||||||
super.paintComponent(g);
|
super.paintComponent(g);
|
||||||
|
Loading…
Reference in New Issue
Block a user