|
@@ -214,21 +214,22 @@ public class GUI implements CategoryListener {
|
|
|
CpsObject tempCPS = null;
|
|
|
|
|
|
for (Category cat : model.getCategories()) {
|
|
|
+ if (value.toString().compareTo(cat.getCompareName()) == 0) {
|
|
|
+ label.setText(cat.getCompareName());
|
|
|
+ }
|
|
|
for (CpsObject cps : cat.getObjects()) {
|
|
|
if (value.toString().compareTo(cps.getCompareName()) == 0) {
|
|
|
tempCPS = cps;
|
|
|
- // System.out.println(tempCPS.getImage());
|
|
|
imgR = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage()
|
|
|
.getScaledInstance(30, 30, java.awt.Image.SCALE_SMOOTH);
|
|
|
if (imgR != null) {
|
|
|
label.setIcon(new ImageIcon(imgR));
|
|
|
}
|
|
|
- } else {
|
|
|
-
|
|
|
+ label.setText(cps.getName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- label.setText(value.toString());
|
|
|
+ if(label.getText().length() == 0) label.setText(value.toString());
|
|
|
return label;
|
|
|
|
|
|
}
|
|
@@ -247,14 +248,7 @@ public class GUI implements CategoryListener {
|
|
|
public void mouseReleased(MouseEvent e) {
|
|
|
try {
|
|
|
if (dragging) {
|
|
|
-
|
|
|
- // if(){
|
|
|
- // HolonSwitch h = new HolonSwitch(actualObjectClicked);
|
|
|
- // }else if(){
|
|
|
- // HolonTransformer h = new
|
|
|
- // HolonTransformer(actualObjectClicked);
|
|
|
- // }else{
|
|
|
- HolonObject h = new HolonObject(actualObjectClicked);
|
|
|
+ HolonObject h = new HolonObject(tempCps);
|
|
|
h.setPos((int) canvas.getMousePosition().getX(), (int) canvas.getMousePosition().getY());
|
|
|
controller.addObject(h);
|
|
|
for (int i = 0; i < model.getObjectsOnCanvas().size(); i++) {
|