Jump to content

Mini Screen to see your bots!


Jack

Recommended Posts

Hi scripters. Here is code to put a mini screen the user can use to babysit their bot.

 

5162654393b0f64986d8046bc3871ba4.png

import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class GUI extends JFrame{

	private JPanel contentPane;
	BufferedImage capture;

	public GUI() {
		setResizable(false);
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setSize(384, 255);
		contentPane = new JPanel();
		setContentPane(contentPane);
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.CENTER);
	}
	
	public void paint(Graphics g)
	{
		g.drawImage(capture,2,30,getContentPane().getWidth(),getContentPane().getHeight(),getContentPane());
	}

	public void setImage(BufferedImage image)
	{
		capture = image;
	}
	
}

How to Implement:

BufferedImage capture;
GUI gui;

	public int onLoop() throws InterruptedException  
	{
		capture =  client.getColorPicker().getBufferedImage();
		gui.setImage(capture);
		gui.repaint();

		return 200;
	}
	public void onStart(){ 
		gui = new GUI();
		gui.setVisible(true);
	}

Edited by 25sittin25m
  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...