Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- import javax.swing.border.EmptyBorder;
- import javax.swing.JList;
- import javax.swing.JSlider;
- import javax.swing.JCheckBox;
- import javax.swing.AbstractListModel;
- import javax.swing.JButton;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import javax.swing.JLabel;
- import javax.swing.SwingConstants;
- import java.awt.Font;
- import java.awt.Color;
- import java.awt.Panel;
- import javax.swing.ImageIcon;
- import java.awt.Toolkit;
- @SuppressWarnings("serial")
- public class SuperheaterUI extends JFrame {
- boolean start = false;
- JCheckBox chckbxAntiban, boxCenter, boxNorth, boxSouth, boxEast, boxWest;
- JSlider slider;
- JLabel lblMouseSpeed;
- Panel panel;
- @SuppressWarnings("rawtypes")
- JList list;
- JPanel contentPane;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- SuperheaterUI frame = new SuperheaterUI();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- @SuppressWarnings({ "rawtypes", "unchecked", "serial" })
- public SuperheaterUI() {
- setIconImage(Toolkit.getDefaultToolkit().getImage(SuperheaterUI.class.getResource("/resources/settings.png")));
- setTitle("Settings");
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 250, 305);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- setContentPane(contentPane);
- contentPane.setLayout(null);
- list = new JList();
- list.setBackground(Color.WHITE);
- list.setBounds(168, 36, 56, 128);
- list.setModel(new AbstractListModel() {
- String[] values = new String[] {" Bronze", " Iron", " Steel", " Silver", " Gold", " Mithril", " Adamant", " Rune"};
- public int getSize() {
- return values.length;
- }
- public Object getElementAt(int index) {
- return values[index];
- }
- });
- contentPane.add(list);
- JCheckBox chckbxNewCheckBox = new JCheckBox("Fire Staff");
- chckbxNewCheckBox.setBounds(10, 36, 71, 23);
- chckbxNewCheckBox.setEnabled(false);
- chckbxNewCheckBox.setSelected(true);
- contentPane.add(chckbxNewCheckBox);
- slider = new JSlider();
- slider.setPaintTicks(true);
- slider.setToolTipText("Mosue Speed");
- slider.setBounds(0, 200, 234, 27);
- slider.setValue(5);
- slider.setMaximum(9);
- slider.setMinimum(1);
- contentPane.add(slider);
- JButton btnNewButton = new JButton("Start");
- btnNewButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- Color c = Color.white;
- if (list.getSelectedIndex() == -1)
- list.setBackground(Color.orange);
- else
- list.setBackground(Color.WHITE);
- if (!(boxNorth.isSelected() || boxSouth.isSelected() || boxEast.isSelected() || boxWest.isSelected()))
- c = Color.orange;
- panel.setBackground(c);
- boxCenter.setBackground(c);
- boxNorth.setBackground(c);
- boxSouth.setBackground(c);
- boxEast.setBackground(c);
- boxWest.setBackground(c);
- if (list.getSelectedIndex() != -1 && (boxNorth.isSelected() || boxSouth.isSelected() || boxEast.isSelected() || boxWest.isSelected())){
- start = true;
- dispose();
- }
- }
- });
- btnNewButton.setBounds(75, 233, 89, 23);
- contentPane.add(btnNewButton);
- lblMouseSpeed = new JLabel("Mouse Speed:");
- lblMouseSpeed.setHorizontalAlignment(SwingConstants.CENTER);
- lblMouseSpeed.setBounds(0, 175, 219, 14);
- contentPane.add(lblMouseSpeed);
- JLabel lblNewLabel = new JLabel("Nissan's Superheater");
- lblNewLabel.setIcon(new ImageIcon(SuperheaterUI.class.getResource("/resources/mouse.png")));
- lblNewLabel.setFont(new Font("Malgun Gothic", Font.BOLD, 16));
- lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
- lblNewLabel.setBounds(0, 0, 219, 34);
- contentPane.add(lblNewLabel);
- chckbxAntiban = new JCheckBox("Antiban");
- chckbxAntiban.setSelected(true);
- chckbxAntiban.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- slider.setEnabled(chckbxAntiban.isSelected());
- lblMouseSpeed.setEnabled(chckbxAntiban.isSelected());
- slider.setValue(5);
- }
- });
- chckbxAntiban.setBounds(10, 62, 71, 23);
- contentPane.add(chckbxAntiban);
- panel = new Panel();
- panel.setForeground(Color.WHITE);
- panel.setBackground(Color.WHITE);
- panel.setBounds(10, 91, 152, 73);
- contentPane.add(panel);
- panel.setLayout(null);
- JLabel lblBankLocation = new JLabel("Bank Location:");
- lblBankLocation.setHorizontalAlignment(SwingConstants.CENTER);
- lblBankLocation.setBounds(0, 26, 85, 23);
- panel.add(lblBankLocation);
- boxWest = new JCheckBox("");
- boxWest.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- boxNorth.setSelected(false);
- boxSouth.setSelected(false);
- boxEast.setSelected(false);
- }
- });
- boxWest.setBackground(Color.WHITE);
- boxWest.setBounds(81, 26, 21, 23);
- panel.add(boxWest);
- boxSouth = new JCheckBox("S");
- boxSouth.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- boxNorth.setSelected(false);
- boxWest.setSelected(false);
- boxEast.setSelected(false);
- }
- });
- boxSouth.setBackground(Color.WHITE);
- boxSouth.setBounds(104, 52, 48, 23);
- panel.add(boxSouth);
- boxCenter = new JCheckBox("");
- boxCenter.setBackground(Color.WHITE);
- boxCenter.setSelected(true);
- boxCenter.setEnabled(false);
- boxCenter.setBounds(104, 26, 21, 23);
- panel.add(boxCenter);
- boxEast = new JCheckBox("");
- boxEast.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- boxNorth.setSelected(false);
- boxWest.setSelected(false);
- boxSouth.setSelected(false);
- }
- });
- boxEast.setBackground(Color.WHITE);
- boxEast.setBounds(127, 26, 21, 23);
- panel.add(boxEast);
- boxNorth = new JCheckBox("N");
- boxNorth.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- boxEast.setSelected(false);
- boxSouth.setSelected(false);
- boxWest.setSelected(false);
- }
- });
- boxNorth.setBackground(Color.WHITE);
- boxNorth.setBounds(104, 0, 44, 23);
- panel.add(boxNorth);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment