Login to Website

Login dengan Facebook

 

Post Reply
Thread Tools
  #1  
Old 20th November 2011
JagoVB
Ceriwiser
 
Join Date: Nov 2011
Posts: 508
Rep Power: 14
JagoVB mempunyai hidup yang Normal
Default [Ask]Tampil image dijava(netbean)

gan. sy mau tanya cara nampilin image di java netbean..

TANPA pake jframe ato jpanel gmn yah ???

jadi langsung dari java main class gitu..



sy kan mau nambahkan gambar life di src code, mau bikin game spc impact...

saya dah coba pake imageicon malah error :

private BufferStrategy strategy;

ImageIcon lifeicon;



lifeicon = new ImageIcon("sprites/life.png");



Graphics2D g = (Graphics2D) strategy.getDrawGraphics();

g.drawImage (lifeicon,100,100);







trus sy juga dah coba bikin pake Image biasa, tp ttp gak kluar ap2 :

private BufferStrategy strategy;

Image lifeimg;



lifeimg = Toolkit.getDefaultToolkit().getImage(

"sprites/life.png");



Graphics2D g = (Graphics2D) strategy.getDrawGraphics();

g.drawImage(lifeimg, 100, 100, this);



ada yg tau knp gak kluar ato error itu ????



Sponsored Links
Space available
Post Reply




Switch to Mobile Mode

no new posts