本文整理匯總了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);
}
}
}
示例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();
}
示例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()));
}
}
}
示例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);
}
}
示例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);
}
}
}};
}
示例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");
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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());
}
}
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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);
}