gdx-studio

#libgdx#java#desktop

git clone https://git.pyrossh.dev/gdx-studio

An IDE for creating Games using libgdx and Java supported on all platforms Android, iOS, Desktop


src_libs/com/badlogic/gdx/tools/particleeditor/CountPanel.java
a62d533 1
/*******************************************************************************
a62d533 2
 * Copyright 2011 See AUTHORS file.
a62d533 3
 * 
a62d533 4
 * Licensed under the Apache License, Version 2.0 (the "License");
a62d533 5
 * you may not use this file except in compliance with the License.
a62d533 6
 * You may obtain a copy of the License at
a62d533 7
 * 
a62d533 8
 *   http://www.apache.org/licenses/LICENSE-2.0
a62d533 9
 * 
a62d533 10
 * Unless required by applicable law or agreed to in writing, software
a62d533 11
 * distributed under the License is distributed on an "AS IS" BASIS,
a62d533 12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
a62d533 13
 * See the License for the specific language governing permissions and
a62d533 14
 * limitations under the License.
a62d533 15
 ******************************************************************************/
a62d533 16
a62d533 17
package com.badlogic.gdx.tools.particleeditor;
a62d533 18
a62d533 19
import java.awt.GridBagConstraints;
a62d533 20
import java.awt.Insets;
a62d533 21
a62d533 22
import javax.swing.JLabel;
a62d533 23
import javax.swing.JPanel;
a62d533 24
import javax.swing.event.ChangeEvent;
a62d533 25
import javax.swing.event.ChangeListener;
a62d533 26
a62d533 27
class CountPanel extends EditorPanel {
a62d533 28
	Slider maxSlider, minSlider;
a62d533 29
a62d533 30
	public CountPanel (final ParticlePanel editor, String name, String description) {
a62d533 31
		super(null, name, description);
a62d533 32
a62d533 33
		initializeComponents();
a62d533 34
a62d533 35
		maxSlider.setValue(editor.getEmitter().getMaxParticleCount());
a62d533 36
		maxSlider.addChangeListener(new ChangeListener() {
a62d533 37
			public void stateChanged (ChangeEvent event) {
a62d533 38
				editor.getEmitter().setMaxParticleCount((int)maxSlider.getValue());
a62d533 39
			}
a62d533 40
		});
a62d533 41
a62d533 42
		minSlider.setValue(editor.getEmitter().getMinParticleCount());
a62d533 43
		minSlider.addChangeListener(new ChangeListener() {
a62d533 44
			public void stateChanged (ChangeEvent event) {
a62d533 45
				editor.getEmitter().setMinParticleCount((int)minSlider.getValue());
a62d533 46
			}
a62d533 47
		});
a62d533 48
	}
a62d533 49
a62d533 50
	private void initializeComponents () {
a62d533 51
		JPanel contentPanel = getContentPanel();
a62d533 52
		{
a62d533 53
			JLabel label = new JLabel("Min:");
a62d533 54
			contentPanel.add(label, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
a62d533 55
				new Insets(0, 0, 0, 6), 0, 0));
a62d533 56
		}
a62d533 57
		{
a62d533 58
			minSlider = new Slider(0, 0, 99999, 1, 0, 500);
a62d533 59
			contentPanel.add(minSlider, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
a62d533 60
				new Insets(0, 0, 0, 0), 0, 0));
a62d533 61
		}
a62d533 62
		{
a62d533 63
			JLabel label = new JLabel("Max:");
a62d533 64
			contentPanel.add(label, new GridBagConstraints(2, 1, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE,
a62d533 65
				new Insets(0, 12, 0, 6), 0, 0));
a62d533 66
		}
a62d533 67
		{
a62d533 68
			maxSlider = new Slider(0, 0, 99999, 1, 0, 500);
a62d533 69
			contentPanel.add(maxSlider, new GridBagConstraints(3, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
a62d533 70
				new Insets(0, 0, 0, 0), 0, 0));
a62d533 71
		}
a62d533 72
	}
a62d533 73
}