DeadEd.com
IRC Bots, Java Game Query and Control Libraries, and More ...
Sign Up!
Login
Welcome to DeadEd.com
Saturday, May 19 2012 @ 04:02 PM CDT


 

 Difficulty: 2/10
 Required: A Brain, Knowledge of Copy+Paste
 
     Okay, First thing is first. I know i hate looking at the black box with the white letters thinking to myself i wanted to make an irc bot not read the *censored*ing matrix, so i'm sure you all would probably like to have something a little neater to look at when you need to check your bots status.
 
Basically this whole guide is copying and pasting to save time for both me and you.
 
First what your going to do is make a new class named GUI
 
inside GUI class copy and paste this
 
import javax.swing.JFrame;

public class GUI extends javax.swing.JFrame {
 
    /** Creates new form GUI */
    public GUI() {
        initComponents();
    }
 
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    public void initComponents() {
 
        Title = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        ChatLog = new javax.swing.JTextArea();
 
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
 
        Title.setFont(new java.awt.Font("Kristen ITC", 1, 18)); // NOI18N
        Title.setText("CHANGE THIS TO THE TITLE OF YOUR BOT");
        ChatLog.setColumns(20);
                
        ChatLog.setRows(5);
                ChatLog.setEditable(false);
                ChatLog.append("\n");
                jScrollPane1.setViewportView(ChatLog);
                
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(211, Short.MAX_VALUE)
                .addComponent(Title, javax.swing.GroupLayout.PREFERRED_SIZE, 350, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(190, 190, 190))
            .addGroup(layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 711, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(21, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(Title)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE)
                .addContainerGap())
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents
 
    /**
    * Starts the GUI components of this bot
    */
    public void ShowComponents() {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GUI().setVisible(true);
            }
        });
    }
 
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JTextArea ChatLog;
    private javax.swing.JLabel Title;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
 
}
 
 
Save and exit or if you have Notepad ++ open up MyBot Class
 
under 
public class MyBot extends PircBot {
add
static GUI currentGUI = new GUI();
 
next you're going to find
public MYBot() {

and add
currentGUI.ShowComponents();
 
okay now above the last } in public mybot you are going to add this
@Override
     public void log(String line) {
          currentGUI.ChatLog.append(line + "\n");
          currentGUI.ChatLog.setCaretPosition(currentGUI.ChatLog.getText().length());
}
 
 
and there you have it a nice little gui to have you're bot show on. for anyone with onMessage or anything like that who wants it logged you would do
 
@Override
   public void onMessage(String channel, String sender, String login, String hostname, String message) {
                     log(message);
}
 
 
 
Thanks
Bo The Pro
MSN: Bstephenson7@hotmail.com
 
Feedback is great.

 

Last Updated Wednesday, May 12 2010 @ 02:32 PM CDT|932 Hits View Printable Version

0 comments

The following comments are owned by whomever posted them. This site is not responsible for what they say.

My Account





Sign up as a New User
Lost your password?

What's New

Stories

No new stories

Comments last 2 days

No new comments

Files last 14 days

No new files
No new comments

Links last 2 weeks

No new links

Who's Online

Guest Users: 7

Chatterblock


Registered user feature