private void setListeners() {
        nameText.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        nameText.selectAll();
                    }
                });
            }
        });

        heightText.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        heightText.selectAll();
                    }
                });
            }
        });

        widthText.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        widthText.selectAll();
                    }
                });
            }
        });

        fontSizeText.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        fontSizeText.selectAll();
                    }
                });
            }
        });

        ChangeListener listener = new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                if (element instanceof Arc) {
                    ((Arc) element).setCapacity((Integer) capacitySpiner.getValue());
                }
                if (element instanceof Node) {
                    ((Node) element).setCapacity((Integer) capacitySpiner.getValue());
                }
                if (element instanceof Resource) {
                    ((Resource) element).setMarking((Integer) capacitySpiner.getValue());
                }
                if (element instanceof Place) {
                    int countOfMarks = (Integer) capacitySpiner.getValue();
                    Marking tempMark = new Marking(element);
                    ArrayList<Integer> tempMarking = new ArrayList<Integer>();
                    for (int i = 0; i < countOfMarks; i++) {
                        tempMarking.add(i + 1);
                    }
                    tempMark.setMarkings(tempMarking);
                    ((Place) element).setMarkings(tempMark);
                }
                window.updateComponentListFromDiagram();
                window.repaint();
            }
        };

        capacitySpiner.addChangeListener(listener);

//
//        capacityText.addFocusListener(new java.awt.event.FocusAdapter() {
//            public void focusGained(java.awt.event.FocusEvent evt) {
//                SwingUtilities.invokeLater(new Runnable() {
//                    @Override
//                    public void run() {
//                        capacityText.selectAll();
//                    }
//                });
//            }
//        });


    }