What I need is to have the same GUI stay, but when the person goes to the menu and selects Editors > NPCSpawner, I need it to change from the default interface that's there (NPCSpawner interface) to the Other GUI (yes, it's called "Other"):
import org.rsbot.script.*;
import org.rsbot.script.wrappers.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
@ScriptManifest(authors = {"Feriscool"}, keywords = {"GUI2"}, name = "GUI2", description = "Testing GUI", version = 1)
public class GUI2 extends Script{
NPCSpawn g = new NPCSpawn();
@Override
public boolean onStart() {
g.setVisible(true);
return true;
}
public int loop() {
return random(500, 1500);
}
@Override
public void onFinish() {
}
class NPCSpawn extends JFrame {
public NPCSpawn() {
initComponents();
}
private void button1ActionPerformed(ActionEvent e) {
// TODO add your code here
}
private void button2ActionPerformed(ActionEvent e) {
// TODO add your code here
}
private void menuItem3ActionPerformed(ActionEvent e) {
Other();
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner Evaluation license - RS 2007
menuBar1 = new JMenuBar();
menu1 = new JMenu();
menuItem2 = new JMenuItem();
menu2 = new JMenu();
menuItem3 = new JMenuItem();
scrollPane1 = new JScrollPane();
textArea1 = new JTextArea();
textField4 = new JTextField();
label1 = new JLabel();
textField1 = new JTextField();
textField7 = new JTextField();
textField8 = new JTextField();
textField12 = new JTextField();
textField9 = new JTextField();
textField5 = new JTextField();
textField6 = new JTextField();
textField10 = new JTextField();
textField11 = new JTextField();
textField2 = new JTextField();
label2 = new JLabel();
label3 = new JLabel();
textField3 = new JTextField();
label4 = new JLabel();
label5 = new JLabel();
label6 = new JLabel();
label7 = new JLabel();
label8 = new JLabel();
label9 = new JLabel();
label10 = new JLabel();
label11 = new JLabel();
label12 = new JLabel();
label13 = new JLabel();
button1 = new JButton();
button2 = new JButton();
//======== this ========
setTitle("PJA Editor by Vault");
Container contentPane = getContentPane();
contentPane.setLayout(null);
//======== menuBar1 ========
{
//======== menu1 ========
{
menu1.setText("File");
//---- menuItem2 ----
menuItem2.setText("Exit");
menu1.add(menuItem2);
}
menuBar1.add(menu1);
//======== menu2 ========
{
menu2.setText("Editors");
//---- menuItem3 ----
menuItem3.setText("NPCSpawner");
menuItem3.setIcon(new ImageIcon("C:\\Users\\Patrick\\Desktop\\monster.png"));
menuItem3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
menuItem3ActionPerformed(e);
}
});
menu2.add(menuItem3);
}
menuBar1.add(menu2);
}
setJMenuBar(menuBar1);
//======== scrollPane1 ========
{
//---- textArea1 ----
textArea1.setToolTipText("The output of the code");
scrollPane1.setViewportView(textArea1);
}
contentPane.add(scrollPane1);
scrollPane1.setBounds(305, 25, 185, 225);
//---- textField4 ----
textField4.setToolTipText("The X coordinate of the NPC's spawn");
contentPane.add(textField4);
textField4.setBounds(10, 75, 80, 20);
//---- label1 ----
label1.setText("Output");
contentPane.add(label1);
label1.setBounds(375, 5, 65, 20);
//---- textField1 ----
textField1.setToolTipText("ID of the NPC");
contentPane.add(textField1);
textField1.setBounds(10, 25, 80, 20);
//---- textField7 ----
textField7.setToolTipText("The minimum X coordinate of the NPC's spawn");
contentPane.add(textField7);
textField7.setBounds(10, 125, 80, 20);
//---- textField8 ----
textField8.setToolTipText("The minimum Y coordinate of the NPC's spawn");
contentPane.add(textField8);
textField8.setBounds(105, 125, 80, 20);
//---- textField12 ----
textField12.setToolTipText("The maximum Z coordinate of the NPC's spawn");
contentPane.add(textField12);
textField12.setBounds(200, 175, 80, 20);
//---- textField9 ----
textField9.setToolTipText("The minimum Z coordinate of the NPC's spawn");
contentPane.add(textField9);
textField9.setBounds(200, 125, 80, 20);
//---- textField5 ----
textField5.setToolTipText("The Y coordinate of the NPC's spawn");
contentPane.add(textField5);
textField5.setBounds(105, 75, 80, 20);
//---- textField6 ----
textField6.setToolTipText("The Z coordinate of the NPC's spawn");
contentPane.add(textField6);
textField6.setBounds(200, 75, 80, 20);
//---- textField10 ----
textField10.setToolTipText("The maximum X coordinate of the NPC's spawn");
contentPane.add(textField10);
textField10.setBounds(10, 175, 80, 20);
//---- textField11 ----
textField11.setToolTipText("The maximum Y coordinate of the NPC's spawn");
contentPane.add(textField11);
textField11.setBounds(105, 175, 80, 20);
//---- textField2 ----
textField2.setToolTipText("Name of the NPC");
contentPane.add(textField2);
textField2.setBounds(105, 25, 80, 20);
//---- label2 ----
label2.setText("ID");
contentPane.add(label2);
label2.setBounds(45, 10, 15, 15);
//---- label3 ----
label3.setText("Name");
contentPane.add(label3);
label3.setBounds(new Rectangle(new Point(130, 10), label3.getPreferredSize()));
//---- textField3 ----
textField3.setToolTipText("The WalkingType of the NPC");
contentPane.add(textField3);
textField3.setBounds(200, 25, 80, 20);
//---- label4 ----
label4.setText("WalkingType");
contentPane.add(label4);
label4.setBounds(new Rectangle(new Point(210, 10), label4.getPreferredSize()));
//---- label5 ----
label5.setText("SpawnX");
contentPane.add(label5);
label5.setBounds(new Rectangle(new Point(30, 60), label5.getPreferredSize()));
//---- label6 ----
label6.setText("SpawnY");
contentPane.add(label6);
label6.setBounds(new Rectangle(new Point(125, 60), label6.getPreferredSize()));
//---- label7 ----
label7.setText("SpawnZ");
contentPane.add(label7);
label7.setBounds(new Rectangle(new Point(220, 60), label7.getPreferredSize()));
//---- label8 ----
label8.setText("MinX");
contentPane.add(label8);
label8.setBounds(new Rectangle(new Point(40, 110), label8.getPreferredSize()));
//---- label9 ----
label9.setText("MinY");
contentPane.add(label9);
label9.setBounds(new Rectangle(new Point(135, 110), label9.getPreferredSize()));
//---- label10 ----
label10.setText("MinZ");
contentPane.add(label10);
label10.setBounds(new Rectangle(new Point(230, 110), label10.getPreferredSize()));
//---- label11 ----
label11.setText("MaxX");
contentPane.add(label11);
label11.setBounds(new Rectangle(new Point(35, 160), label11.getPreferredSize()));
//---- label12 ----
label12.setText("MaxY");
contentPane.add(label12);
label12.setBounds(new Rectangle(new Point(130, 160), label12.getPreferredSize()));
//---- label13 ----
label13.setText("MaxZ");
contentPane.add(label13);
label13.setBounds(new Rectangle(new Point(225, 160), label13.getPreferredSize()));
//---- button1 ----
button1.setText("Generate");
button1.setToolTipText("Generate the code");
button1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
button1ActionPerformed(e);
}
});
contentPane.add(button1);
button1.setBounds(45, 215, 90, 25);
//---- button2 ----
button2.setText("Reset");
button2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
button2ActionPerformed(e);
}
});
contentPane.add(button2);
button2.setBounds(150, 215, 90, 25);
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < contentPane.getComponentCount(); i++) {
Rectangle bounds = contentPane.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = contentPane.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
contentPane.setMinimumSize(preferredSize);
contentPane.setPreferredSize(preferredSize);
}
pack();
setLocationRelativeTo(getOwner());
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner Evaluation license - RS 2007
private JMenuBar menuBar1;
private JMenu menu1;
private JMenuItem menuItem2;
private JMenu menu2;
private JMenuItem menuItem3;
private JScrollPane scrollPane1;
private JTextArea textArea1;
private JTextField textField4;
private JLabel label1;
private JTextField textField1;
private JTextField textField7;
private JTextField textField8;
private JTextField textField12;
private JTextField textField9;
private JTextField textField5;
private JTextField textField6;
private JTextField textField10;
private JTextField textField11;
private JTextField textField2;
private JLabel label2;
private JLabel label3;
private JTextField textField3;
private JLabel label4;
private JLabel label5;
private JLabel label6;
private JLabel label7;
private JLabel label8;
private JLabel label9;
private JLabel label10;
private JLabel label11;
private JLabel label12;
private JLabel label13;
private JButton button1;
private JButton button2;
// JFormDesigner - End of variables declaration //GEN-END:variables
}
public class Other extends JFrame {
public Other() {
initComponents();
}
private void menuItem3ActionPerformed(ActionEvent e) {
// TODO add your code here
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
// Generated using JFormDesigner Evaluation license - RS 2007
menuBar1 = new JMenuBar();
menu1 = new JMenu();
menuItem2 = new JMenuItem();
menu2 = new JMenu();
menuItem3 = new JMenuItem();
scrollPane1 = new JScrollPane();
textArea1 = new JTextArea();
textField4 = new JTextField();
label1 = new JLabel();
textField1 = new JTextField();
textField7 = new JTextField();
textField8 = new JTextField();
textField12 = new JTextField();
textField9 = new JTextField();
textField5 = new JTextField();
textField6 = new JTextField();
textField10 = new JTextField();
textField11 = new JTextField();
textField2 = new JTextField();
label2 = new JLabel();
label3 = new JLabel();
textField3 = new JTextField();
label4 = new JLabel();
label5 = new JLabel();
label6 = new JLabel();
label7 = new JLabel();
label8 = new JLabel();
label9 = new JLabel();
label10 = new JLabel();
label11 = new JLabel();
label12 = new JLabel();
label13 = new JLabel();
//======== this ========
setTitle("PJA Editor by Vault");
Container contentPane = getContentPane();
contentPane.setLayout(null);
//======== menuBar1 ========
{
//======== menu1 ========
{
menu1.setText("File");
//---- menuItem2 ----
menuItem2.setText("Exit");
menu1.add(menuItem2);
}
menuBar1.add(menu1);
//======== menu2 ========
{
menu2.setText("Editors");
//---- menuItem3 ----
menuItem3.setText("NPCSpawner");
menuItem3.setIcon(new ImageIcon("C:\\Users\\Patrick\\Desktop\\monster.png"));
menuItem3.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
menuItem3ActionPerformed(e);
}
});
menu2.add(menuItem3);
}
menuBar1.add(menu2);
}
setJMenuBar(menuBar1);
//======== scrollPane1 ========
{
//---- textArea1 ----
textArea1.setToolTipText("The output of the code");
scrollPane1.setViewportView(textArea1);
}
contentPane.add(scrollPane1);
scrollPane1.setBounds(305, 25, 185, 225);
//---- textField4 ----
textField4.setToolTipText("The X coordinate of the NPC's spawn");
contentPane.add(textField4);
textField4.setBounds(10, 75, 80, 20);
//---- label1 ----
label1.setText("Output");
contentPane.add(label1);
label1.setBounds(375, 5, 65, 20);
//---- textField1 ----
textField1.setToolTipText("ID of the NPC");
contentPane.add(textField1);
textField1.setBounds(10, 25, 80, 20);
//---- textField7 ----
textField7.setToolTipText("The minimum X coordinate of the NPC's spawn");
contentPane.add(textField7);
textField7.setBounds(10, 125, 80, 20);
//---- textField8 ----
textField8.setToolTipText("The minimum Y coordinate of the NPC's spawn");
contentPane.add(textField8);
textField8.setBounds(105, 125, 80, 20);
//---- textField12 ----
textField12.setToolTipText("The maximum Z coordinate of the NPC's spawn");
contentPane.add(textField12);
textField12.setBounds(200, 175, 80, 20);
//---- textField9 ----
textField9.setToolTipText("The minimum Z coordinate of the NPC's spawn");
contentPane.add(textField9);
textField9.setBounds(200, 125, 80, 20);
//---- textField5 ----
textField5.setToolTipText("The Y coordinate of the NPC's spawn");
contentPane.add(textField5);
textField5.setBounds(105, 75, 80, 20);
//---- textField6 ----
textField6.setToolTipText("The Z coordinate of the NPC's spawn");
contentPane.add(textField6);
textField6.setBounds(200, 75, 80, 20);
//---- textField10 ----
textField10.setToolTipText("The maximum X coordinate of the NPC's spawn");
contentPane.add(textField10);
textField10.setBounds(10, 175, 80, 20);
//---- textField11 ----
textField11.setToolTipText("The maximum Y coordinate of the NPC's spawn");
contentPane.add(textField11);
textField11.setBounds(105, 175, 80, 20);
//---- textField2 ----
textField2.setToolTipText("Name of the NPC");
contentPane.add(textField2);
textField2.setBounds(105, 25, 80, 20);
//---- label2 ----
label2.setText("ID");
contentPane.add(label2);
label2.setBounds(45, 10, 15, 15);
//---- label3 ----
label3.setText("Name");
contentPane.add(label3);
label3.setBounds(new Rectangle(new Point(130, 10), label3.getPreferredSize()));
//---- textField3 ----
textField3.setToolTipText("The WalkingType of the NPC");
contentPane.add(textField3);
textField3.setBounds(200, 25, 80, 20);
//---- label4 ----
label4.setText("WalkingType");
contentPane.add(label4);
label4.setBounds(new Rectangle(new Point(210, 10), label4.getPreferredSize()));
//---- label5 ----
label5.setText("SpawnX");
contentPane.add(label5);
label5.setBounds(new Rectangle(new Point(30, 60), label5.getPreferredSize()));
//---- label6 ----
label6.setText("SpawnY");
contentPane.add(label6);
label6.setBounds(new Rectangle(new Point(125, 60), label6.getPreferredSize()));
//---- label7 ----
label7.setText("SpawnZ");
contentPane.add(label7);
label7.setBounds(new Rectangle(new Point(220, 60), label7.getPreferredSize()));
//---- label8 ----
label8.setText("MinX");
contentPane.add(label8);
label8.setBounds(new Rectangle(new Point(40, 110), label8.getPreferredSize()));
//---- label9 ----
label9.setText("MinY");
contentPane.add(label9);
label9.setBounds(new Rectangle(new Point(135, 110), label9.getPreferredSize()));
//---- label10 ----
label10.setText("MinZ");
contentPane.add(label10);
label10.setBounds(new Rectangle(new Point(230, 110), label10.getPreferredSize()));
//---- label11 ----
label11.setText("MaxX");
contentPane.add(label11);
label11.setBounds(new Rectangle(new Point(35, 160), label11.getPreferredSize()));
//---- label12 ----
label12.setText("MaxY");
contentPane.add(label12);
label12.setBounds(new Rectangle(new Point(130, 160), label12.getPreferredSize()));
//---- label13 ----
label13.setText("MaxZ");
contentPane.add(label13);
label13.setBounds(new Rectangle(new Point(225, 160), label13.getPreferredSize()));
{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < contentPane.getComponentCount(); i++) {
Rectangle bounds = contentPane.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = contentPane.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
contentPane.setMinimumSize(preferredSize);
contentPane.setPreferredSize(preferredSize);
}
pack();
setLocationRelativeTo(getOwner());
// JFormDesigner - End of component initialization //GEN-END:initComponents
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner Evaluation license - RS 2007
private JMenuBar menuBar1;
private JMenu menu1;
private JMenuItem menuItem2;
private JMenu menu2;
private JMenuItem menuItem3;
private JScrollPane scrollPane1;
private JTextArea textArea1;
private JTextField textField4;
private JLabel label1;
private JTextField textField1;
private JTextField textField7;
private JTextField textField8;
private JTextField textField12;
private JTextField textField9;
private JTextField textField5;
private JTextField textField6;
private JTextField textField10;
private JTextField textField11;
private JTextField textField2;
private JLabel label2;
private JLabel label3;
private JTextField textField3;
private JLabel label4;
private JLabel label5;
private JLabel label6;
private JLabel label7;
private JLabel label8;
private JLabel label9;
private JLabel label10;
private JLabel label11;
private JLabel label12;
private JLabel label13;
// JFormDesigner - End of variables declaration //GEN-END:variables
}
}