private void handleClassPlacement(MouseEvent arg0, UMLButton selected_button) {
		
		last_connector_id = "";
		last_clicked_class = null;
		ArrayList<JComponent> associated_components = new ArrayList<JComponent>();
		
		JLabel lab = new JLabel(selected_button.getText() + ": ");
		
		ClassInstance c = new ClassInstance(EntityMeta.all_classes.get(selected_button.id));
		try {
			restrictions.checkClassAddRestrictionMeta(c, model_instance);
		}
		catch(RestrictionException e) {
			error.setText(e.getMessage());
			error.setLocation(10, 10);
			error.setSize(error.getPreferredSize());
			return;
		}
		panel.rectangles.put(c.id, arg0.getPoint());
		associated_components.add(lab);
		
		model_instance.instanced_classes.put(c.id, c);
		
		panel.add(lab);
		lab.setLocation(arg0.getPoint());
		lab.setSize(lab.getPreferredSize());
		
		JTextField instance_name = new JTextField(c.instance_name);
		panel.add(instance_name);
		instance_name.setLocation(new Point(arg0.getPoint().x + lab.getSize().width, arg0.getPoint().y));
		instance_name.setSize(200-lab.getWidth()-5, instance_name.getPreferredSize().height);
		instance_name.setBorder(null);
		instance_name.addFocusListener(new JTextFieldListener(instance_name, c));
		associated_components.add(instance_name);
		
		for(int i = 0; i < c.attributes.size(); ++i) {
			JLabel attr_lab = new JLabel(c.attributes.get(i).meta.name + ": ");
			panel.add(attr_lab);
			
			attr_lab.setLocation(new Point(arg0.getPoint().x, arg0.getPoint().y+35+5*i));
			attr_lab.setSize(attr_lab.getPreferredSize());
			
			attr_lab.setToolTipText(c.attributes.get(i).meta.type);
			associated_components.add(attr_lab);
			
			JTextField attr_instance_name = new JTextField(c.attributes.get(i).value);
			panel.add(attr_instance_name);
			associated_components.add(attr_instance_name);
			attr_instance_name.setLocation(new Point(arg0.getPoint().x + attr_lab.getSize().width, arg0.getPoint().y+35+20*i));
			attr_instance_name.setSize(200-attr_lab.getWidth()-5, attr_instance_name.getPreferredSize().height);
			attr_instance_name.setBorder(null);
			attr_instance_name.setToolTipText(c.attributes.get(i).meta.type);
			attr_instance_name.addFocusListener(new JTextFieldListener(attr_instance_name, c.attributes.get(i)));
		}
		
		for(int i = 0; i < c.enums.size(); ++i) {
			EnumInstance enum_i = c.enums.get(i);
			JLabel enum_lab = new JLabel(enum_i.meta.name + ": ");
			panel.add(enum_lab);
			associated_components.add(enum_lab);
			enum_lab.setLocation(new Point(arg0.getPoint().x, arg0.getPoint().y+35+(c.attributes.size()+i)*20));
			enum_lab.setSize(enum_lab.getPreferredSize());
			
			String[] values = new String[enum_i.meta.possible_values.size()];
			
			for(int j = 0; j < values.length; ++j)
				values[j] = enum_i.meta.possible_values.get(j);
			
			
			JComboBox<String> enum_values = new JComboBox<String>(values);
			enum_values.addActionListener(new EnumComboBoxListener(enum_i));
			panel.add(enum_values);
			associated_components.add(enum_values);
			enum_values.setLocation(new Point(arg0.getPoint().x+enum_lab.getSize().width, enum_lab.getLocation().y));
			enum_values.setSize(enum_lab.getPreferredSize());
		}
		
		class_components.put(c.id, associated_components);
		panel.revalidate();
		panel.repaint();
	}