當前位置: 首頁>>代碼示例>>Java>>正文


Java ActionEvent.getSource方法代碼示例

本文整理匯總了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();
		}
	}
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:21,代碼來源:EditorActions.java

示例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);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:13,代碼來源:FilterDialog.java

示例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);
	}
}
 
開發者ID:kmarius,項目名稱:xdman,代碼行數:17,代碼來源:XDMDownloadWindow.java

示例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);
    }
}
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:16,代碼來源:ReverseRelationWindow.java

示例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();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:FoldOptionsPanel.java

示例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());
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:SnapshotCustomizer.java

示例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);
	}
}
 
開發者ID:CognitiveModeling,項目名稱:BrainControl,代碼行數:13,代碼來源:LevelEditor.java

示例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();
        }
    }
 
開發者ID:tiweGH,項目名稱:OpenDiabetes,代碼行數:39,代碼來源:ConnectionDialog.java

示例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();
    }
}
 
開發者ID:ilofX,項目名稱:StazioneMetereologica,代碼行數:9,代碼來源:ListenerBottoniMainFrame.java

示例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);
	}
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:12,代碼來源:PrintSidesSubJPanel.java

示例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;
}
 
開發者ID:Coder-ACJHP,項目名稱:Hotel-Properties-Management-System,代碼行數:13,代碼來源:CustomerForm.java

示例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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:BreakpointsViewButtons.java

示例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());
    }
  }
}
 
開發者ID:juliango202,項目名稱:jijimaku,代碼行數:16,代碼來源:AppGui.java

示例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);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:ProjectOpener.java

示例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());
		}
	}
}
 
開發者ID:CognitiveModeling,項目名稱:BrainControl,代碼行數:13,代碼來源:MissionControllPanel.java


注:本文中的java.awt.event.ActionEvent.getSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。