本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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);
}
示例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);
}
示例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)};
}
示例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);
}
示例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)};
}
示例8: onComboBoxSelectionChanged
import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
public void onComboBoxSelectionChanged(ComboBox comboBox);
示例9: onComboBoxSelectionChanged
import org.darkstorm.minecraft.gui.component.ComboBox; //导入依赖的package包/类
void onComboBoxSelectionChanged(ComboBox comboBox);