Forum rules
1.) No trolling. If you cant have fun without being a jerk to others, find some other forum to QQ 2.) No inappropriate/vulgar/sexually explicit posting. Staff reserves the right to deem anything they see fit as inappropriate. 3.) Have fun and don't post anything not geared at having fun! 4.) Please respect staff members and their decisions at all times. If you cannot accept a staff or moderator decision, please appeal to admin Seth.
Page 1 of 1
[ 6 posts ]
Author
Message
maxattack
Post subject: Game help?
Posted: Sun Mar 25, 2012 7:39 pm
Joined: Wed May 26, 2010 8:09 pmPosts: 1895Location: Look behind you. Theres a shadow. Look at where it is. It isnt me Gender: male
Hey, so im making a game in java, and im getting errors. Anyone mind helping?
Im trying to add images to a full screen.
Spoiler:
import java.awt.*; import javax.swing.ImageIcon; import javax.swing.JFrame; public class images extends JFrame { public static void main(String[] args) { DisplayMode dm = new DisplayMode(800, 600, 16, DisplayMode.REFRESH_RATE_UNKNOWN); images b = new images(); b.run(dm); } private Screen s; private Image bg; private Image pic; private boolean loaded; //run method public void run(DisplayMode dm) { setBackground(Color.BLACK); setForeground(Color.WHITE); setFont(new Font("Arial", Font.PLAIN, 24)); loaded = false; s = new Screen(); try{ s.setFullScreen(dm, this); loadpic (); try{ Thread.sleep(5000); }catch(Exception ex){} }finally{ s.restoreScreen(); } } //loads pastures public void loadpic(){ bg = new ImageIcon("C:\\back.png").getImage(); pic = new ImageIcon("C:\\pic.png").getImage(); loaded = true; repaint(); } public void paint(Graphics g) { if(g instanceof Graphics2D){ Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint (RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } if(loaded){ g.drawImage(bg, 0, 0, null); g.drawImage(pic, 170,180, null); } } }
_________________ Retired AANC Mentor | Retired MT Member | CMoTM | SoTM IGN(s) : Maxattack, MAXS Retired player, trying to come back again.
Top
aister
Post subject: Re: Game help?
Posted: Mon Mar 26, 2012 4:03 am
Joined: Thu Jun 30, 2011 2:48 amPosts: 7985Location: Fuyuki City Gender: male
is this the programmers era in BD Forum or wat?
anyway, tell us wat is the error
_________________
Top
Ferr3t
Post subject: Re: Game help?
Posted: Mon Mar 26, 2012 8:49 am
Joined: Wed Jul 28, 2010 5:38 amPosts: 2954Location: Broome, Western Australia Gender: male
'Developers' Corner' Sub-forum in order owat??
_________________Retired Head Mod Most Crystals: 121 Highest Power: 212 Sensual bath time feat. Ferr3t
Top
Jake
Post subject: Re: Game help?
Posted: Mon Mar 26, 2012 11:44 am
Joined: Sat Dec 19, 2009 7:48 pmPosts: 2691 Gender: male
Ferr3t wrote:
'Developers' Corner' Sub-forum in order owat??
Maybe just a topic xD
_________________
Top
maxattack
Post subject: Re: Game help?
Posted: Mon Mar 26, 2012 5:49 pm
Joined: Wed May 26, 2010 8:09 pmPosts: 1895Location: Look behind you. Theres a shadow. Look at where it is. It isnt me Gender: male
aister wrote:
is this the programmers era in BD Forum or wat?
anyway, tell us wat is the error
Thats the thing, it just.. doesnt work. Eclipse doesnt give it to me, its just when i run it.
Jake wrote:
Ferr3t wrote:
'Developers' Corner' Sub-forum in order owat??
Maybe just a topic xD
Didnt know who to ask
Ronelm said the double try{ could be it, but i learned to have that, as well as the repaint.
_________________ Retired AANC Mentor | Retired MT Member | CMoTM | SoTM IGN(s) : Maxattack, MAXS Retired player, trying to come back again.
Top
aister
Post subject: Re: Game help?
Posted: Mon Mar 26, 2012 5:52 pm
Joined: Thu Jun 30, 2011 2:48 amPosts: 7985Location: Fuyuki City Gender: male
maybe u remember it wrong, or took note wrong? Idk, I know nothing about java, but if ron said it is then it's worth the try...
_________________
Top
Page 1 of 1
[ 6 posts ]
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum