Jump to content

onPaint


Recommended Posts

Guest Apogee
Posted

Paint seems to be broken.

The images and the text i'm attempting to input are not coming up.


	static Timer runTime;
	URL paintUrl;
	URL hideUrl;
	Image paintImg;
	Image hideImg;

	public long starttime;
	public long timeran = System.currentTimeMillis() - starttime;
	public long currenttime;
	int startinglvl;
	int startingxp;
	int looted;
	int walk;
	int deaths;
	public int statID;
	public int seedID;
	public int compID;
	String status;
	public static boolean started = false; // for gui
	public static boolean trainstat2 = false;
	public static Image image;
	
	public void onStart() {
		runTime = new Timer(0);
		status = "Starting up..";
		starttime = System.currentTimeMillis();

		try {
			paintUrl = new URL(
					"https://dl.dropboxusercontent.com/u/76706937/bitterfarmformat.png");
		} catch (MalformedURLException e1) {
			e1.printStackTrace();
		}

		try {
			paintImg = ImageIO.read(paintUrl);
		} catch (IOException e1) {
			e1.printStackTrace();
		}

		try {
			hideUrl = new URL(
					"https://dl.dropboxusercontent.com/u/76706937/hideshowpaint.png");
		} catch (MalformedURLException e1) {
			e1.printStackTrace();
		}

		try {
			hideImg = ImageIO.read(hideUrl);
		} catch (IOException e1) {
			e1.printStackTrace();
		}

	}
	
	
	public void onPaint(Graphics2D g) {
		

		long currenttime = System.currentTimeMillis();
		long timeran = currenttime - starttime;


		g.setColor(new Color(255, 255, 255));
		g.setFont(new Font("Arial", Font.BOLD, 17));

		//if (!hide) {


			g.drawImage(paintImg, -1, 208, 520, 273, null);

			g.drawString(" " + format(System.currentTimeMillis() - starttime),
					324, 360);
			g.drawString(" " + looted, 308, 378);
			g.drawString(" " + getPerHour(looted, timeran), 328, 398);
			g.drawString(" " + (looted * 204), 341, 415);
			g.drawString(" " + getPerHour(looted * 204, timeran), 316, 435);
			g.drawString(" " + walk, 308, 452);
			g.drawString(" " + status, 308, 470);

		//} else {
			// if boolean says hidden then draws image where you want it to be

			g.drawImage(hideImg, 498, 341, 16, 16, null);
			// usually just a simple 'X' or show paint

		//}

	}

I've tried several things. I'm looking for input.

I'm not asking to be spoon-fed, just a little guidance or reassurance that this isn't a bug.

Guest Apogee
Posted

Solved with this:

try {
			paintUrl = new URL(
					"https://dl.dropboxusercontent.com/u/76706937/bitterfarmformat.png");
			hideUrl = new URL(
					"https://dl.dropboxusercontent.com/u/76706937/hideshowpaint.png");
		} catch (MalformedURLException e1) {
			e1.printStackTrace();
		}
		

		try {
			paintImg = ImageIO.read(paintUrl);
			hideImg = ImageIO.read(hideUrl);
		} catch (IOException e1) {
			e1.printStackTrace();
		}

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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