Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.event.*;
- import java.io.Writer;
- public class TabbedPane extends JFrame {
- public static String targetIP;
- public static String targetPort;
- JTextField log = new JTextField("localhost", 13);
- JTextField port = new JTextField("25565", 13);
- JButton test = new JButton("Start");
- JTextArea ip = new JTextArea("~~~ SpamBot By m0dz ~~~ \n", 13, 20);
- public TabbedPane() {
- //This will create the title you see in the upper left of the window
- setTitle("Spambot (By m0dz)");
- setSize(400,600); //set size so the user can "see" it
- //Here we are creating the object
- JTabbedPane jtp = new JTabbedPane();
- //This creates the template on the windowed application that we will be using
- getContentPane().add(jtp);
- JPanel jp1 = new JPanel();//This will create the first tab
- JPanel jp2 = new JPanel();//This will create the second tab
- //This creates a non-editable label, sets what the label will read
- //and adds the label to the first tab
- JLabel label1 = new JLabel();
- label1.setText("IP Adress:");
- jp1.add(label1);
- jp1.add(log);
- jp1.add(port);
- //This adds the first and second tab to our tabbed pane object and names it
- jtp.addTab("Main", jp1);
- jtp.addTab("Log", jp2);
- //This creates a new button called "Press" and adds it to the second tab
- jp2.add(ip);
- ip.setEnabled( false );
- jp2.setLayout(new BoxLayout(jp2, BoxLayout.PAGE_AXIS));
- jp2.add(test);
- //This is an Action Listener which reacts to clicking on
- //the test button called "Press"
- ButtonHandler phandler = new ButtonHandler();
- test.addActionListener(phandler);
- setVisible(true); //otherwise you won't "see" it
- }
- //This is the internal class that defines what the above Action Listener
- //will do when the test button is pressed.
- class ButtonHandler implements ActionListener{
- public void actionPerformed(ActionEvent e){
- targetIP = log.getText();
- targetPort = port.getText();
- test.setEnabled( false );
- ip.setText(ip.getText() + "Logging in to " + targetIP + ":" + targetPort + "... \n");
- }
- }
- //example usage
- public static void main (String []args){
- TabbedPane tab = new TabbedPane();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement