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


Java JButton.isEnabled方法代码示例

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


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

示例1: trySendEnterToDialog

import javax.swing.JButton; //导入方法依赖的package包/类
private void trySendEnterToDialog() {
    //        System.err.println("SendEnterToDialog");
    EventObject ev = EventQueue.getCurrentEvent();

    if (ev instanceof KeyEvent && (((KeyEvent) ev).getKeyCode() == KeyEvent.VK_ENTER)) {
        if (ev.getSource() instanceof JComboBox && ((JComboBox) ev.getSource()).isPopupVisible()) {
            return;
        }

        if (
            ev.getSource() instanceof JTextComponent &&
                ((JTextComponent) ev.getSource()).getParent() instanceof JComboBox &&
                ((JComboBox) ((JTextComponent) ev.getSource()).getParent()).isPopupVisible()
        ) {
            return;
        }

        JRootPane jrp = getRootPane();

        if (jrp != null) {
            JButton b = jrp.getDefaultButton();

            if ((b != null) && b.isEnabled()) {
                b.doClick();
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:EditablePropertyDisplayer.java

示例2: trySendEnterToDialog

import javax.swing.JButton; //导入方法依赖的package包/类
private void trySendEnterToDialog(BaseTable bt) {
    //        System.err.println("SendEnterToDialog");
    EventObject ev = EventQueue.getCurrentEvent();

    if (ev instanceof KeyEvent && (((KeyEvent) ev).getKeyCode() == KeyEvent.VK_ENTER)) {
        if (ev.getSource() instanceof JComboBox && ((JComboBox) ev.getSource()).isPopupVisible()) {
            return;
        }

        if (
            ev.getSource() instanceof JTextComponent &&
                ((JTextComponent) ev.getSource()).getParent() instanceof JComboBox &&
                ((JComboBox) ((JTextComponent) ev.getSource()).getParent()).isPopupVisible()
        ) {
            return;
        }

        JRootPane jrp = bt.getRootPane();

        if (jrp != null) {
            JButton b = jrp.getDefaultButton();

            if ((b != null) && b.isEnabled()) {
                b.doClick();
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:BaseTable.java

示例3: actionPerformed

import javax.swing.JButton; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
    JRootPane jrp = getRootPane();
    if (jrp != null) {
        JButton b = getRootPane().getDefaultButton();
        if (b != null && b.isEnabled()) {
            b.doClick();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ETable.java

示例4: actionPerformed

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Starts / stops the search. This code is called by the text field and
 * search button.
 */
public void actionPerformed(final ActionEvent event) {
    final JButton searchButton = (JButton) event.getSource();

    if (!searchButton.isEnabled())
        return;

    if (searchButton.getLabel().equals("Stop")) {
        searchWindow.stopSearch();
    } else {
        searchWindow.startSearch();
    }
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:17,代码来源:SearchButtonHandler.java

示例5: CellTypeTextFieldDefaultImpl

import javax.swing.JButton; //导入方法依赖的package包/类
/**
 * Creates a {@link JFormattedTextField} for the specified cell. If a formatter is given, will
 * apply it to the field. Does not validate the model, so make sure this call works!
 * 
 * @param model
 * @param rowIndex
 * @param columnIndex
 * @param cellClass
 * @param formatter
 *            the formatter or <code>null</code> if none is required
 * @param hideUnavailableContentAssist
 * @return
 */
public CellTypeTextFieldDefaultImpl(final TablePanelModel model, final int rowIndex, final int columnIndex,
		final Class<? extends CellType> cellClass, AbstractFormatter formatter, boolean hideUnavailableContentAssist) {
	super();

	final JFormattedTextField field = CellTypeImplHelper.createFormattedTextField(model, rowIndex, columnIndex);
	setLayout(new BorderLayout());
	add(field, BorderLayout.CENTER);

	// otherwise 'null' would be restored
	Object value = model.getValueAt(rowIndex, columnIndex);
	String text = value != null ? String.valueOf(value) : "";

	// specical handling when formatter is given
	if (formatter != null) {
		field.setFormatterFactory(new DefaultFormatterFactory(formatter));
	}
	field.setText(text);

	// set syntax assist if available
	String syntaxHelp = model.getSyntaxHelpAt(rowIndex, columnIndex);
	if (syntaxHelp != null && !"".equals(syntaxHelp.trim())) {
		PromptSupport.setForeground(Color.LIGHT_GRAY, field);
		PromptSupport.setPrompt(syntaxHelp, field);
		PromptSupport.setFontStyle(Font.ITALIC, field);
		PromptSupport.setFocusBehavior(FocusBehavior.SHOW_PROMPT, field);
	}

	// see if content assist is possible for this field, if so add it
	ImageIcon icon = SwingTools.createIcon("16/"
			+ I18N.getMessageOrNull(I18N.getGUIBundle(), "gui.action.content_assist.icon"));
	JButton contentAssistButton = new JButton();
	contentAssistButton.setIcon(icon);
	if (field.isEnabled() && model.isContentAssistPossibleForCell(rowIndex, columnIndex)) {
		contentAssistButton.setToolTipText(I18N.getMessageOrNull(I18N.getGUIBundle(),
				"gui.action.content_assist_enabled.tip"));
		CellTypeImplHelper.addContentAssist(model, rowIndex, columnIndex, field, contentAssistButton, cellClass);
	} else {
		contentAssistButton.setToolTipText(I18N.getMessageOrNull(I18N.getGUIBundle(),
				"gui.action.content_assist_disabled.tip"));
		contentAssistButton.setEnabled(false);
	}
	if (contentAssistButton.isEnabled() || (!contentAssistButton.isEnabled() && !hideUnavailableContentAssist)) {
		add(contentAssistButton, BorderLayout.EAST);
	}

	// set size so panels don't grow larger when they get the chance
	setPreferredSize(new Dimension(300, 20));
	setMinimumSize(new Dimension(100, 15));
	setMaximumSize(new Dimension(1600, 30));
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:64,代码来源:CellTypeTextFieldDefaultImpl.java


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