|
@@ -1,6 +1,7 @@
|
|
|
package ui.view;
|
|
|
|
|
|
import java.awt.BorderLayout;
|
|
|
+import java.awt.Color;
|
|
|
import java.awt.Component;
|
|
|
import java.awt.FlowLayout;
|
|
|
import java.awt.Image;
|
|
@@ -84,6 +85,24 @@ public class AddObjectPopUp extends JDialog {
|
|
|
}
|
|
|
{
|
|
|
objectName = new JTextField();
|
|
|
+ objectName.addKeyListener(new KeyListener() {
|
|
|
+ @Override
|
|
|
+ public void keyPressed(KeyEvent arg0) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void keyReleased(KeyEvent e) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void keyTyped(KeyEvent e) {
|
|
|
+ objectName.setBackground(Color.WHITE);
|
|
|
+ }
|
|
|
+ });
|
|
|
objectName.setBounds(98, 18, 172, 20);
|
|
|
contentPanel.add(objectName);
|
|
|
objectName.setColumns(10);
|
|
@@ -101,6 +120,24 @@ public class AddObjectPopUp extends JDialog {
|
|
|
}
|
|
|
{
|
|
|
sourcePath = new JTextField();
|
|
|
+ sourcePath.addKeyListener(new KeyListener() {
|
|
|
+ @Override
|
|
|
+ public void keyPressed(KeyEvent arg0) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void keyReleased(KeyEvent e) {
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void keyTyped(KeyEvent e) {
|
|
|
+ sourcePath.setBackground(Color.WHITE);
|
|
|
+ }
|
|
|
+ });
|
|
|
sourcePath.setBounds(148, 77, 271, 20);
|
|
|
contentPanel.add(sourcePath);
|
|
|
sourcePath.setColumns(10);
|
|
@@ -166,18 +203,23 @@ public class AddObjectPopUp extends JDialog {
|
|
|
public void mouseClicked(MouseEvent e) {
|
|
|
Component frame = null;
|
|
|
if (objectName.getText().length() == 0) {
|
|
|
- JOptionPane.showMessageDialog(frame, "please enter a name");
|
|
|
- } else if (!sourcePath.getText().equals(filePath)) {
|
|
|
- JOptionPane.showMessageDialog(frame, "No image selected!");
|
|
|
- } else {
|
|
|
- copieFile();
|
|
|
- theObject = new HolonObject(objectName.getText());
|
|
|
- theObject.setElements(hElements);
|
|
|
- theObject.setImage(imagePath);
|
|
|
- controller.addObjectCategory(controller.searchCategory(givenCategory), theObject);
|
|
|
- System.out.println(theObject.getImage());
|
|
|
- System.out.println(givenCategory);
|
|
|
- dispose();
|
|
|
+ // JOptionPane.showMessageDialog(frame, "please
|
|
|
+ // enter a name");
|
|
|
+ objectName.setBackground(new Color(255, 50, 50));
|
|
|
+ if (!sourcePath.getText().equals(filePath)) {
|
|
|
+ // JOptionPane.showMessageDialog(frame, "No
|
|
|
+ // image selected!");
|
|
|
+ sourcePath.setBackground(new Color(255, 50, 50));
|
|
|
+ } else {
|
|
|
+ copieFile();
|
|
|
+ theObject = new HolonObject(objectName.getText());
|
|
|
+ theObject.setElements(hElements);
|
|
|
+ theObject.setImage(imagePath);
|
|
|
+ controller.addObjectCategory(controller.searchCategory(givenCategory), theObject);
|
|
|
+ System.out.println(theObject.getImage());
|
|
|
+ System.out.println(givenCategory);
|
|
|
+ dispose();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|