Java Code Examples for java.awt.event.ActionEvent#getWhen()

The following examples show how to use java.awt.event.ActionEvent#getWhen() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DialogDisplayer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed( ActionEvent e ) {
    nd.setValue(option);

    if (buttonListener != null) {
        // #34485: some listeners expect that the action source is the option, not the button
        ActionEvent e2 = new ActionEvent(
                option, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers()
            );
        buttonListener.actionPerformed(e2);
    }

    if ((closingOptions == null) || Arrays.asList(closingOptions).contains(option)) {
        haveFinalValue = true;
        setVisible(false);
    }
}
 
Example 2
Source File: MenuItemHelper.java    From Logisim with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void actionPerformed(ActionEvent event) {
	if (!listeners.isEmpty()) {
		ActionEvent e = new ActionEvent(menuItem, event.getID(), event.getActionCommand(), event.getWhen(),
				event.getModifiers());
		for (ActionListener l : listeners) {
			l.actionPerformed(e);
		}
	}
}
 
Example 3
Source File: HTMLDocumentEditor.java    From egdownloader with GNU General Public License v2.0 5 votes vote down vote up
public void actionPerformed(ActionEvent ae) {
	String actionCommand = ae.getActionCommand();
	if (debug) {
		int modifier = ae.getModifiers();
		long when = ae.getWhen();
		String parameter = ae.paramString();
		System.out.println("actionCommand: " + actionCommand);
		System.out.println("modifier: " + modifier);
		System.out.println("when: " + when);
		System.out.println("parameter: " + parameter);
	}
	if (actionCommand.compareTo("New") == 0) {
		startNewDocument();
	} else if (actionCommand.compareTo("Open") == 0) {
		openDocument();
	} else if (actionCommand.compareTo("Save") == 0) {
		saveDocument();
	} else if (actionCommand.compareTo("Save As") == 0) {
		saveDocumentAs();
	} else if (actionCommand.compareTo("Exit") == 0) {
		exit();
	} else if (actionCommand.compareTo("Clear") == 0) {
		clear();
	} else if (actionCommand.compareTo("Select All") == 0) {
		selectAll();
	} else if (actionCommand.compareTo("帮助") == 0) {
		help();
	} else if (actionCommand.compareTo("Keyboard Shortcuts") == 0) {
		showShortcuts();
	} else if (actionCommand.compareTo("About QuantumHyperSpace") == 0) {
		aboutQuantumHyperSpace();
	}
}
 
Example 4
Source File: SystemTime.java    From gsn with GNU General Public License v3.0 5 votes vote down vote up
public void actionPerformed ( ActionEvent actionEvent ) {
  StreamElement streamElement = new StreamElement( EMPTY_FIELD_LIST , EMPTY_FIELD_TYPES , EMPTY_DATA_PART , actionEvent.getWhen( ) );
  if(delayPostingElements){
  	streamElementBuffer.add(streamElement);
  	synchronized(objectLock){
  		objectLock.notifyAll();
  	}
  }
  else
  	postStreamElement( streamElement );
}
 
Example 5
Source File: Field.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void actionPerformed(ActionEvent e) {
  ActionEvent me = new ActionEvent(Field.this, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers());
  orgAct.actionPerformed(me);
}
 
Example 6
Source File: SourceTranslatorAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void actionPerformed(ActionEvent e) {
    ActionEvent event = new ActionEvent(source, e.getID(), e.getActionCommand(), e.getWhen(), e.getModifiers());
    scrollAction.actionPerformed(event);
}