本文整理匯總了Java中java.util.EventObject類的典型用法代碼示例。如果您正苦於以下問題:Java EventObject類的具體用法?Java EventObject怎麽用?Java EventObject使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EventObject類屬於java.util包,在下文中一共展示了EventObject類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: end
import java.util.EventObject; //導入依賴的package包/類
void end(EventObject e, boolean clear) {
Point pt = (e instanceof MouseEvent) ? ((MouseEvent)e).getPoint() : ((DropTargetDropEvent)e).getLocation();
started = false;
currentItem = null;
if(dragComponent == null) return;
if ((e instanceof DropTargetDropEvent)
|| ((e instanceof MouseEvent) && !((MouseEvent) e).isShiftDown())) {// #195795: Do not deselect the dropTarget when Shift is pressed
menuEditLayer.layers.remove(dragComponent);
menuEditLayer.dropTargetLayer.clearDropTarget();
}
switch (op) {
case PICK_AND_PLOP_FROM_PALETTE: completePickAndPlopFromPalette(pt, clear); break;
case INTER_MENU_DRAG: completeInterMenuDrag(pt); break ;
case NO_MENUBAR: /* do nothing */ break;
}
menuEditLayer.glassLayer.requestFocusInWindow();
if ((e instanceof DropTargetDropEvent)
|| ((e instanceof MouseEvent) && !((MouseEvent) e).isShiftDown())) {// #195795: Do not deselect the dropTarget when Shift is pressed
payloadComponent = null;
targetComponent = null;
}
menuEditLayer.repaint();
}
示例2: introspectListenerMethods
import java.util.EventObject; //導入依賴的package包/類
private static Method[] introspectListenerMethods(Class<?> listenerType) {
Method[] methods = listenerType.getDeclaredMethods();
ArrayList<Method> list = new ArrayList<Method>();
for (int i = 0; i < methods.length; i++) {
Class<?>[] paramTypes = methods[i].getParameterTypes();
if (paramTypes.length != 1) {
continue;
}
if (EventObject.class.isAssignableFrom(paramTypes[0])) {
list.add(methods[i]);
}
}
Method[] matchedMethods = new Method[list.size()];
list.toArray(matchedMethods);
return matchedMethods;
}
示例3: maybeToggleExpanded
import java.util.EventObject; //導入依賴的package包/類
/** Toggle the expanded state of a property set if either the event
* was a double click in the title area, a single click in the spinner
* area, or a keyboard event. */
private void maybeToggleExpanded(int row, EventObject e) {
boolean doExpand = true;
//If it's a mouse event, we need to check if it's a double click.
if (e instanceof MouseEvent) {
MouseEvent me = (MouseEvent) e;
doExpand = me.getClickCount() > 1;
//If not a double click, allow single click in the spinner margin
if (!doExpand) {
//marginWidth will definitely be initialized, you can't
//click something that isn't on the screen
doExpand = me.getPoint().x <= PropUtils.getMarginWidth();
}
}
if (doExpand) {
toggleExpanded(row);
}
}
示例4: getUpdateListener
import java.util.EventObject; //導入依賴的package包/類
private IUpdateListener getUpdateListener() {
if (m_updateListener == null) {
m_updateListener = new IUpdateListener() {
public void updateDone(EventObject source) {
try {
// .//GEN-END:_updateObject_2_be
// Add custom code //GEN-FIRST:_updateObject_1
// .//GEN-LAST:_updateObject_1
// .//GEN-BEGIN:_updateObject_3_be
doInquiry();
} catch (Exception e) {
log.warn("Error in refreshing the Results screen after the Update", e);
}
}
};
}
return m_updateListener;
}
示例5: confirm
import java.util.EventObject; //導入依賴的package包/類
public void confirm(EventObject fe) {
JTextField tf = (JTextField) fe.getSource();
JComboBox combo = (JComboBox) tf.getParent();
if (combo==null)
return;
if (fe instanceof FocusEvent) {
combo.getEditor().getEditorComponent().removeFocusListener(this);
} else {
combo.getEditor().getEditorComponent().removeKeyListener(this);
}
Configuration config = lastSelected;
config.setDisplayName(tf.getText());
combo.setSelectedItem(config);
combo.setEditable(false);
currentActiveItem = null;
}
示例6: doTestSetIcon
import java.util.EventObject; //導入依賴的package包/類
public void doTestSetIcon () {
System.err.println("testSetIcon");
TabData td = mdl.getTab (20);
noEvent = true;
mdl.setIcon(20, td.getIcon());
noEvent = false;
mdl.setIcon(20, sameSizeIcon);
assertEventIndices(20,20);
assertListenerCall("contentsChanged");
assertPravda (td.getIcon() == sameSizeIcon, "Icon was changed but same old still returned from TabData");
assertWidthNotChanged();
EventObject last = lastEvent;
mdl.setIcon(20, biggerIcon);
assertWidthChanged();
assertPravda (last != lastEvent, "Icon changed but no event fired");
//restore the state
mdl.setIcon(20,ic);
}
示例7: shouldSelectCell
import java.util.EventObject; //導入依賴的package包/類
public boolean shouldSelectCell(EventObject anEvent)
{
if ( this.cellObject == null || Help.isNull(this.cellObject.getText()) )
{
this.fireEditingCanceled();
return false;
}
//this.cellObject.setBackground($COLOR_DAY_SELECT);
//this.cellObject.setFont($FONT_SELECT);
// 這條語句是關鍵中的關鍵(提示:重繪)
setDay(Integer.parseInt(this.cellObject.getText().trim()));
return true;
}
示例8: _isEventHandler
import java.util.EventObject; //導入依賴的package包/類
private boolean _isEventHandler(
Method m
) throws IntrospectionException
{
// We assume that a method is an event handler if it has a single
// argument, whose type inherit from java.util.Event.
try
{
Class argTypes[] = m.getParameterTypes();
if (argTypes.length != 1)
{
return false;
}
return (_isSubclass(argTypes[0], EventObject.class));
}
catch (Exception ex)
{
throw new IntrospectionException("Unexpected reflection exception: " + ex);
}
}
示例9: invokeMessageViewerListeners
import java.util.EventObject; //導入依賴的package包/類
/** Invokes the processDone() method of the registered IMessageViewerListener objects in the same thread.
*/
protected void invokeMessageViewerListeners() throws ApplicationExceptions, FrameworkException{
if (m_messageViewerListeners != null) {
EventObject eventObject = new EventObject(this);
for (Iterator i = m_messageViewerListeners.iterator(); i.hasNext(); )
( (IMessageViewerListener) i.next() ).processDone(eventObject);
}
}
示例10: shouldStartEditingTimer
import java.util.EventObject; //導入依賴的package包/類
private boolean shouldStartEditingTimer(EventObject event) {
if ((event instanceof MouseEvent) && SwingUtilities.isLeftMouseButton((MouseEvent) event)) {
MouseEvent me = (MouseEvent) event;
return ((me.getID() == MouseEvent.MOUSE_PRESSED) && (me.getClickCount() == 1) && inHitRegion(me));
}
return false;
}
示例11: shouldStopEditingTimer
import java.util.EventObject; //導入依賴的package包/類
private boolean shouldStopEditingTimer(EventObject event) {
if (timer == null) {
return false;
}
if (event instanceof MouseEvent) {
MouseEvent me = (MouseEvent) event;
return (!SwingUtilities.isLeftMouseButton(me) || (me.getClickCount() > 1));
}
return false;
}
示例12: editCellAt
import java.util.EventObject; //導入依賴的package包/類
/**
* If the request is to edit ld times in a system with zero customers, shows a warning messages and returns false.
* Otherwise passes request to superclass method
*/
@Override
public boolean editCellAt(int row, int col, EventObject e) {
if (zeroLD && (stationTypes[row] == STATION_LD)) {
JOptionPane.showMessageDialog(ServiceTimesPanel.this,
"<html><center>Cannot edit LD service times in a system with zero customers</center></html>", "Warning",
JOptionPane.WARNING_MESSAGE);
return false;
}
return super.editCellAt(row, col, e);
}
示例13: isCellEditable
import java.util.EventObject; //導入依賴的package包/類
@Override
public boolean isCellEditable(EventObject event) {
if ((event != null) && (event instanceof MouseEvent)) {
if (!SwingUtilities.isLeftMouseButton((MouseEvent) event) || ((MouseEvent) event).isPopupTrigger()) {
abortTimer();
return false;
}
if (!wasFocusOwner) {
wasFocusOwner = true;
return false;
}
}
if (lastPath != null) {
Node n = Visualizer.findNode(lastPath.getLastPathComponent());
if ((n == null) || !n.canRename()) {
return false;
}
} else {
// Disallow rename when multiple nodes are selected
return false;
}
// disallow editing if we are in DnD operation
if (dndActive) {
return false;
}
return super.isCellEditable(event);
}
示例14: canEditImmediately
import java.util.EventObject; //導入依賴的package包/類
/**
* Returns true if <code>event</code> is <code>null</code>,
* or it is a <code>MouseEvent</code> with a click count > 2
* and <code>inHitRegion</code> returns true.
* @param event the event being studied
*/
protected boolean canEditImmediately(EventObject event) {
if((event instanceof MouseEvent) &&
SwingUtilities.isLeftMouseButton((MouseEvent)event)) {
MouseEvent me = (MouseEvent)event;
return ((me.getClickCount() > 2) &&
inHitRegion(me.getX(), me.getY()));
}
return (event == null);
}
示例15: DefaultCellEditor
import java.util.EventObject; //導入依賴的package包/類
/**
* Constructs a <code>DefaultCellEditor</code> object that uses a
* combo box.
*
* @param comboBox a <code>JComboBox</code> object
*/
public DefaultCellEditor(final JComboBox comboBox) {
editorComponent = comboBox;
comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
delegate = new EditorDelegate() {
public void setValue(Object value) {
comboBox.setSelectedItem(value);
}
public Object getCellEditorValue() {
return comboBox.getSelectedItem();
}
public boolean shouldSelectCell(EventObject anEvent) {
if (anEvent instanceof MouseEvent) {
MouseEvent e = (MouseEvent)anEvent;
return e.getID() != MouseEvent.MOUSE_DRAGGED;
}
return true;
}
public boolean stopCellEditing() {
if (comboBox.isEditable()) {
// Commit edited value.
comboBox.actionPerformed(new ActionEvent(
DefaultCellEditor.this, 0, ""));
}
return super.stopCellEditing();
}
};
comboBox.addActionListener(delegate);
}