当前位置: 首页>>代码示例>>Java>>正文


Java JButton.equals方法代码示例

本文整理汇总了Java中javax.swing.JButton.equals方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.equals方法的具体用法?Java JButton.equals怎么用?Java JButton.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JButton的用法示例。


在下文中一共展示了JButton.equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: searchClassFiles

import javax.swing.JButton; //导入方法依赖的package包/类
private void searchClassFiles(File[] folders) throws WizardValidationException {
    List<File> classFiles = new ArrayList<File>();
    for (File folder : folders) {
        findClassFiles(folder, classFiles);
    }
    if (!classFiles.isEmpty()) {
        JButton DELETE_OPTION = new JButton(NbBundle.getMessage(PanelSourceFolders.class, "TXT_DeleteOption")); // NOI18N
        JButton KEEP_OPTION = new JButton(NbBundle.getMessage(PanelSourceFolders.class, "TXT_KeepOption")); // NOI18N
        JButton CANCEL_OPTION = new JButton(NbBundle.getMessage(PanelSourceFolders.class, "TXT_CancelOption")); // NOI18N
        KEEP_OPTION.setMnemonic(NbBundle.getMessage(PanelSourceFolders.class, "MNE_KeepOption").charAt(0)); // NOI18N
        DELETE_OPTION.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PanelSourceFolders.class, "AD_DeleteOption")); // NOI18N
        KEEP_OPTION.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PanelSourceFolders.class, "AD_KeepOption")); // NOI18N
        CANCEL_OPTION.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PanelSourceFolders.class, "AD_CancelOption")); // NOI18N
        NotifyDescriptor desc = new NotifyDescriptor(
                NbBundle.getMessage(PanelSourceFolders.class, "MSG_FoundClassFiles"), // NOI18N
                NbBundle.getMessage(PanelSourceFolders.class, "MSG_FoundClassFiles_Title"), // NOI18N
                NotifyDescriptor.YES_NO_CANCEL_OPTION,
                NotifyDescriptor.QUESTION_MESSAGE,
                new Object[]{DELETE_OPTION, KEEP_OPTION, CANCEL_OPTION},
                DELETE_OPTION);
        Object result = DialogDisplayer.getDefault().notify(desc);
        if (DELETE_OPTION.equals(result)) {
            for (File f : classFiles) {
                f.delete(); // ignore if fails
            }
        } else if (!KEEP_OPTION.equals(result)) {
            // cancel, back to wizard
            throw new WizardValidationException(this.sourcePanel, "", ""); // NOI18N
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:PanelSourceFolders.java

示例2: canCloseImpl

import javax.swing.JButton; //导入方法依赖的package包/类
/** @return 0 => cannot close, -1 can close and do not save, 1 can close and save */
private int canCloseImpl() {
	String msg = messageSave();

	ResourceBundle bundle = NbBundle.getBundle(CloneableEditorSupport.class);

	JButton saveOption = new JButton(bundle.getString("CTL_Save")); // NOI18N
	saveOption.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_CTL_Save")); // NOI18N
	saveOption.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_CTL_Save")); // NOI18N

	JButton discardOption = new JButton(bundle.getString("CTL_Discard")); // NOI18N
	discardOption.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_CTL_Discard")); // NOI18N
	discardOption.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_CTL_Discard")); // NOI18N
	discardOption.setMnemonic(bundle.getString("CTL_Discard_Mnemonic").charAt(0)); // NOI18N

	NotifyDescriptor nd = new NotifyDescriptor(
			msg, bundle.getString("LBL_SaveFile_Title"), NotifyDescriptor.YES_NO_CANCEL_OPTION,
			NotifyDescriptor.QUESTION_MESSAGE,
			new Object[] { saveOption, discardOption, NotifyDescriptor.CANCEL_OPTION }, saveOption
		);

	Object ret = DialogDisplayer.getDefault().notify(nd);

	if (NotifyDescriptor.CANCEL_OPTION.equals(ret) || NotifyDescriptor.CLOSED_OPTION.equals(ret)) {
		return 0;
	}

	if (saveOption.equals(ret)) {
		return 1;
	} else {
		return -1;
	}
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:CloneableEditorSupport.java

示例3: displayServerRunning

import javax.swing.JButton; //导入方法依赖的package包/类
private boolean displayServerRunning() {
    JButton cancelButton = new JButton();
    Mnemonics.setLocalizedText(cancelButton, NbBundle.getMessage(StopManager.class, "StopManager.CancelButton")); // NOI18N
    cancelButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(StopManager.class, "StopManager.CancelButtonA11yDesc")); //NOI18N

    JButton keepWaitingButton = new JButton();
    Mnemonics.setLocalizedText(keepWaitingButton, NbBundle.getMessage(StopManager.class, "StopManager.KeepWaitingButton")); // NOI18N
    keepWaitingButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(StopManager.class, "StopManager.KeepWaitingButtonA11yDesc")); //NOI18N

    JButton propsButton = new JButton();
    Mnemonics.setLocalizedText(propsButton, NbBundle.getMessage(StopManager.class, "StopManager.PropsButton")); // NOI18N
    propsButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(StopManager.class, "StopManager.PropsButtonA11yDesc")); //NOI18N

    String message = NbBundle.getMessage(StopManager.class, "MSG_ServerStillRunning");
    final NotifyDescriptor ndesc = new NotifyDescriptor(message,
            NbBundle.getMessage(StopManager.class, "StopManager.ServerStillRunningTitle"),
            NotifyDescriptor.YES_NO_CANCEL_OPTION,
            NotifyDescriptor.QUESTION_MESSAGE,
            new Object[] {keepWaitingButton, propsButton, cancelButton},
            NotifyDescriptor.CANCEL_OPTION); //NOI18N

    Object ret = Mutex.EVENT.readAccess(new Action<Object>() {
        @Override
        public Object run() {
            return DialogDisplayer.getDefault().notify(ndesc);
        }

    });

    if (cancelButton.equals(ret)) {
        stopRequested.set(false);
        return false;
    } else if (keepWaitingButton.equals(ret)) {
        return true;
    } else {
        displayAdminProperties(server);
        return false;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:StopManager.java

示例4: showWritePermissionDialog

import javax.swing.JButton; //导入方法依赖的package包/类
@Messages({"cancel=Cancel", "installAnyway=Install anyway", "warning=Write permission problem",
    "writePermissionDetails=<html>You don't have permission to install JUnit Library into the installation directory which is recommened.<br><br>"
    + "To perform installation into the shared directory, you should run IDE as a user with administrative<br>"
    + "privilege, or install the JUnit Library into your user directory."})
private static void showWritePermissionDialog(Runnable installAnyway) {
    JButton cancel = new JButton();
    Mnemonics.setLocalizedText(cancel, cancel());
    JButton install = new JButton();
    Mnemonics.setLocalizedText(install, installAnyway());
    DialogDescriptor descriptor = new DialogDescriptor(
            new JLabel(writePermissionDetails()),
            warning(),
            true, // Modal
            new JButton[]{install, cancel}, // Option list
            null, // Default
            DialogDescriptor.DEFAULT_ALIGN, // Align
            null, // Help
            null);
    
    descriptor.setMessageType(NotifyDescriptor.QUESTION_MESSAGE);
    descriptor.setClosingOptions(null);
    DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
    if (install.equals(descriptor.getValue())) {
        // install anyway
        LOG.info("user install JUnit into userdir anyway");
        InstallLibraryTask.RP.post(installAnyway);
    } else {
        LOG.info("user canceled install JUnit into userdir");
    }
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:JUnitLibraryInstaller.java

示例5: getPlayerByButton

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Returns the row to which the button belongs.
 *
 * @param removeButton
 * @return
 */
private PlayerInfoRow getPlayerByButton(JButton removeButton) {
    for (PlayerInfoRow player : players) {
        if (removeButton.equals(player.getRemoveButton())) {
            return player;
        }
    }
    return null;
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-B,代码行数:15,代码来源:RemovePlayerListener.java


注:本文中的javax.swing.JButton.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。