本文整理汇总了Java中java.awt.event.ActionEvent.getSource方法的典型用法代码示例。如果您正苦于以下问题:Java ActionEvent.getSource方法的具体用法?Java ActionEvent.getSource怎么用?Java ActionEvent.getSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.ActionEvent
的用法示例。
在下文中一共展示了ActionEvent.getSource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
/**
*
*/
public void actionPerformed(ActionEvent e)
{
if (e.getSource() instanceof mxGraphComponent)
{
mxGraphComponent graphComponent = (mxGraphComponent) e
.getSource();
PrinterJob pj = PrinterJob.getPrinterJob();
PageFormat format = pj.pageDialog(graphComponent
.getPageFormat());
if (format != null)
{
graphComponent.setPageFormat(format);
graphComponent.zoomAndCenter();
}
}
}
示例2: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e)
{
if( e.getSource() == okButton )
{
closeDialog(!list.isSelectionEmpty());
}
else if( e.getSource() == cancelButton )
{
closeDialog(false);
}
}
示例3: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
JButton b = (JButton) e.getSource();
if (b.getName().equals("PAUSE")) {
if (mgr != null)
mgr.stop();
setVisible(false);
dispose();
} else if (b.getName().equals("PREVIEW")) {
if (file != null) {
XDMUtil.open(file);
}
}
if (b.getName().equals("BACKGROUND")) {
setVisible(false);
}
}
示例4: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent event) {
if (event.getSource() == buttonCancel) {
setVisible(false);
} else if (event.getSource() == buttonChoose) {
lastReverse = selectedRelation;
setVisible(false);
} else if (event.getSource() == buttonNoReverse) {
lastReverse = null;
setVisible(false);
}
}
示例5: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
Object o = e.getSource();
if (ignoreEnableTrigger) {
return;
}
if (o == langSelect) {
languageSelected();
} else if (o == contentPreview) {
previewChanged();
} else if (o == foldedSummary) {
summaryChanged();
}
}
示例6: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
if (e.getSource() == saveToFileButton) {
JFileChooser fileChooser = getFileChooser();
fileChooser.setCurrentDirectory(new File(saveToFileField.getText()).getParentFile());
if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
saveToFileField.setText(fileChooser.getSelectedFile().getAbsolutePath());
}
}
}
示例7: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
try {
if (e.getSource() == loadButton) {
levelEditView.setLevel(Level.load(new DataInputStream(ResourceStream.getResourceStream(tilesPath + nameField.getText().trim()))));
}
if (e.getSource() == saveButton) {
levelEditView.getLevel().save(new DataOutputStream(new FileOutputStream(UserDir.getUserFile((tilesPath + nameField.getText().trim())))));
}
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, ex.toString(), "Failed to load/save", JOptionPane.ERROR_MESSAGE);
}
}
示例8: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent ev) {
String s = ev.getActionCommand();
if (s.equals("ConnectOk") || (ev.getSource() instanceof TextField)) {
try {
if (mURL.getText().indexOf('\u00AB') >= 0) {
throw new Exception("please specify db path");
}
mConnection = createConnection(mDriver.getText(),
mURL.getText(),
mUser.getText(),
mPassword.getText());
if (mName.getText() != null
&& mName.getText().trim().length() != 0) {
ConnectionSetting newSetting =
new ConnectionSetting(mName.getText(),
mDriver.getText(),
mURL.getText(), mUser.getText(),
mPassword.getText());
ConnectionDialogCommon.addToRecentConnectionSettings(
settings, newSetting);
}
dispose();
} catch (java.io.IOException ioe) {
dispose();
} catch (Exception e) {
e.printStackTrace();
mError.setText(e.toString());
}
} else if (s.equals("ConnectCancel")) {
dispose();
}
}
示例9: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==this.mf.getjButton1()){
this.mf.getjButton1().setEnabled(false);
this.executors.execute(new SocketTCP(this.ph.getADDRESS(), this.ph.getPORT(), this.dm));
this.cg.refreshCharts();
}
}
示例10: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override final public void actionPerformed(ActionEvent objPactionEvent) {
final Object objLsourceObject = objPactionEvent.getSource();
if (this.objGoneSidePrintIconRadioJButton.isSameAs(objLsourceObject)) {
this.objGprintJDialog.getAttributes().add(Sides.ONE_SIDED);
} else if (this.objGtumblePrintIconRadioJButton.isSameAs(objLsourceObject)) {
this.objGprintJDialog.getAttributes().add(Sides.TUMBLE);
} else if (this.objGduplexPrintIconRadioJButton.isSameAs(objLsourceObject)) {
this.objGprintJDialog.getAttributes().add(Sides.DUPLEX);
}
}
示例11: getCheckinStatus
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
private ActionListener getCheckinStatus() {
final ActionListener listener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
AbstractButton abstractButton = (AbstractButton) e.getSource();
boolean isSelected = abstractButton.getModel().isSelected();
setEnableStatus(isSelected);
}
};
return listener;
}
示例12: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
ActiveBreakpoints ab = this.ab;
if (ab == null || !ab.canDeactivateBreakpoints()) {
return ;
}
JToggleButton button = (JToggleButton) e.getSource();
final boolean active = !button.isSelected();
ab.setBreakpointsActive(active);
setTooltip(button, active, true);
}
示例13: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
/**
* Event management.
* => exit the app if QUIT button is pressed, otherwise bubble the event to AppMain
*/
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == quitBt) {
dispose();
System.exit(0);
} else if (evt.getSource() == searchBt) {
int result = fileChooser.showSaveDialog(this);
if (result == JFileChooser.APPROVE_OPTION) {
app.setSearchDirectory(fileChooser.getSelectedFile());
}
}
}
示例14: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
Object src = e.getSource();
dialog.setVisible(false);
if (panel.cbOpenInFavorites.isSelected()) {
Utils.post(new Runnable() {
@Override
public void run () {
try {
Favorites.getDefault().selectWithAddition(FileUtil.toFileObject(workingFolder));
} catch (DataObjectNotFoundException ex) {
Logger.getLogger(ProjectOpener.class.getName()).log(Level.INFO, null, ex);
}
}
});
}
if (panel.openButton.equals(src)) {
// show project chooser
if (numberOfProjects > 1) {
selectAndOpenProjects(checkedOutProjects);
} else {
openProject(checkedOutProjects.get(null).iterator().next());
}
} else if (panel.createButton.equals(src)) {
if (workingFolder.isDirectory()) {
ProjectUtilities.newProjectWizard(workingFolder);
}
}
}
示例15: actionPerformed
import java.awt.event.ActionEvent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() instanceof JCheckBox) {
JCheckBox chkbx = (JCheckBox) e.getSource();
String name = chkbx.getName();
if (name.startsWith("overlay")) {
missionControllTab.setOverlayActive(
name.substring("overlay".length()),
chkbx.isSelected());
}
}
}