java.beans.PropertyChangeEvent源码实例Demo

java.awt.event.ContainerListener#java.beans.PropertyChangeEvent源码实例Demo

下面列出了java.awt.event.ContainerListener#java.beans.PropertyChangeEvent 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: radiance   文件: SubstanceRadioButtonUI.java
@Override
protected void installListeners(final AbstractButton b) {
    super.installListeners(b);

    this.stateTransitionTracker.registerModelListeners();
    this.stateTransitionTracker.registerFocusListeners();

    this.substancePropertyListener = (PropertyChangeEvent evt) -> {
        if (AbstractButton.MODEL_CHANGED_PROPERTY.equals(evt.getPropertyName())) {
            stateTransitionTracker.setModel((ButtonModel) evt.getNewValue());
        }
        if ("font".equals(evt.getPropertyName())) {
            SwingUtilities.invokeLater(b::updateUI);
        }
    };
    b.addPropertyChangeListener(substancePropertyListener);
}
 
源代码2 项目: netbeans   文件: BaseActionProvider.java
public BaseActionProvider(Project project, UpdateHelper updateHelper, PropertyEvaluator evaluator, 
        SourceRoots sourceRoots, SourceRoots testRoots, AntProjectHelper antProjectHelper, Callback callback) {
    this.antProjectHelper = antProjectHelper;
    this.callback = callback;
    this.classpaths = (id) -> getCallback().getProjectSourcesClassPath(id);
    this.updateHelper = updateHelper;
    this.project = project;
    this.evaluator = evaluator;
    this.projectSourceRoots = sourceRoots;
    this.projectTestRoots = testRoots;
    this.evaluator.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(final PropertyChangeEvent evt) {
            synchronized (BaseActionProvider.class) {
                final String propName = evt.getPropertyName();
                if (propName == null || BUILD_SCRIPT.equals(propName)) {
                    buildXMLName = null;
                }
            }
        }
    });
    this.listeners = Collections.singletonList(new EventAdaptor());
    this.delegate = new AtomicReference<>();
}
 
源代码3 项目: netbeans   文件: EditorRegistry.java
private synchronized static void _focusGained(JTextComponent c, Component origFocused, List<PropertyChangeEvent> events) {
    Item item = item(c);
    assert (item != null) : "Not registered!"; // NOI18N

    // Move the item to head of the list
    removeFromItemList(item);
    addToItemListAsFirst(item);
    item.focused = true;

    c.addPropertyChangeListener(PropertyDocL.INSTANCE);
    if (LOG.isLoggable(Level.FINE)) {
        LOG.log(Level.FINE, FOCUS_GAINED_PROPERTY + ": " + dumpComponent(c) + '\n'); //NOI18N
        logItemListFinest();
    }
    if (c == origFocused) {
        origFocused = null;
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("has equal components, using origFocused = "+origFocused);
        }
    }
    events.add(new PropertyChangeEvent(EditorRegistry.class, FOCUS_GAINED_PROPERTY, origFocused, c));
}
 
源代码4 项目: jdk8u_jdk   文件: EnumEditor.java
public void setValue( Object value ) {
    if ( ( value != null ) && !this.type.isInstance( value ) ) {
        throw new IllegalArgumentException( "Unsupported value: " + value );
    }
    Object oldValue;
    PropertyChangeListener[] listeners;
    synchronized ( this.listeners ) {
        oldValue = this.value;
        this.value = value;

        if ( ( value == null ) ? oldValue == null : value.equals( oldValue ) ) {
            return; // do not fire event if value is not changed
        }
        int size = this.listeners.size();
        if ( size == 0 ) {
            return; // do not fire event if there are no any listener
        }
        listeners = this.listeners.toArray( new PropertyChangeListener[size] );
    }
    PropertyChangeEvent event = new PropertyChangeEvent( this, null, oldValue, value );
    for ( PropertyChangeListener listener : listeners ) {
        listener.propertyChange( event );
    }
}
 
源代码5 项目: netbeans   文件: SectionNodePanel.java
public SectionNodePanel(final SectionNode node, boolean openFirstChild) {
    super(node.getSectionNodeView(), node, node.getDisplayName(), node);
    this.openFirstChild = openFirstChild;
    
    if (node.getKey() instanceof SectionView) {
        // the section corresponding to the top level node is always expanded
        setInnerViewMode();
    } else if (node.isExpanded()) {
        setExpandedViewMode();
    }
    node.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (Node.PROP_DISPLAY_NAME.equals(evt.getPropertyName())) {
                setTitle(node.getDisplayName());
            }
        }
    });
}
 
源代码6 项目: Sparkplug   文件: MainActivity.java
/**
 * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
 */
@Override
public void propertyChange(PropertyChangeEvent event) {

    if (!event.getPropertyName().equals(ActivityConstants.ConnectionStatusProperty)) {
        return;
    }
    mainActivity.runOnUiThread(new Runnable() {

        @Override
        public void run() {
            mainActivity.drawerFragment.notifyDataSetChanged();
        }

    });

}
 
源代码7 项目: pgptool   文件: DecryptOnePm.java
@Override
public void propertyChange(PropertyChangeEvent evt) {
	boolean result = isUseBrowseFolder.getValue();
	actionBrowseTarget.setEnabled(result);
	targetFileEnabled.setValueByOwner(result);
	// NOTE: MAGIC: This event might be triggered when using suggested
	// parameters. So if value is already provided for target file then
	// we'll not show file chooser
	if (result && !StringUtils.hasText(targetFile.getValue())) {
		getTargetFileChooser().askUserForFile(UiUtils.actionEvent(evt));
	}

	if (!result) {
		clearValidationErrorsFromTargetFile();
	}
}
 
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();
}
 
源代码9 项目: ramus   文件: IDEF0TabView.java
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (Action.SELECTED_KEY.equals(evt.getPropertyName())) {
        if ((Boolean) evt.getNewValue()) {
            Toolkit toolkit = Toolkit.getDefaultToolkit();
            Image image = toolkit.getImage(getClass()
                    .getResource("/images/pen-cursor.png"));
            java.awt.Point point = new java.awt.Point(0, 15);
            panel.getMovingArea().setVisualCopyCursor(
                    toolkit.createCustomCursor(image, point,
                            "CopyVisualCursor"));
        } else {
            panel.getMovingArea().setVisualCopyCursor(null);
        }
    }
}
 
源代码10 项目: openjdk-8   文件: MotifInternalFrameTitlePane.java
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();
}
 
源代码11 项目: pumpernickel   文件: SummonMenuItem.java
/**
 * Create a new <code>SummonMenuItem</code>.
 * 
 * @param f
 *            the frame to bring to front when this menu item is activated
 */
public SummonMenuItem(Frame f) {
	super();
	frame = f;
	addActionListener(actionListener);
	updateText();

	frame.addPropertyChangeListener("title", new PropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent e) {
			updateText();
		}
	});

	// this UI is buggy, and has issues.
	// the main issue is that it won't even show up on Macs
	// if you use the screen menubar, and since the goal
	// is to emulate macs: why bother?
	// if(frame instanceof JFrame)
	// setUI(new FrameMenuItemUI((JFrame)frame));
}
 
源代码12 项目: jdk8u-dev-jdk   文件: ElementTreePanel.java
/**
 * Invoked when a property changes. We are only interested in when the
 * Document changes to reset the DocumentListener.
 */
public void propertyChange(PropertyChangeEvent e) {
    if (e.getSource() == getEditor() && e.getPropertyName().equals(
            "document")) {
        Document oldDoc = (Document) e.getOldValue();
        Document newDoc = (Document) e.getNewValue();

        // Reset the DocumentListener
        oldDoc.removeDocumentListener(this);
        newDoc.addDocumentListener(this);

        // Recreate the TreeModel.
        treeModel = new ElementTreeModel(newDoc);
        tree.setModel(treeModel);
    }
}
 
源代码13 项目: jdk8u-jdk   文件: BasicScrollPaneUI.java
private void sbPropertyChange(PropertyChangeEvent e) {
    String propertyName = e.getPropertyName();
    Object source = e.getSource();

    if ("model" == propertyName) {
        JScrollBar sb = scrollpane.getVerticalScrollBar();
        BoundedRangeModel oldModel = (BoundedRangeModel)e.
                             getOldValue();
        ChangeListener cl = null;

        if (source == sb) {
            cl = vsbChangeListener;
        }
        else if (source == scrollpane.getHorizontalScrollBar()) {
            sb = scrollpane.getHorizontalScrollBar();
            cl = hsbChangeListener;
        }
        if (cl != null) {
            if (oldModel != null) {
                oldModel.removeChangeListener(cl);
            }
            if (sb.getModel() != null) {
                sb.getModel().addChangeListener(cl);
            }
        }
    }
    else if ("componentOrientation" == propertyName) {
        if (source == scrollpane.getHorizontalScrollBar()) {
            JScrollBar hsb = scrollpane.getHorizontalScrollBar();
            JViewport viewport = scrollpane.getViewport();
            Point p = viewport.getViewPosition();
            if (scrollpane.getComponentOrientation().isLeftToRight()) {
                p.x = hsb.getValue();
            } else {
                p.x = viewport.getViewSize().width - viewport.getExtentSize().width - hsb.getValue();
            }
            viewport.setViewPosition(p);
        }
    }
}
 
源代码14 项目: TencentKona-8   文件: CTrayIcon.java
public void propertyChange(PropertyChangeEvent e) {
    if (messageDialog == null) {
        return;
    }

    String prop = e.getPropertyName();
    Container cp = messageDialog.getContentPane();

    if (messageDialog.isVisible() && e.getSource() == cp &&
            (prop.equals(JOptionPane.VALUE_PROPERTY))) {
        disposeMessageDialog();
    }
}
 
源代码15 项目: jdk8u60   文件: FilePane.java
public void propertyChange(PropertyChangeEvent e) {
        if (viewType == -1) {
            setViewType(VIEWTYPE_LIST);
        }

    String s = e.getPropertyName();
    if (s.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
        doSelectedFileChanged(e);
    } else if (s.equals(JFileChooser.SELECTED_FILES_CHANGED_PROPERTY)) {
        doSelectedFilesChanged(e);
    } else if (s.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) {
        doDirectoryChanged(e);
    } else if (s.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) {
        doFilterChanged(e);
    } else if (s.equals(JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY)) {
        doFileSelectionModeChanged(e);
    } else if (s.equals(JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY)) {
        doMultiSelectionChanged(e);
    } else if (s.equals(JFileChooser.CANCEL_SELECTION)) {
        applyEdit();
    } else if (s.equals("busy")) {
        setCursor((Boolean)e.getNewValue() ? waitCursor : null);
    } else if (s.equals("componentOrientation")) {
        ComponentOrientation o = (ComponentOrientation)e.getNewValue();
        JFileChooser cc = (JFileChooser)e.getSource();
        if (o != e.getOldValue()) {
            cc.applyComponentOrientation(o);
        }
        if (detailsTable != null) {
            detailsTable.setComponentOrientation(o);
            detailsTable.getParent().getParent().setComponentOrientation(o);
        }
    }
}
 
源代码16 项目: netbeans   文件: ProxyNode.java
@Override
public void propertyChange(PropertyChangeEvent pce) {
    if (nodeListener) {
        nodePropertyChange(pce);
    } else {
        realPropertyChange(pce);
    }
}
 
源代码17 项目: jdk8u_jdk   文件: SynthColorChooserUI.java
/**
 * {@inheritDoc}
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (SynthLookAndFeel.shouldUpdateStyle(e)) {
        updateStyle((JColorChooser)e.getSource());
    }
}
 
public void propertyChange(PropertyChangeEvent evt) {
    String prop = evt.getPropertyName();
    if( prop.equals(JInternalFrame.IS_SELECTED_PROPERTY) ) {
        Boolean b = (Boolean)evt.getNewValue();
        iconButton.putClientProperty("paintActive", b);
        closeButton.putClientProperty("paintActive", b);
        maxButton.putClientProperty("paintActive", b);
    }
    else if ("JInternalFrame.messageType".equals(prop)) {
        updateOptionPaneState();
        frame.repaint();
    }
    super.propertyChange(evt);
}
 
源代码19 项目: netbeans   文件: CreateTag.java
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (selectButton != null && ChangesetPickerSimplePanel.PROP_VALID.equals(evt.getPropertyName())) {
        boolean valid = (Boolean) evt.getNewValue();
        selectButton.setEnabled(valid);
    }
}
 
源代码20 项目: openjdk-jdk8u   文件: MetalScrollBarUI.java
public void propertyChange(PropertyChangeEvent e)
{
    String name = e.getPropertyName();
    if ( name.equals( FREE_STANDING_PROP ) )
    {
        handlePropertyChange( e.getNewValue() );
    }
    else {
        super.propertyChange( e );
    }
}
 
源代码21 项目: netbeans   文件: CustomizerDisplay.java
@Override
public void propertyChange(PropertyChangeEvent evt) {
    super.propertyChange(evt);
    if (SingleModuleProperties.NB_PLATFORM_PROPERTY.equals(evt.getPropertyName())) {
        fillUpCategoryValue();
    }
}
 
源代码22 项目: netbeans   文件: VersioningPanelController.java
@Override
public void propertyChange (PropertyChangeEvent evt) {
    if (FileStatusCache.PROP_FILE_STATUS_CHANGED.equals(evt.getPropertyName())) {
        FileStatusCache.ChangedEvent changedEvent = (FileStatusCache.ChangedEvent) evt.getNewValue();
        if (affectsView((FileStatusCache.ChangedEvent) evt.getNewValue())) {
            applyChange(changedEvent);
        }
    }
}
 
源代码23 项目: jdk1.8-source-analysis   文件: JFileChooser.java
public void propertyChange(PropertyChangeEvent ev) {
    assert ev.getPropertyName().equals(SHOW_HIDDEN_PROP);
    JFileChooser jfc = jfcRef.get();
    if (jfc == null) {
        // Our JFileChooser is no longer around, so we no longer need to
        // listen for PropertyChangeEvents.
        Toolkit.getDefaultToolkit().removePropertyChangeListener(SHOW_HIDDEN_PROP, this);
    }
    else {
        boolean oldValue = jfc.useFileHiding;
        jfc.useFileHiding = !((Boolean)ev.getNewValue()).booleanValue();
        jfc.firePropertyChange(FILE_HIDING_CHANGED_PROPERTY, oldValue, jfc.useFileHiding);
    }
}
 
源代码24 项目: netbeans   文件: BootClassPathImplementation.java
public void propertyChange(PropertyChangeEvent evt) {
    if (GrailsProjectConfig.GRAILS_JAVA_PLATFORM_PROPERTY.equals(evt.getPropertyName())
            || GrailsProjectConfig.GRAILS_PLATFORM_PROPERTY.equals(evt.getPropertyName())) {

        LOGGER.log(Level.FINE, "Boot classpath changed due to change in {0}", evt.getPropertyName());

        synchronized (BootClassPathImplementation.this) {
            resourcesCache = null;
            eventId++;
        }
        support.firePropertyChange(ClassPathImplementation.PROP_RESOURCES, null, null);
    }
}
 
源代码25 项目: ghidra   文件: CachingSwingWorker.java
@Override
public void propertyChange(PropertyChangeEvent event) {
	if ("state".equals(event.getPropertyName()) &&
		SwingWorker.StateValue.DONE == event.getNewValue()) {
		dialog.close();
	}
}
 
源代码26 项目: netbeans   文件: DatabaseConnectionTest.java
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals(DatabaseConnection.PROP_DRIVER)) {
        fired++;
        assertEquals("driver", evt.getNewValue());
    } else if (evt.getPropertyName().equals(DatabaseConnection.PROP_DATABASE)) {
        fired++;
        assertEquals("database", evt.getNewValue());
    } else if (evt.getPropertyName().equals(DatabaseConnection.PROP_SCHEMA)) {
        fired++;
        assertEquals("schema", evt.getNewValue());
    } else if (evt.getPropertyName().equals(DatabaseConnection.PROP_USER)) {
        fired++;
        assertEquals("user", evt.getNewValue());
    }
}
 
源代码27 项目: dragonwell8_jdk   文件: SunClipboard.java
public void propertyChange(PropertyChangeEvent evt) {
    if (AppContext.DISPOSED_PROPERTY_NAME.equals(evt.getPropertyName()) &&
        Boolean.TRUE.equals(evt.getNewValue())) {
        final AppContext disposedContext = (AppContext)evt.getSource();
        lostOwnershipLater(disposedContext);
    }
}
 
源代码28 项目: kogito-runtimes   文件: NamedEntryPoint.java
public void propertyChange(final PropertyChangeEvent event) {
    final Object object = event.getSource();
    FactHandle handle = getFactHandle( object );
    if ( handle == null ) {
        throw new RuntimeException( "Update error: handle not found for object: " + object + ". Is it in the working memory?" );
    }
    update( handle, object );
}
 
public void propertyChange(PropertyChangeEvent evt) {
    String prop = evt.getPropertyName();

    if (prop == JInternalFrame.IS_SELECTED_PROPERTY) {
        repaint();
        return;
    }

    if (prop == JInternalFrame.IS_ICON_PROPERTY ||
            prop == JInternalFrame.IS_MAXIMUM_PROPERTY) {
        setButtonIcons();
        enableActions();
        return;
    }

    if ("closable" == prop) {
        if (evt.getNewValue() == Boolean.TRUE) {
            add(closeButton);
        } else {
            remove(closeButton);
        }
    } else if ("maximizable" == prop) {
        if (evt.getNewValue() == Boolean.TRUE) {
            add(maxButton);
        } else {
            remove(maxButton);
        }
    } else if ("iconable" == prop) {
        if (evt.getNewValue() == Boolean.TRUE) {
            add(iconButton);
        } else {
            remove(iconButton);
        }
    }
    enableActions();

    revalidate();
    repaint();
}
 
源代码30 项目: jdk8u60   文件: MetalInternalFrameUI.java
public void propertyChange(PropertyChangeEvent e)
{
    String name = e.getPropertyName();
    JInternalFrame jif = (JInternalFrame)e.getSource();

    if (!(jif.getUI() instanceof MetalInternalFrameUI)) {
        return;
    }

    MetalInternalFrameUI ui = (MetalInternalFrameUI)jif.getUI();

    if ( name.equals( FRAME_TYPE ) )
    {
        if ( e.getNewValue() instanceof String )
        {
            ui.setFrameType( (String) e.getNewValue() );
        }
    }
    else if ( name.equals(IS_PALETTE_KEY) )
    {
        if ( e.getNewValue() != null )
        {
            ui.setPalette( ((Boolean)e.getNewValue()).booleanValue() );
        }
        else
        {
            ui.setPalette( false );
        }
    } else if ( name.equals( JInternalFrame.CONTENT_PANE_PROPERTY ) ) {
        ui.stripContentBorder(e.getNewValue());
    }
}