Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » print1n Error(print1n Error)
icon10.gif  print1n Error [message #1738594] Thu, 21 July 2016 08:20 Go to next message
Chad Mattingly is currently offline Chad MattinglyFriend
Messages: 3
Registered: July 2016
Junior Member
Hey I Got Some Error In My Code.
Heres My Code.

package com.game.main;

import java.awt.Canvas;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;

public class Game extends Canvas implements Runnable{
	
	private static final long serialVersionUID = 6877995293538150068L;
	
	public static final int WIDTH = 640, HEIGHT = WIDTH / 12 * 9;
	
	private boolean running = false;
	private Thread thread;

	public Game(){
		new Window(WIDTH, HEIGHT, "BASIC TITLE", this);
	}

	public synchronized void start(){
		thread = new Thread(this);
				thread.start();
		running = true;
	}
	
	public synchronized void stop(){
	try{
		thread.join();
		running = false;
		}catch(Exception e){
			e.printStackTrace();
		}
		
	}

	public void run(){
		long lastTime = System.nanoTime();
		double amountOfTicks = 60.0;
		double ns = 1000000000 / amountOfTicks;
		double delta = 0;
		long timer = System.currentTimeMillis();
		int frames = 0;
		while(running){
			long now = System.nanoTime();
			delta += (now - lastTime) / ns;
			lastTime = now;
			while(delta >= 1){
				tick();
				delta--;
			}
			if(running)
				render();
			frames++;
			
			if(System.currentTimeMillis() - timer > 1000){
				timer += 1000;
				System.out.print1n("FPS: " + frames);    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>MARK<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
				frames = 0;
			}
		}
		stop();
	}
	
	private void tick(){
	
	}
	
	private void render(){
		BufferStrategy bs = this.getBufferStratedy();
		if(bs == null){
			this.createBufferStratedy(3);
			return;
		}
		
		Graphics g = bs.getDrawGraphics();
		
		
		g.dispose();
		bs.show();
		
	}
	
	public static void main(String args[]){
		new Game();
			
	}
	
}


I Marked The String With A ">MARK<"

The Error Says "The method print1n(String) is undefined for the type PrintStream"

Any Help?
Re: print1n Error [message #1738631 is a reply to message #1738594] Thu, 21 July 2016 14:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Is that the character 1 instead of the letter el? Use ctrl-space to do
name completion.


On 21.07.2016 15:58, Chad Mattingly wrote:
> Hey I Got Some Error In My Code.
> Heres My Code.
>
> package com.game.main;
>
> import java.awt.Canvas;
> import java.awt.Graphics;
> import java.awt.image.BufferStrategy;
>
> public class Game extends Canvas implements Runnable{
>
> private static final long serialVersionUID = 6877995293538150068L;
>
> public static final int WIDTH = 640, HEIGHT = WIDTH / 12 * 9;
>
> private boolean running = false;
> private Thread thread;
>
> public Game(){
> new Window(WIDTH, HEIGHT, "BASIC TITLE", this);
> }
>
> public synchronized void start(){
> thread = new Thread(this);
> thread.start();
> running = true;
> }
>
> public synchronized void stop(){
> try{
> thread.join();
> running = false;
> }catch(Exception e){
> e.printStackTrace();
> }
>
> }
>
> public void run(){
> long lastTime = System.nanoTime();
> double amountOfTicks = 60.0;
> double ns = 1000000000 / amountOfTicks;
> double delta = 0;
> long timer = System.currentTimeMillis();
> int frames = 0;
> while(running){
> long now = System.nanoTime();
> delta += (now - lastTime) / ns;
> lastTime = now;
> while(delta >= 1){
> tick();
> delta--;
> }
> if(running)
> render();
> frames++;
>
> if(System.currentTimeMillis() - timer > 1000){
> timer += 1000;
> System.out.print1n("FPS: " + frames);
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>MARK<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> frames = 0;
> }
> }
> stop();
> }
>
> private void tick(){
>
> }
>
> private void render(){
> BufferStrategy bs = this.getBufferStratedy();
> if(bs == null){
> this.createBufferStratedy(3);
> return;
> }
>
> Graphics g = bs.getDrawGraphics();
>
>
> g.dispose();
> bs.show();
>
> }
>
> public static void main(String args[]){
> new Game();
>
> }
>
> }
>
>
> I Marked The String With A ">MARK<"
>
> The Error Says "The method print1n(String) is undefined for the type
> PrintStream"
>
> Any Help?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: print1n Error [message #1738659 is a reply to message #1738631] Thu, 21 July 2016 20:24 Go to previous messageGo to next message
Chad Mattingly is currently offline Chad MattinglyFriend
Messages: 3
Registered: July 2016
Junior Member
thats a 1. and i was looking at a tutorial for a fps thing. thats what the print in is for.
Re: print1n Error [message #1738666 is a reply to message #1738659] Fri, 22 July 2016 04:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
It should be an el not a one. Type "System.out." and then hit
Ctrl-space and you'll see what method names are valid.


On 21.07.2016 22:24, Chad Mattingly wrote:
> thats a 1. and i was looking at a tutorial for a fps thing. thats what
> the print in is for.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: print1n Error [message #1738980 is a reply to message #1738666] Tue, 26 July 2016 13:49 Go to previous message
Erick Hagstrom is currently offline Erick HagstromFriend
Messages: 107
Registered: April 2014
Location: USA
Senior Member
Yup. It's "println", not "print1n". Use the letter 'l' (lower case "L") (the one between "k" and "m" alphabetically), not the digit '1' (one).
Previous Topic:Frequent random crashes
Next Topic:Code change
Goto Forum:
  


Current Time: Thu Apr 25 22:10:36 GMT 2024

Powered by FUDForum. Page generated in 0.03303 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top