當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。