本文整理汇总了Java中org.darkstorm.minecraft.gui.component.Slider.setValueChanging方法的典型用法代码示例。如果您正苦于以下问题:Java Slider.setValueChanging方法的具体用法?Java Slider.setValueChanging怎么用?Java Slider.setValueChanging使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.darkstorm.minecraft.gui.component.Slider
的用法示例。
在下文中一共展示了Slider.setValueChanging方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleComponentUpdate
import org.darkstorm.minecraft.gui.component.Slider; //导入方法依赖的package包/类
@Override
protected void handleComponentUpdate(Slider component) {
if (component.isValueChanging()) {
if (!Mouse.isButtonDown(0)) {
component.setValueChanging(false);
WurstClient.INSTANCE.files.saveNavigatorData();
return;
}
Point mouse = RenderUtil.calculateMouseLocation();
Container parent = component.getParent();
if (parent != null) mouse.translate(-parent.getX(), -parent.getY());
double percent = (double) (mouse.x - 4) / (double) (component.getWidth() - 6);
double value =
component.getMinimumValue() + percent * (component.getMaximumValue() - component.getMinimumValue());
component.setValue(value);
}
}
示例2: handleComponentUpdate
import org.darkstorm.minecraft.gui.component.Slider; //导入方法依赖的package包/类
@Override
protected void handleComponentUpdate(Slider component) {
if (component.isValueChanging()) {
if (!Mouse.isButtonDown(0)) {
component.setValueChanging(false);
return;
}
Point mouse = RenderUtil.calculateMouseLocation();
Container parent = component.getParent();
if (parent != null) mouse.translate(-parent.getX(), -parent.getY());
double percent = (double) mouse.x / (double) component.getWidth();
double value =
component.getMinimumValue() + percent * (component.getMaximumValue() - component.getMinimumValue());
component.setValue(value);
}
}
示例3: handleComponentInteraction
import org.darkstorm.minecraft.gui.component.Slider; //导入方法依赖的package包/类
@Override
protected void handleComponentInteraction(Slider component, Point location, int button) {
if (getInteractableComponentRegions(component)[0].contains(location) && button == 0) {
if (Mouse.isButtonDown(button) && !component.isValueChanging()) {
component.setValueChanging(true);
} else if (!Mouse.isButtonDown(button) && component.isValueChanging()) component.setValueChanging(false);
}
}