final UIFrame frame = new UIFrame("Controls", EnumSet.noneOf(FrameButtons.class));
frame.setResizeable(false);
final UILabel turnLabel = new UILabel("Turn Speed: " + ROCKET_TURN_SPEED);
final UISlider turnSlider = new UISlider(Orientation.Horizontal, 0, 250, (int) (ROCKET_TURN_SPEED * 10));
turnSlider.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent event) {
ROCKET_TURN_SPEED = turnSlider.getValue() / 10;
turnLabel.setText("Turn Speed: " + ROCKET_TURN_SPEED);
}
});
final UILabel propelLabel = new UILabel("Propel Speed: " + ROCKET_PROPEL_SPEED);
final UISlider propelSlider = new UISlider(Orientation.Horizontal, 0, 250, (int) (ROCKET_PROPEL_SPEED));
propelSlider.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent event) {
ROCKET_PROPEL_SPEED = propelSlider.getValue();
propelLabel.setText("Propel Speed: " + ROCKET_PROPEL_SPEED);
}
});
final UILabel ageLabel = new UILabel("Max Age of Smoke: " + age + " ms");
final UISlider ageSlider = new UISlider(Orientation.Horizontal, 25, 400, age / 10);
ageSlider.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent event) {
age = ageSlider.getValue() * 10;
ageLabel.setText("Max Age of Smoke: " + age + " ms");
smoke.setMaximumLifeTime(age);
smoke.setMinimumLifeTime(age / 2);
}
});
final UICheckBox twoDimCheck = new UICheckBox("Constrain Rocket to 2D Plane.");
twoDimCheck.setSelected(stayIn2DPlane);
twoDimCheck.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent event) {
stayIn2DPlane = twoDimCheck.isSelected();
}
});
final UICheckBox worldCoordsCheck = new UICheckBox("Particles are in world coords");
worldCoordsCheck.setSelected(particleInWorld);
worldCoordsCheck.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent event) {
particleInWorld = worldCoordsCheck.isSelected();
smoke.setParticlesInWorldCoords(particleInWorld);
}