• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ButtonModel类的典型用法代码示例

java 12次浏览

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

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

示例1: register

点赞 3

import javax.swing.ButtonModel; //导入依赖的package包/类
public static void register(Project project,
                            AntProjectHelper helper,
                            ReferenceHelper refHelper,
                            ListComponent list,
                            ButtonModel addJar,
                            ButtonModel addLibrary, 
                            ButtonModel addAntArtifact,
                            ButtonModel remove, 
                            ButtonModel moveUp,
                            ButtonModel moveDown, 
                            ButtonModel edit,
                            Document libPath,
                            ClassPathUiSupport.Callback callback) {    
    register(project, helper, refHelper, list, addJar, addLibrary, 
            addAntArtifact, remove, moveUp, moveDown, edit, false, libPath,
            callback);
}
 

开发者ID:apache,
项目名称:incubator-netbeans,
代码行数:18,
代码来源:EditMediator.java

示例2: setModel

点赞 3

import javax.swing.ButtonModel; //导入依赖的package包/类
@Override
public void setModel(ButtonModel model) {
    ButtonModel oldModel = getModel();
    if (oldModel != null) {
        oldModel.removeChangeListener(this);
    }

    super.setModel(model);

    ButtonModel newModel = getModel();
    if (newModel != null) {
        newModel.addChangeListener(this);
    }

    stateChanged(null);
}
 

开发者ID:apache,
项目名称:incubator-netbeans,
代码行数:17,
代码来源:ToggleBookmarkAction.java

示例3: getDefaultComponent

点赞 3

import javax.swing.ButtonModel; //导入依赖的package包/类
public Component getDefaultComponent(Container aContainer) {
    Component c = getFirstComponent(aContainer);
    
    if (c instanceof AbstractButton) {
        ButtonModel bm = ((AbstractButton)c).getModel();
        if (bm instanceof DefaultButtonModel) {
            ButtonGroup bg = ((DefaultButtonModel)bm).getGroup();
            Enumeration<AbstractButton> en = bg == null ? null : bg.getElements();
            while (en != null && en.hasMoreElements()) {
                AbstractButton ab = en.nextElement();
                if (ab.isSelected()) return ab;
            }
        }
    }
    
    return c;
}
 

开发者ID:apache,
项目名称:incubator-netbeans,
代码行数:18,
代码来源:ProfilerPopup.java

示例4: getListCellRenderer

点赞 3

import javax.swing.ButtonModel; //导入依赖的package包/类
@Override
@NonNull
public ListCellRenderer getListCellRenderer(
        @NonNull final JList list,
        @NonNull final Document nameDocument,
        @NonNull final ButtonModel caseSensitive,
        @NonNull final ButtonModel colorPrefered) {
    Parameters.notNull("list", list);   //NOI18N
    Parameters.notNull("nameDocument", nameDocument);   //NOI18N
    Parameters.notNull("caseSensitive", caseSensitive); //NOI18N
    return ItemRenderer.Builder.create(
                list,
                caseSensitive,
                new FileDescriptorConvertor(nameDocument)).
            setCamelCaseSeparator(CAMEL_CASE_SEPARATOR).
            setColorPreferedProject(colorPrefered).
            build();
}
 

开发者ID:apache,
项目名称:incubator-netbeans,
代码行数:19,
代码来源:FileSearchAction.java

示例5: testSetLocalizedTextWithModel

点赞 3

import javax.swing.ButtonModel; //导入依赖的package包/类
public void testSetLocalizedTextWithModel() throws Exception {
    ButtonModel m = new DefaultButtonModel();
    JButton b = new JButton();
    Mnemonics.setLocalizedText(b, "Hello &There");
    assertEquals("Hello There", b.getText());
    if( Mnemonics.isAquaLF() ) {
        assertEquals(0, b.getMnemonic());
        assertEquals(-1, b.getDisplayedMnemonicIndex());
    } else {
        assertEquals('T', b.getMnemonic());
        assertEquals(6, b.getDisplayedMnemonicIndex());
    }
    b.setModel(m);
    assertEquals("Hello There", b.getText());
    if( Mnemonics.isAquaLF() ) {
        assertEquals(0, b.getMnemonic());
        assertEquals(-1, b.getDisplayedMnemonicIndex());
    } else {
        assertEquals('T', b.getMnemonic());
        assertEquals(6, b.getDisplayedMnemonicIndex());
    }
}
 

开发者ID:apache,
项目名称:incubator-netbeans,
代码行数:23,
代码来源:MnemonicsTest.java

示例6: paintIcon

点赞 3

import javax.swing.ButtonModel; //导入依赖的package包/类
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
	JMenuItem b = (JMenuItem) c;
	ButtonModel model = b.getModel();

	g.translate(x, y);

	boolean isSelected = model.isSelected();
	boolean isEnabled = model.isEnabled();

	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	// draw check mark
	if (isSelected) {
		g2.setStroke(CHECKBOX_STROKE);
		if (isEnabled) {
			g2.setColor(Colors.CHECKBOX_CHECKED);
		} else {
			g2.setColor(Colors.CHECKBOX_CHECKED_DISABLED);
		}
		g2.drawLine(2, 6, 5, 8);
		g2.drawLine(5, 8, 9, 1);
	}
	g.translate(-x, -y);
}
 

开发者ID:transwarpio,
项目名称:rapidminer,
代码行数:27,
代码来源:CheckBoxMenuItemIcon.java

示例7: getStyle

点赞 3

import javax.swing.ButtonModel; //导入依赖的package包/类
@Nonnull
@CheckReturnValue
public Style getStyle() {
    final ButtonModel selected = styleGroup.getSelection();
    return getStyleButtonStream()
            .filter(button -> {
                final ButtonModel model = button.getModel();
                return model.equals(selected);
            })
            .map(button -> {
                final String name = button.getText();
                return Style.fromName(name, Style.NONE);
            })
            .findFirst()
            .orElse(Style.NONE);
}
 

开发者ID:t28hub,
项目名称:json2java4idea,
代码行数:17,
代码来源:SettingsPanel.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)