Code example for PropertyChangeEvent

Methods: getPropertyName, getSource

0
        addPropertyChangeListener(new PropertyChangeListener()
        { 
            @Override 
            public void propertyChange(PropertyChangeEvent evt)
            { 
                if (evt.getSource() == Downloader.this && evt.getPropertyName()==VALUE_PROPERTY)
                { 
                    requestClose("This will stop minecraft from launching\nAre you sure you want to do this?"); 
                } 
            } 
        }); 
        container = new JDialog(null, "Hello", ModalityType.MODELESS);
        container.setResizable(false);
        container.setLocationRelativeTo(null);
        container.add(this);
        this.updateUI();
        container.pack();
        container.setMinimumSize(container.getPreferredSize());
        container.setVisible(true);
        container.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        container.addWindowListener(new WindowAdapter()