parent
0386119bcc
commit
63c9b86d3e
@ -22,8 +22,7 @@ public class FormAdditionalCollection extends JFrame {
|
|||||||
private CanvasExcavator canvasExc = new CanvasExcavator();
|
private CanvasExcavator canvasExc = new CanvasExcavator();
|
||||||
private AdditionalCollections<EntityBulldozer, IDifferentRollers> additionalCollection = null;
|
private AdditionalCollections<EntityBulldozer, IDifferentRollers> additionalCollection = null;
|
||||||
private Random random = new Random();
|
private Random random = new Random();
|
||||||
private JButton buttonCreate = new JButton("Создать");
|
private JButton buttonGenerate = new JButton("Создать");
|
||||||
private JButton buttonAdd = new JButton("Добавить");
|
|
||||||
private JList<String> listEntity = new JList<String>();
|
private JList<String> listEntity = new JList<String>();
|
||||||
private JList<String> listRollers = new JList<String>();
|
private JList<String> listRollers = new JList<String>();
|
||||||
public FormAdditionalCollection() {
|
public FormAdditionalCollection() {
|
||||||
@ -32,15 +31,22 @@ public class FormAdditionalCollection extends JFrame {
|
|||||||
additionalCollection = new AdditionalCollections<EntityBulldozer, IDifferentRollers>(3, (Class) EntityBulldozer.class, (Class) IDifferentRollers.class);
|
additionalCollection = new AdditionalCollections<EntityBulldozer, IDifferentRollers>(3, (Class) EntityBulldozer.class, (Class) IDifferentRollers.class);
|
||||||
AddEntities();
|
AddEntities();
|
||||||
AddRollers();
|
AddRollers();
|
||||||
|
buttonGenerate.addActionListener(new ActionListener() {
|
||||||
buttonCreate.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
|
||||||
drawingBulldozer = additionalCollection.CreateAdditionalCollectionBulldozer();
|
drawingBulldozer = additionalCollection.CreateAdditionalCollectionBulldozer();
|
||||||
drawingBulldozer.SetPictureSize(getWidth(), getHeight());
|
drawingBulldozer.SetPictureSize(getWidth(), getHeight());
|
||||||
drawingBulldozer.SetPosition(50,50);
|
drawingBulldozer.SetPosition(50,50);
|
||||||
canvasExc._drawingBulldozer = drawingBulldozer;
|
canvasExc._drawingBulldozer = drawingBulldozer;
|
||||||
canvasExc.repaint();
|
canvasExc.repaint();
|
||||||
|
DrawingBulldozer copyBulldozer;
|
||||||
|
if (drawingBulldozer instanceof DrawingExcavator)
|
||||||
|
copyBulldozer = new DrawingExcavator((EntityExcavator) drawingBulldozer.EntityBulldozer, drawingBulldozer.drawingRollers);
|
||||||
|
else
|
||||||
|
copyBulldozer = new DrawingBulldozer(drawingBulldozer.EntityBulldozer, drawingBulldozer.drawingRollers);
|
||||||
|
company._collection.Insert(copyBulldozer);
|
||||||
|
FormBulldozerCollection.canvasShow();
|
||||||
|
|
||||||
String[] data1 = new String[additionalCollection.CountEntities];
|
String[] data1 = new String[additionalCollection.CountEntities];
|
||||||
for (int i = 0; i < additionalCollection.CountEntities; i++) {
|
for (int i = 0; i < additionalCollection.CountEntities; i++) {
|
||||||
@ -56,25 +62,8 @@ public class FormAdditionalCollection extends JFrame {
|
|||||||
listRollers.setListData(data2);
|
listRollers.setListData(data2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
buttonGenerate.setBounds(450, 10, 100, 50);
|
||||||
buttonAdd.addActionListener(new ActionListener() {
|
add(buttonGenerate);
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
if (drawingBulldozer != null) {
|
|
||||||
DrawingBulldozer copyBulldozer;
|
|
||||||
if (drawingBulldozer instanceof DrawingExcavator)
|
|
||||||
copyBulldozer = new DrawingExcavator((EntityExcavator) drawingBulldozer.EntityBulldozer, drawingBulldozer.drawingRollers);
|
|
||||||
else
|
|
||||||
copyBulldozer = new DrawingBulldozer(drawingBulldozer.EntityBulldozer, drawingBulldozer.drawingRollers);
|
|
||||||
company._collection.Insert(copyBulldozer);
|
|
||||||
FormBulldozerCollection.canvasShow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
buttonCreate.setBounds(300, 10, 100, 50);
|
|
||||||
buttonAdd.setBounds(450, 10, 100, 50);
|
|
||||||
add(buttonCreate);
|
|
||||||
add(buttonAdd);
|
|
||||||
listEntity.setBounds(10,200,300,60);
|
listEntity.setBounds(10,200,300,60);
|
||||||
listRollers.setBounds(320,200,300,60);
|
listRollers.setBounds(320,200,300,60);
|
||||||
add(listEntity);
|
add(listEntity);
|
||||||
@ -92,10 +81,10 @@ public class FormAdditionalCollection extends JFrame {
|
|||||||
private String ToString(IDifferentRollers rollers) {
|
private String ToString(IDifferentRollers rollers) {
|
||||||
if (rollers == null || rollers.getRollersCount() == null)
|
if (rollers == null || rollers.getRollersCount() == null)
|
||||||
return "Dont have rollers";
|
return "Dont have rollers";
|
||||||
String str = "Rollers ";
|
String str = "Deck ";
|
||||||
if (rollers instanceof DrawingRollersCross) str += "Type Cross ";
|
if (rollers instanceof DrawingRollersCross) str += "Type Cross ";
|
||||||
else if (rollers instanceof DrawingRollersPlus) str += "Type Plus ";
|
else if (rollers instanceof DrawingRollersPlus) str += "Type Plus ";
|
||||||
else str += "Type Star ";
|
else str += "Type 3 ";
|
||||||
str += rollers.getRollersCount().toString();
|
str += rollers.getRollersCount().toString();
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user