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


Java PropertyChangeEvent.getSource方法代码示例

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


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

示例1: propertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if ("editorKit".equals(evt.getPropertyName())) {
        if (evt.getNewValue() == null && (evt.getSource() instanceof JEditorPane)) {
            JEditorPane pane = (JEditorPane)evt.getSource();
            // It's necessary to detach BasicTextUI's handler from property listening on document
            // to allow GC of the pane and related objects.
            // BTW cannot verify that null kit is present since pane.getEditorKit() lazily creates the kit
            // Unfortunately JTextComponent.getUI() cannot return null since
            // JTextComponent's code assumes it to be non-null (while e.g. JComponent properly checks it for null).
            // Thus use an empty impl of a TextUI.
            pane.setUI(new NullTextUI());
            pane.removePropertyChangeListener(this);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BaseKit.java

示例2: 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:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:MotifInternalFrameTitlePane.java

示例3: propertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
/**
 * Process property change events from our associated Context.
 *
 * @param event The property change event that has occurred
 */
public void propertyChange(PropertyChangeEvent event) {

    // Validate the source of this event
    if (!(event.getSource() instanceof Context))
        return;
    Context context = (Context) event.getSource();

    // Process a relevant property change
    if (event.getPropertyName().equals("sessionTimeout")) {
        try {
            setMaxInactiveInterval
                ( ((Integer) event.getNewValue()).intValue()*60 );
        } catch (NumberFormatException e) {
            log.error(sm.getString("standardManager.sessionTimeout",
                             event.getNewValue().toString()));
        }
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:PersistentManagerBase.java

示例4: propertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (SynthLookAndFeel.shouldUpdateStyle(e)) {
        updateStyle((JToolTip)e.getSource());
    }
    String name = e.getPropertyName();
    if (name.equals("tiptext") || "font".equals(name) ||
            "foreground".equals(name)) {
        // remove the old html view client property if one
        // existed, and install a new one if the text installed
        // into the JLabel is html source.
        JToolTip tip = ((JToolTip) e.getSource());
        String text = tip.getTipText();
        BasicHTML.updateRenderer(tip, text);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SynthToolTipUI.java

示例5: createPropertyChangeHandler

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
private PropertyChangeListener createPropertyChangeHandler() {
    return new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
              String propertyName = e.getPropertyName();

              if (propertyName.equals("componentOrientation")) {
                    JScrollPane pane = (JScrollPane)e.getSource();
                    JScrollBar vsb = pane.getVerticalScrollBar();
                    if (vsb != null && vsbBorder != null &&
                        vsb.getBorder() == vsbBorder) {
                        // The Border on the verticall scrollbar matches
                        // what we installed, reset it.
                        if (MotifGraphicsUtils.isLeftToRight(pane)) {
                            vsbBorder = new CompoundBorder(vsbMarginBorderR,
                                            vsbBorder.getInsideBorder());
                        } else {
                            vsbBorder = new CompoundBorder(vsbMarginBorderL,
                                            vsbBorder.getInsideBorder());
                        }
                        vsb.setBorder(vsbBorder);
                    }
              }
    }};
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:MotifScrollPaneUI.java

示例6: propertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent ev) {
	final String prop = ev.getPropertyName();
	if (isVisible()
			&& ev.getSource() == option_pane
			&& (JOptionPane.VALUE_PROPERTY.equals(prop)
			|| JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) {
		if (option_pane.getValue() == JOptionPane.UNINITIALIZED_VALUE)
			return;
		option_pane.setValue(JOptionPane.UNINITIALIZED_VALUE);
		
		final Component selected_panel = tabbed_pane.getSelectedComponent();
		if (selected_panel == rotation_panel)
			create_rotation_gate();
		else if (selected_panel == phase_shift_panel) {
			create_phase_shift_gate();
		} else if (selected_panel == matrix_panel) {
			create_matrix_gate();
		} else
			throw new RuntimeException("Selected tab is not listed in the tabbed panel");
	}
}
 
开发者ID:QwertygidQ,项目名称:DeutschSim,代码行数:23,代码来源:CustomGatePrompt.java

示例7: propertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
    String s = evt.getPropertyName();

    if (s!=null && (s.equals("parent") || s.equals("ancestor"))) {
        JComponent component = (JComponent)evt.getSource();

        if (evt.getNewValue() != null) {
            if (component == firstInvisibleAncestor) {
                addListeners(component, false);
                if (firstInvisibleAncestor == null) {
                    fireAncestorAdded(root, AncestorEvent.ANCESTOR_ADDED,
                                      component, component.getParent());
                }
            }
        } else {
            boolean needsNotify = firstInvisibleAncestor == null;
            Container oldParent = (Container)evt.getOldValue();

            removeListeners(oldParent);
            firstInvisibleAncestor = component;
            if (needsNotify) {
                fireAncestorRemoved(root, AncestorEvent.ANCESTOR_REMOVED,
                                    component, oldParent);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:AncestorNotifier.java

示例8: propertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
    if (JPDAThread.PROP_SUSPENDED.equals(evt.getPropertyName())) {
        if ("methodInvoke".equals(evt.getPropagationId())) {
            return ; // Ignore events associated with method invocations
        }
        JPDAThread thread = (JPDAThread) evt.getSource();
        if (thread.isSuspended()) {
            firePropertyChange(PROP_THREAD_SUSPENDED, null, thread);
        } else {
            firePropertyChange(PROP_THREAD_RESUMED, null, thread);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ThreadsCollectorImpl.java

示例9: propertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:SunClipboard.java

示例10: propertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getSource() == group) {
        updateKeys();
        if (evt.getNewValue() != null) {
            refreshKey(evt.getNewValue());
        } else if (evt.getOldValue() != null) {
            refreshKey(evt.getOldValue());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:SaasGroupNodeChildren.java

示例11: propertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getSource() == SaasServicesModel.getInstance().getRootGroup() &&
        SaasServicesModel.getInstance().getState() == SaasServicesModel.State.READY) {
        updateKeys();
    }
    super.propertyChange(evt);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:SaasServicesRootNode.java

示例12: sbPropertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
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);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:BasicScrollPaneUI.java

示例13: validatePropertyChangeEvent

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
/**
 * Checks the validity of this event. Certain events shouldn't go to
 * the code generator. For example events coming from proxy components.
 * There are certain other cases as well.
 */
private boolean validatePropertyChangeEvent(PropertyChangeEvent evt) {
    Object source = evt.getSource();
    //events coming from model are valid
    if( !(source instanceof AXIComponent) )
        return true;
            
    //ignore proxy related events
    if(proxyRelated(evt))
        return false;
                    
    
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:AXIModelListener.java

示例14: propertyChange

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
/**
 * Invoked when a property changes. <code>MetalRootPaneUI</code> is
 * primarily interested in events originating from the
 * <code>JRootPane</code> it has been installed on identifying the
 * property <code>windowDecorationStyle</code>. If the
 * <code>windowDecorationStyle</code> has changed to a value other
 * than <code>JRootPane.NONE</code>, this will add a <code>Component</code>
 * to the <code>JRootPane</code> to render the window decorations, as well
 * as installing a <code>Border</code> on the <code>JRootPane</code>.
 * On the other hand, if the <code>windowDecorationStyle</code> has
 * changed to <code>JRootPane.NONE</code>, this will remove the
 * <code>Component</code> that has been added to the <code>JRootPane</code>
 * as well resetting the Border to what it was before
 * <code>installUI</code> was invoked.
 *
 * @param e A PropertyChangeEvent object describing the event source
 *          and the property that has changed.
 */
public void propertyChange(PropertyChangeEvent e) {
    super.propertyChange(e);

    String propertyName = e.getPropertyName();
    if(propertyName == null) {
        return;
    }

    if(propertyName.equals("windowDecorationStyle")) {
        JRootPane root = (JRootPane) e.getSource();
        int style = root.getWindowDecorationStyle();

        // This is potentially more than needs to be done,
        // but it rarely happens and makes the install/uninstall process
        // simpler. MetalTitlePane also assumes it will be recreated if
        // the decoration style changes.
        uninstallClientDecorations(root);
        if (style != JRootPane.NONE) {
            installClientDecorations(root);
        }
    }
    else if (propertyName.equals("ancestor")) {
        uninstallWindowListeners(root);
        if (((JRootPane)e.getSource()).getWindowDecorationStyle() !=
                                       JRootPane.NONE) {
            installWindowListeners(root, root.getParent());
        }
    }
    return;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:49,代码来源:MetalRootPaneUI.java

示例15: assertEvent

import java.beans.PropertyChangeEvent; //导入方法依赖的package包/类
public void assertEvent(String propertyName, Object source) {
    for (PropertyChangeEvent e : events) {
        if (propertyName.equals(e.getPropertyName()) && e.getSource() == source) {
            return; //matched
        }
    }
    assertTrue("Expect property change event "+propertyName, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:SyncUpdateTest.java


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