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

Java CheckboxSetting类的典型用法和代码示例

java 4次浏览

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

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

示例1: call

点赞 2

import net.wurstclient.settings.CheckboxSetting; //导入依赖的package包/类
@Override
public void call(String[] args) throws CmdException
{
	if(args.length != 3)
		throw new CmdSyntaxError();
	
	// find feature
	Feature feature = null;
	String featureName = args[0];
	for(Iterator itr = wurst.navigator.iterator(); itr.hasNext();)
	{
		Feature item = (Feature)itr.next();
		if(featureName.equalsIgnoreCase(item.getName()))
		{
			feature = item;
			break;
		}
	}
	if(feature == null)
		throw new CmdError(
			"A feature named \"" + featureName + "\" could not be found.");
	
	// find setting
	Setting setting = null;
	String settingName = args[1].replace("_", " ");
	for(Setting featureSetting : feature.getSettings())
		if(featureSetting.getName().equalsIgnoreCase(settingName))
		{
			setting = featureSetting;
			break;
		}
	if(setting == null)
		throw new CmdError("A setting named \"" + settingName
			+ "\" could not be found in " + feature.getName() + ".");
	
	// check that setting is checkbox setting
	if(!(setting instanceof CheckboxSetting))
		throw new CmdError(feature.getName() + " " + setting.getName()
			+ " is not a checkbox setting.");
	CheckboxSetting checkboxSetting = (CheckboxSetting)setting;
	
	// set check
	String valueName = args[2];
	if(valueName.equalsIgnoreCase("on"))
		checkboxSetting.setChecked(true);
	else if(valueName.equalsIgnoreCase("off"))
		checkboxSetting.setChecked(false);
	else if(valueName.equalsIgnoreCase("toggle"))
		checkboxSetting.toggle();
	else
		throw new CmdSyntaxError();
}
 

开发者ID:Wurst-Imperium,
项目名称:Wurst-MC-1.12,
代码行数:53,
代码来源:SetCheckboxCmd.java

示例2: Checkbox

点赞 2

import net.wurstclient.settings.CheckboxSetting; //导入依赖的package包/类
public Checkbox(CheckboxSetting setting)
{
	this.setting = setting;
	setWidth(getDefaultWidth());
	setHeight(getDefaultHeight());
}
 

开发者ID:Wurst-Imperium,
项目名称:Wurst-MC-1.12,
代码行数:7,
代码来源:Checkbox.java

示例3: onMouseClick

点赞 2

import net.wurstclient.settings.CheckboxSetting; //导入依赖的package包/类
@Override
protected void onMouseClick(int x, int y, int button)
{
	Rectangle area = new Rectangle(width / 2 - 154, 60, 308, height - 103);
	if(!area.contains(x, y))
		return;
	
	// buttons
	if(activeButton != null)
	{
		WSoundEvents.playButtonClick();
		activeButton.press();
		WurstClient.INSTANCE.navigator.addPreference(feature.getName());
		ConfigFiles.NAVIGATOR.save();
		return;
	}
	
	// sliders
	area.height = 12;
	for(int i = 0; i < sliders.size(); i++)
	{
		area.y = sliders.get(i).getY() + scroll;
		if(area.contains(x, y))
		{
			sliding = i;
			return;
		}
	}
	
	// checkboxes
	for(int i = 0; i < checkboxes.size(); i++)
	{
		CheckboxSetting checkbox = checkboxes.get(i);
		area.y = checkbox.getY() + scroll;
		if(area.contains(x, y))
		{
			checkbox.toggle();
			WurstClient wurst = WurstClient.INSTANCE;
			wurst.navigator.addPreference(feature.getName());
			ConfigFiles.NAVIGATOR.save();
			return;
		}
	}
}
 

开发者ID:Wurst-Imperium,
项目名称:Wurst-MC-1.12,
代码行数:45,
代码来源:NavigatorFeatureScreen.java

示例4: addCheckbox

点赞 2

import net.wurstclient.settings.CheckboxSetting; //导入依赖的package包/类
public void addCheckbox(CheckboxSetting checkbox)
{
	checkboxes.add(checkbox);
}
 

开发者ID:Wurst-Imperium,
项目名称:Wurst-MC-1.12,
代码行数:5,
代码来源:NavigatorFeatureScreen.java


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