本文整理汇总了Java中org.newdawn.slick.particles.ConfigurableEmitter.getImageName方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableEmitter.getImageName方法的具体用法?Java ConfigurableEmitter.getImageName怎么用?Java ConfigurableEmitter.getImageName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.particles.ConfigurableEmitter
的用法示例。
在下文中一共展示了ConfigurableEmitter.getImageName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: linkEmitterToFields
import org.newdawn.slick.particles.ConfigurableEmitter; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.tools.peditor.ControlPanel#linkEmitterToFields(org.newdawn.slick.particles.ConfigurableEmitter)
*/
protected void linkEmitterToFields(ConfigurableEmitter emitter) {
name.setText(emitter.name);
String value = emitter.getImageName();
if (value != null) {
value = value.substring(value.lastIndexOf(File.separatorChar)+1);
imageName.setText(value);
}
link(emitter.gravityFactor, "gravity");
link(emitter.windFactor, "wind");
}
示例2: importEmitter
import org.newdawn.slick.particles.ConfigurableEmitter; //导入方法依赖的package包/类
/**
* Import an emitter XML file
*/
public void importEmitter() {
chooser.setDialogTitle("Open");
int resp = chooser.showOpenDialog(this);
if (resp == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
File path = file.getParentFile();
try {
final ConfigurableEmitter emitter = ParticleIO.loadEmitter(file);
if (emitter.getImageName() != null) {
File possible = new File(path, emitter.getImageName());
if (possible.exists()) {
emitter.setImageName(possible.getAbsolutePath());
} else {
chooser.setDialogTitle("Locate the image: "+emitter.getImageName());
resp = chooser.showOpenDialog(this);
FileFilter filter = new FileFilter() {
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
return (f.getName().equals(emitter.getImageName()));
}
public String getDescription() {
return emitter.getImageName();
}
};
chooser.addChoosableFileFilter(filter);
if (resp == JFileChooser.APPROVE_OPTION) {
File image = chooser.getSelectedFile();
emitter.setImageName(image.getAbsolutePath());
path = image.getParentFile();
}
chooser.resetChoosableFileFilters();
chooser.addChoosableFileFilter(xmlFileFilter);
}
}
addEmitter(emitter);
emitters.setSelected(emitter);
} catch (IOException e) {
Log.error(e);
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
}
示例3: loadSystem
import org.newdawn.slick.particles.ConfigurableEmitter; //导入方法依赖的package包/类
/**
* Load a complete particle system XML description
*/
public void loadSystem() {
chooser.setDialogTitle("Open");
int resp = chooser.showOpenDialog(this);
if (resp == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
File path = file.getParentFile();
try {
ParticleSystem system = ParticleIO.loadConfiguredSystem(file);
game.setSystem(system);
emitters.clear();
for (int i=0;i<system.getEmitterCount();i++) {
final ConfigurableEmitter emitter = (ConfigurableEmitter) system.getEmitter(i);
if (emitter.getImageName() != null) {
File possible = new File(path, emitter.getImageName());
if (possible.exists()) {
emitter.setImageName(possible.getAbsolutePath());
} else {
chooser.setDialogTitle("Locate the image: "+emitter.getImageName());
FileFilter filter = new FileFilter() {
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
return (f.getName().equals(emitter.getImageName()));
}
public String getDescription() {
return emitter.getImageName();
}
};
chooser.addChoosableFileFilter(filter);
resp = chooser.showOpenDialog(this);
if (resp == JFileChooser.APPROVE_OPTION) {
File image = chooser.getSelectedFile();
emitter.setImageName(image.getAbsolutePath());
path = image.getParentFile();
}
chooser.setDialogTitle("Open");
chooser.resetChoosableFileFilters();
chooser.addChoosableFileFilter(xmlFileFilter);
}
}
emitters.add(emitter);
}
additive.setSelected(system.getBlendingMode() == ParticleSystem.BLEND_ADDITIVE);
pointsEnabled.setSelected(system.usePoints());
emitters.setSelected(0);
} catch (IOException e) {
Log.error(e);
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
}