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


Java ComboBox类代码示例

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


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

示例1: handleComponentInteraction

import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
@Override
protected void handleComponentInteraction(ComboBox component, Point location, int button) {
    if (button != 0) return;
    if (location.x <= component.getWidth() && location.y <= component.getHeight()) {
        component.setSelected(!component.isSelected());
    } else if (location.x <= component.getWidth() && component.isSelected()) {
        int offset = component.getHeight() + 2;
        String[] elements = component.getElements();
        for (int i = 0; i < elements.length; i++) {
            if (i == component.getSelectedIndex()) continue;
            if (location.y >= offset && location.y <= offset + theme.getFontRenderer().FONT_HEIGHT) {
                component.setSelectedIndex(i);
                component.setSelected(false);
                WurstClient.INSTANCE.files.saveOptions();
                break;
            }
            offset += theme.getFontRenderer().FONT_HEIGHT + 2;
        }
    }
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:21,代码来源:WurstComboBoxUI.java

示例2: handleComponentInteraction

import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
@Override
protected void handleComponentInteraction(ComboBox component, Point location, int button) {
    if (button != 0) return;
    if (location.x <= component.getWidth() && location.y <= component.getHeight()) {
        component.setSelected(!component.isSelected());
    } else if (location.x <= component.getWidth() && component.isSelected()) {
        int offset = component.getHeight() + 2;
        String[] elements = component.getElements();
        for (int i = 0; i < elements.length; i++) {
            if (i == component.getSelectedIndex()) continue;
            if (location.y >= offset && location.y <= offset + theme.getFontRenderer().FONT_HEIGHT) {
                component.setSelectedIndex(i);
                component.setSelected(false);
                break;
            }
            offset += theme.getFontRenderer().FONT_HEIGHT + 2;
        }
    }
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:20,代码来源:SimpleComboBoxUI.java

示例3: WurstComboBoxUI

import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
WurstComboBoxUI(WurstTheme theme) {
    super(ComboBox.class);
    this.theme = theme;

    foreground = Color.WHITE;
    background = new Color(64, 64, 64, 128);
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:8,代码来源:WurstComboBoxUI.java

示例4: getDefaultComponentSize

import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
@Override
protected Dimension getDefaultComponentSize(ComboBox component) {
    int maxWidth = 0;
    for (String element : component.getElements()) {
        maxWidth = Math.max(maxWidth, theme.getFontRenderer().getStringWidth(element));
    }
    return new Dimension(maxWidth + 8 + theme.getFontRenderer().FONT_HEIGHT,
            theme.getFontRenderer().FONT_HEIGHT + 4);
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:10,代码来源:WurstComboBoxUI.java

示例5: getInteractableComponentRegions

import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
@Override
protected Rectangle[] getInteractableComponentRegions(ComboBox component) {
    int height = component.getHeight();
    if (component.isSelected()) {
        for (int i = 0; i < component.getElements().length; i++) {
            height += theme.getFontRenderer().FONT_HEIGHT + 2;
        }
        height += 2;
    }
    return new Rectangle[]{new Rectangle(0, 0, component.getWidth(), height)};
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:12,代码来源:WurstComboBoxUI.java

示例6: SimpleComboBoxUI

import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
SimpleComboBoxUI(SimpleTheme theme) {
    super(ComboBox.class);
    this.theme = theme;

    foreground = Color.WHITE;
    background = new Color(128, 128, 128, 128 + 128 / 2);
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:8,代码来源:SimpleComboBoxUI.java

示例7: getInteractableComponentRegions

import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
@Override
protected Rectangle[] getInteractableComponentRegions(ComboBox component) {
    int height = component.getHeight();
    if (component.isSelected()) {
        String[] elements = component.getElements();
        for (@SuppressWarnings("unused") String element : elements) {
            height += theme.getFontRenderer().FONT_HEIGHT + 2;
        }
        height += 2;
    }
    return new Rectangle[]{new Rectangle(0, 0, component.getWidth(), height)};
}
 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:13,代码来源:SimpleComboBoxUI.java

示例8: onComboBoxSelectionChanged

import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
public void onComboBoxSelectionChanged(ComboBox comboBox); 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:2,代码来源:ComboBoxListener.java

示例9: onComboBoxSelectionChanged

import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
void onComboBoxSelectionChanged(ComboBox comboBox); 
开发者ID:null-dev,项目名称:EvenWurse,代码行数:2,代码来源:ComboBoxListener.java


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