Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
JagoVB JagoVB is offline
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 ????



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 01:53 AM.


no new posts