本文整理汇总了Java中org.newdawn.slick.font.effects.ConfigurableEffect.Value类的典型用法代码示例。如果您正苦于以下问题:Java Value类的具体用法?Java Value怎么用?Java Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Value类属于org.newdawn.slick.font.effects.ConfigurableEffect包,在下文中一共展示了Value类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
/**
* Saves the settings to a file.
*
* @param file The file we're saving to
* @throws IOException if the file could not be saved.
*/
public void save(File file) throws IOException {
PrintStream out = new PrintStream(new FileOutputStream(file));
out.println("font.size=" + fontSize);
out.println("font.bold=" + bold);
out.println("font.italic=" + italic);
out.println();
out.println("pad.top=" + paddingTop);
out.println("pad.right=" + paddingRight);
out.println("pad.bottom=" + paddingBottom);
out.println("pad.left=" + paddingLeft);
out.println("pad.advance.x=" + paddingAdvanceX);
out.println("pad.advance.y=" + paddingAdvanceY);
out.println();
out.println("glyph.page.width=" + glyphPageWidth);
out.println("glyph.page.height=" + glyphPageHeight);
out.println();
for (Iterator iter = effects.iterator(); iter.hasNext();) {
ConfigurableEffect effect = (ConfigurableEffect)iter.next();
out.println("effect.class=" + effect.getClass().getName());
for (Iterator iter2 = effect.getValues().iterator(); iter2.hasNext();) {
Value value = (Value)iter2.next();
out.println("effect." + value.getName() + "=" + value.getString());
}
out.println();
}
out.close();
}
示例2: colorValue
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
/**
* Prompts the user for a colour value
*
* @param name Thename of the value being configured
* @param currentValue The default value that should be selected
* @return The value selected
*/
static public Value colorValue(String name, Color currentValue) {
return new DefaultValue(name, EffectUtil.toString(currentValue)) {
public void showDialog () {
Color newColor = JColorChooser.showDialog(null, "Choose a color", EffectUtil.fromString(value));
if (newColor != null) value = EffectUtil.toString(newColor);
}
public Object getObject () {
return EffectUtil.fromString(value);
}
};
}
示例3: intValue
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
/**
* Prompts the user for int value
*
* @param name The name of the dialog to show
* @param currentValue The current value to be displayed
* @param description The help text to provide
* @return The value selected by the user
*/
static public Value intValue (String name, final int currentValue, final String description) {
return new DefaultValue(name, String.valueOf(currentValue)) {
public void showDialog () {
JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, Short.MIN_VALUE, Short.MAX_VALUE, 1));
if (showValueDialog(spinner, description)) value = String.valueOf(spinner.getValue());
}
public Object getObject () {
return Integer.valueOf(value);
}
};
}
示例4: floatValue
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
/**
* Prompts the user for float value
*
* @param name The name of the dialog to show
* @param currentValue The current value to be displayed
* @param description The help text to provide
* @param min The minimum value to allow
* @param max The maximum value to allow
* @return The value selected by the user
*/
static public Value floatValue (String name, final float currentValue, final float min, final float max,
final String description) {
return new DefaultValue(name, String.valueOf(currentValue)) {
public void showDialog () {
JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, min, max, 0.1f));
if (showValueDialog(spinner, description)) value = String.valueOf(((Double)spinner.getValue()).floatValue());
}
public Object getObject () {
return Float.valueOf(value);
}
};
}
示例5: booleanValue
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
/**
* Prompts the user for boolean value
*
* @param name The name of the dialog to show
* @param currentValue The current value to be displayed
* @param description The help text to provide
* @return The value selected by the user
*/
static public Value booleanValue (String name, final boolean currentValue, final String description) {
return new DefaultValue(name, String.valueOf(currentValue)) {
public void showDialog () {
JCheckBox checkBox = new JCheckBox();
checkBox.setSelected(currentValue);
if (showValueDialog(checkBox, description)) value = String.valueOf(checkBox.isSelected());
}
public Object getObject () {
return Boolean.valueOf(value);
}
};
}
示例6: updateValues
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
public void updateValues () {
prefs.put("foreground", EffectUtil.toString(colorEffect.getColor()));
valuesPanel.removeAll();
values = effect.getValues();
for (Iterator iter = values.iterator(); iter.hasNext();)
addValue((Value)iter.next());
}
示例7: save
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
/**
* Saves the settings to a file.
*
* @param file The file we're saving to
* @throws IOException if the file could not be saved.
* @throws SlickException if effect from effects is not ConfigurableEffect
*/
public void save(@Nonnull File file) throws SlickException, IOException {
try(
final FileOutputStream fileOutputStream = new FileOutputStream(file);
final PrintStream out = new PrintStream(fileOutputStream)
) {
out.println("font.size=" + fontSize);
out.println("font.bold=" + bold);
out.println("font.italic=" + italic);
out.println();
out.println("pad.top=" + paddingTop);
out.println("pad.right=" + paddingRight);
out.println("pad.bottom=" + paddingBottom);
out.println("pad.left=" + paddingLeft);
out.println("pad.advance.x=" + paddingAdvanceX);
out.println("pad.advance.y=" + paddingAdvanceY);
out.println();
out.println("glyph.page.width=" + glyphPageWidth);
out.println("glyph.page.height=" + glyphPageHeight);
out.println();
for (Iterator<Effect> iter = effects.iterator(); iter.hasNext();) {
if(!(iter.next() instanceof ConfigurableEffect)) {
throw new SlickException("Effect is not org.newdawn.slick.font.effects.ConfigurableEffect");
}
ConfigurableEffect effect = (ConfigurableEffect) iter.next();
out.println("effect.class=" + effect.getClass().getName());
for (Value value : effect.getValues()) {
out.println("effect." + value.getName() + "=" + value.getString());
}
out.println();
}
}
}
示例8: colorValue
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
/**
* Prompts the user for a colour value
*
* @param name Thename of the value being configured
* @param currentValue The default value that should be selected
* @return The value selected
*/
@Nullable
static public Value colorValue(String name, @Nullable Color currentValue) {
return new DefaultValue(name, EffectUtil.toString(currentValue)) {
public void showDialog () {
Color newColor = JColorChooser.showDialog(null, "Choose a color", EffectUtil.fromString(value));
if (newColor != null) value = EffectUtil.toString(newColor);
}
public Object getObject () {
return EffectUtil.fromString(value);
}
};
}
示例9: intValue
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
/**
* Prompts the user for int value
*
* @param name The name of the dialog to show
* @param currentValue The current value to be displayed
* @param description The help text to provide
* @return The value selected by the user
*/
@Nonnull
static public Value intValue (String name, final int currentValue, final String description) {
return new DefaultValue(name, String.valueOf(currentValue)) {
public void showDialog () {
JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, Short.MIN_VALUE, Short.MAX_VALUE, 1));
if (showValueDialog(spinner, description)) value = String.valueOf(spinner.getValue());
}
public Object getObject () {
return Integer.valueOf(value);
}
};
}
示例10: floatValue
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
/**
* Prompts the user for float value
*
* @param name The name of the dialog to show
* @param currentValue The current value to be displayed
* @param description The help text to provide
* @param min The minimum value to allow
* @param max The maximum value to allow
* @return The value selected by the user
*/
@Nonnull
static public Value floatValue (String name, final float currentValue, final float min, final float max,
final String description) {
return new DefaultValue(name, String.valueOf(currentValue)) {
public void showDialog () {
JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, min, max, 0.1f));
if (showValueDialog(spinner, description)) value = String.valueOf(((Double)spinner.getValue()).floatValue());
}
public Object getObject () {
return Float.valueOf(value);
}
};
}
示例11: booleanValue
import org.newdawn.slick.font.effects.ConfigurableEffect.Value; //导入依赖的package包/类
/**
* Prompts the user for boolean value
*
* @param name The name of the dialog to show
* @param currentValue The current value to be displayed
* @param description The help text to provide
* @return The value selected by the user
*/
@Nonnull
static public Value booleanValue (String name, final boolean currentValue, final String description) {
return new DefaultValue(name, String.valueOf(currentValue)) {
public void showDialog () {
JCheckBox checkBox = new JCheckBox();
checkBox.setSelected(currentValue);
if (showValueDialog(checkBox, description)) value = String.valueOf(checkBox.isSelected());
}
public Object getObject () {
return Boolean.valueOf(value);
}
};
}