本文整理汇总了Java中me.ichun.mods.ichunutil.common.core.config.annotations.IntMinMax类的典型用法代码示例。如果您正苦于以下问题:Java IntMinMax类的具体用法?Java IntMinMax怎么用?Java IntMinMax使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntMinMax类属于me.ichun.mods.ichunutil.common.core.config.annotations包,在下文中一共展示了IntMinMax类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Tree
import me.ichun.mods.ichunutil.common.core.config.annotations.IntMinMax; //导入依赖的package包/类
public Tree(ConfigBase conf, ConfigBase.PropInfo obj, int h)
{
config = conf;
propInfo = obj;
theHeight = h;
try
{
obj.field.setAccessible(true);
Class clz = obj.field.getType();
if(clz.equals(int.class) || clz.equals(Integer.class))
{
int[] minmax = new int[] { Integer.MIN_VALUE, Integer.MAX_VALUE };
if(obj.field.isAnnotationPresent(IntMinMax.class))
{
IntMinMax minMax = obj.field.getAnnotation(IntMinMax.class);
minmax[0] = minMax.min();
minmax[1] = minMax.max();
element = new ElementNumberInput(parent, 0, 0, 200, 12, 0, "", 1, false, minmax[0], minmax[1], obj.field.getInt(conf));
}
else if(obj.field.isAnnotationPresent(IntBool.class))
{
element = new ElementToggle(parent, 0, 0, 0, 12, 0, false, 0, 0, "gui.yes", null, obj.field.getInt(conf) == 1);
}
else
{
element = new ElementNumberInput(parent, 0, 0, 200, 12, 0, "", 1, false, minmax[0], minmax[1], obj.field.getInt(conf));
}
}
else if(clz.equals(Colour.class))
{
element = new ElementTextInput(parent, 0, 0, 40, 12, 0, "", Integer.toHexString(((Colour)obj.field.get(conf)).getColour())); //last arg is current text
((ElementTextInput)element).textField.setMaxStringLength(6);
}
else if(clz.equals(String.class))
{
element = new ElementTextInput(parent, 0, 0, 40, 12, 0, "", (String)obj.field.get(conf)); //last arg is current text
}
else if(clz.equals(KeyBind.class))
{
element = new ElementButton(parent, 0, 0, 0, 12, 0, false, 0, 0, "");
}
else if(clz.equals(String[].class) || clz.equals(int[].class) || clz.equals(NestedIntArray.class))
{
element = new ElementButton(parent, 0, 0, 0, 12, 0, false, 0, 0, "Set");
}
}
catch(Exception ignored)
{
}
}