All pastes #278473 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-12-14 02:52 UTC
rendered paste body

import com.ms.arga.common.*;
import com.ms.arga.sal.*;
import javax.swing.*;
import java.awt.FlowLayout;
import java.awt.event.*;

public class PathCreator extends SALScript {

	public String getName() { return "PathCreator"; }
	
	
	public boolean sstart() {
		initComponents();
		return true;
	}
	
	public int cycle() {
		curPos = getPosition(getMyPlayer());
		jPos.setText("Current Position: " + curPos.toString());
		return 35;
	}
	
	private void initComponents() {
		frame = new JFrame("PathCreator by RsN");
		frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		frame.setLayout(new FlowLayout());
		
		frame.add(jPos);
		frame.add(jAdd);
		jText.setLineWrap(true);
		frame.add(new JScrollPane(jText));
		
		jAdd.addActionListener(new ActionListener(){ 
			public void actionPerformed(ActionEvent evt) {
				if(curPos != null) 
						jText.append("new Tile" + curPos.toString() + ", ");
			}
		});
		
		frame.setSize(320, 140);
		frame.setResizable(false);
		frame.setVisible(true);
	}
			
	private JFrame frame;
	private JLabel jPos = new JLabel("No current Position");
	private JTextArea jText = new JTextArea(4, 20);
	private JButton jAdd = new JButton("Add to Path");
	private Tile curPos = new Tile(35000, 35000);

}