当前位置: 首页>>代码示例>>Java>>正文


Java PropertyChangeEvent类代码示例

本文整理汇总了Java中java.beans.PropertyChangeEvent的典型用法代码示例。如果您正苦于以下问题:Java PropertyChangeEvent类的具体用法?Java PropertyChangeEvent怎么用?Java PropertyChangeEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PropertyChangeEvent类属于java.beans包,在下文中一共展示了PropertyChangeEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showDialog

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
private Variable showDialog() {
    JPanel inset = new JPanel(new BorderLayout());
    inset.setBorder(new EmptyBorder(12,12,0,12));
    inset.add(this);
    inset.getAccessibleContext().setAccessibleName(NbBundle.getMessage(VariablesPanel.class, "AN_Manage_Variables"));
    inset.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(VariablesPanel.class, "AD_Manage_Variables"));
    DialogDescriptor dd = new DialogDescriptor(inset, NbBundle.getMessage(VariablesPanel.class, "TITLE_Manage_Variables")); // NOI18N
    dd.setModal(true);
    final JButton ok = new JButton(NbBundle.getMessage(VariablesPanel.class, "BUTTON_OK")); // NOI18N
    ok.setDefaultCapable(true);
    explorer.addPropertyChangeListener(new PropertyChangeListener() {
       public void propertyChange(PropertyChangeEvent evt) {
           removeButton.setEnabled(explorer.getSelectedNodes().length > 0);
           editButton.setEnabled(explorer.getSelectedNodes().length == 1);
       }
    });
    dd.setOptions(new Object[] {ok, NotifyDescriptor.CANCEL_OPTION});
    dd.setClosingOptions(new Object[] {ok, NotifyDescriptor.CANCEL_OPTION});
    if (DialogDisplayer.getDefault().notify(dd) == ok) {
        model.save();
        if (explorer.getSelectedNodes().length == 1) {
            return explorer.getSelectedNodes()[0].getLookup().lookup(Variable.class);
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:VariablesPanel.java

示例2: firePropertyChange

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
@Override
public void firePropertyChange(final PropertyChangeEvent evt) {
    Object oldValue = evt.getOldValue();
    Object newValue = evt.getNewValue();
    String propertyName = evt.getPropertyName();
    if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
        return;
    }
    Runnable updater = new Runnable() {
        public void run() {
            PropertyChangeSupport pcs = (PropertyChangeSupport)
                    AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
            if (null != pcs) {
                pcs.firePropertyChange(evt);
            }
        }
    };
    final AppContext currentAppContext = AppContext.getAppContext();
    for (AppContext appContext : AppContext.getAppContexts()) {
        if (null == appContext || appContext.isDisposed()) {
            continue;
        }
        if (currentAppContext == appContext) {
            updater.run();
        } else {
            final PeerEvent e = new PeerEvent(source, updater, PeerEvent.ULTIMATE_PRIORITY_EVENT);
            SunToolkit.postEvent(appContext, e);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:Toolkit.java

示例3: realPropertyChange

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
private void realPropertyChange(PropertyChangeEvent pce) {
    String nm = pce.getPropertyName();
    Node.PropertySet[] pss = getPropertySets();
    boolean exists = false;

    for (int i = 0; i < pss.length && !exists; i++) {
        Node.Property[] ps = pss[i].getProperties();

        for (int j = 0; j < ps.length && !exists; j++) {
            if (ps[j].getName().equals(nm)) {
                exists = true;
            }
        }
    }
    if( exists ) {
        firePropertyChange(pce.getPropertyName(), pce.getOldValue(), pce.getNewValue());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ProxyNode.java

示例4: propertyChange

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (TreeMapUtils.ITEM_CLICKED.equals(evt.getPropertyName())) {
        MapData data = (MapData) evt.getNewValue();
        if (!mapLevels.containsKey(data)) {
            FxMapModel newDataModel = new FxMapModel(this, data, 0, 0);
            newDataModel.setTreeMapStyle(style);
            mapLevels.put(data, newDataModel);
            currentModel = newDataModel;
        } else {
            currentModel = mapLevels.get(data);
        }
        currentData = data;
        updateBreadCrumbBar();
        pane.getChildren().setAll(currentModel.getFxItems().stream().map(i -> i.getNode()).collect(Collectors.toList()));
        requestLayoutUpdate();
    }
}
 
开发者ID:PtitNoony,项目名称:FxTreeMap,代码行数:19,代码来源:FxTreeMap.java

示例5: main

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
    String filename = (args.length > 0) ? args[0] : FILENAME;
    Ini ini = new Ini(new FileInputStream(filename));
    Dwarf sneezy = ini.get("sneezy").as(Dwarf.class);

    sneezy.addPropertyChangeListener("age", new PropertyChangeListener()
        {
            public void propertyChange(PropertyChangeEvent event)
            {
                System.out.println("property " + event.getPropertyName() + " change");
                System.out.println(event.getOldValue() + " -> " + event.getNewValue());
            }
        });
    System.out.println("Sneezy's age: " + sneezy.getAge());
    sneezy.setAge(44);
    System.out.println("Sneezy's age: " + sneezy.getAge());
}
 
开发者ID:JetBrains,项目名称:intellij-deps-ini4j,代码行数:19,代码来源:BeanEventSample.java

示例6: propertyChange

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
    String prop = evt.getPropertyName();
    JInternalFrame f = (JInternalFrame)evt.getSource();
    boolean value = false;
    if (JInternalFrame.IS_SELECTED_PROPERTY.equals(prop)) {
        repaint();
    } else if (prop.equals("maximizable")) {
        if ((Boolean)evt.getNewValue() == Boolean.TRUE)
            add(maximizeButton);
        else
            remove(maximizeButton);
        revalidate();
        repaint();
    } else if (prop.equals("iconable")) {
        if ((Boolean)evt.getNewValue() == Boolean.TRUE)
            add(minimizeButton);
        else
            remove(minimizeButton);
        revalidate();
        repaint();
    } else if (prop.equals(JInternalFrame.TITLE_PROPERTY)) {
        repaint();
    }
    enableActions();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:MotifInternalFrameTitlePane.java

示例7: propertyChange

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
/**
 * The proxy component receives an event notification.
 */
public void propertyChange(PropertyChangeEvent evt) {
    AXIComponent source = (AXIComponent)evt.getSource();
    String property = evt.getPropertyName();
    if(!isInModel()) {
        //Ideally it shouldn't come here. Remove this as listener
        //and make shared as null, so that it'll be GCed.
        source.removeListener(this);
        //setSharedComponent(null);
        return;
    }
    //if(evt.getOldValue() == null && evt.getNewValue() != null) {
    if(PROP_CHILD_ADDED.equals(property)) {            
        onChildAdded(evt);
        return;
    }
    //if(evt.getOldValue() != null && evt.getNewValue() == null) {
    if(PROP_CHILD_REMOVED.equals(property)) {
        onChildDeleted(evt);
        return;
    }
            
    firePropertyChangeEvent(evt.getPropertyName(),
            evt.getOldValue(), evt.getNewValue());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:AXIComponent.java

示例8: propertyChange

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
@Override
public void propertyChange (PropertyChangeEvent evt) {
    String url = EditorContextBridge.getContext().getCurrentURL();
    FileObject fo;
    try {
        fo = URLMapper.findFileObject(new URL(url));
    } catch (MalformedURLException muex) {
        fo = null;
    }
    setEnabled (
        ActionsManager.ACTION_TOGGLE_BREAKPOINT,
        (EditorContextBridge.getContext().getCurrentLineNumber () >= 0) && 
        (fo != null && "text/x-java".equals(fo.getMIMEType()))  // NOI18N
        //(EditorContextBridge.getCurrentURL ().endsWith (".java"))
    );
    if ( debugger != null && 
         debugger.getState () == JPDADebugger.STATE_DISCONNECTED
    ) 
        destroy ();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ToggleBreakpointActionProvider.java

示例9: FileSystemView

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
public FileSystemView() {
    final WeakReference<FileSystemView> weakReference = new WeakReference<FileSystemView>(this);

    UIManager.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            FileSystemView fileSystemView = weakReference.get();

            if (fileSystemView == null) {
                // FileSystemView was destroyed
                UIManager.removePropertyChangeListener(this);
            } else {
                if (evt.getPropertyName().equals("lookAndFeel")) {
                    fileSystemView.useSystemExtensionHiding =
                            UIManager.getDefaults().getBoolean("FileChooser.useSystemExtensionHiding");
                }
            }
        }
    });
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:FileSystemView.java

示例10: propertyChange

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
/** Accepts property changes from DataObject and fires them to
* own listeners.
*/
public void propertyChange(PropertyChangeEvent ev) {
    if (DataObject.PROP_MODIFIED.equals (ev.getPropertyName())) {
        if (getDataObject ().isModified ()) {
            getDataObject ().addVetoableChangeListener(this);
        } else {
            getDataObject ().removeVetoableChangeListener(this);
        }
    }
    
    firePropertyChange (
        ev.getPropertyName (),
        ev.getOldValue (),
        ev.getNewValue ()
    );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:OpenSupport.java

示例11: getComponent

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
@Override
public java.awt.Component getComponent() {
    if (panel == null) {
        if (isContainerManaged) {
            datasourcePanel = new PersistenceUnitWizardPanelDS(project, this, true);
            panel = datasourcePanel;
        } else {
            jdbcPanel= new PersistenceUnitWizardPanelJdbc(project, this, true);
            panel = jdbcPanel;
        }
        panel.addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt.getPropertyName().equals(PersistenceUnitWizardPanel.IS_VALID)) {
                    Object newvalue = evt.getNewValue();
                    if ((newvalue != null) && (newvalue instanceof Boolean)) {
                        stateChanged(null);
                    }
                }
            }
        });
    }
    return panel;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:PersistenceUnitWizardDescriptor.java

示例12: propertyChange

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
@Override
public void propertyChange (final PropertyChangeEvent e) {
    if (JPDADebugger.PROP_STATE.equals(e.getPropertyName ())) {
        int state = ((Integer) e.getNewValue ()).intValue ();
        if (state == JPDADebugger.STATE_STOPPED || state == JPDADebugger.STATE_DISCONNECTED) {
            rp.post(new Runnable() {
                @Override
                public void run() {
                    if (first != null) {
                        DebuggerManager.getDebuggerManager().removeBreakpoint(first);
                        first = null;
                        ((JPDADebugger) e.getSource()).removePropertyChangeListener(JPDADebugger.PROP_STATE, pcl);
                    }
                }
            });
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:JPDAStart.java

示例13: propertyChange

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
    String propertyName = evt.getPropertyName();
    if (logger.isLoggable(Level.FINE)) {
        logger.fine("EditorRegistryListener.propertyChange("+propertyName+": "+evt.getOldValue()+" => "+evt.getNewValue()+")");
    }
    if (propertyName.equals(EditorRegistry.FOCUS_LOST_PROPERTY)) {
        Object newFocused = evt.getNewValue();
        if (newFocused instanceof JRootPane) {
            JRootPane root = (JRootPane) newFocused;
            if (root.isAncestorOf((Component) evt.getOldValue())) {
                logger.fine("Focused root.");
                root.addFocusListener(this);
                return;
            }
        }
    }
    if (propertyName.equals(EditorRegistry.FOCUS_GAINED_PROPERTY) ||
        propertyName.equals(EditorRegistry.FOCUS_LOST_PROPERTY) ||
        propertyName.equals(EditorRegistry.FOCUSED_DOCUMENT_PROPERTY)) {
        
        update(true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:EditorContextDispatcher.java

示例14: propertyChange

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
@Override
        public void propertyChange(PropertyChangeEvent e) {
            if (JPDADebugger.PROP_STATE.equals(e.getPropertyName())) {
                int state = ((Integer) e.getNewValue()).intValue();
                if ( (state == JPDADebugger.STATE_DISCONNECTED) ||
                        (state == JPDADebugger.STATE_STOPPED)
                        ) {
//                    RequestProcessor.getDefault ().post (new Runnable () {
//                        public void run () {
                    if (breakpoint != null) {
                        DebuggerManager.getDebuggerManager().
                                removeBreakpoint(breakpoint);
                        breakpoint = null;
                    }
//                        }
//                    });
                    dispose();
                }
            }
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:JPDAStart.java

示例15: installPropertyChangeListeners

import java.beans.PropertyChangeEvent; //导入依赖的package包/类
private void installPropertyChangeListeners() {
    final WeakReference<TitledBorder> weakReference = new WeakReference<TitledBorder>(this);
    final PropertyChangeListener listener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (weakReference.get() == null) {
                UIManager.removePropertyChangeListener(this);
                UIManager.getDefaults().removePropertyChangeListener(this);
            } else {
                String prop = evt.getPropertyName();
                if ("lookAndFeel".equals(prop) || "LabelUI".equals(prop)) {
                    label.updateUI();
                }
            }
        }
    };

    UIManager.addPropertyChangeListener(listener);
    UIManager.getDefaults().addPropertyChangeListener(listener);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:TitledBorder.java


注:本文中的java.beans.PropertyChangeEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。