Results 1 to 2 of 2
- 01-31-2011, 08:16 PM #1
Member
- Join Date
- Jan 2011
- Posts
- 30
- Rep Power
- 0
Why doesn't this put the images on the screen?
When I run it, the images don't show up, but they should because I have theJava Code:import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.RenderingHints; import javax.swing.*; public class Nick extends JFrame{ public static void main(String[] args){ TheWindow w = new TheWindow(); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(700,500); w.setVisible(true); } public Nick(){ super("ProjectN (Un-named game)"); } private Image bg; private Image Start; public void loadPics(){ bg = new ImageIcon(getClass().getResource("back.jpg")).getImage(); Start = new ImageIcon(getClass().getResource("Start.png")).getImage(); } public void draw(Graphics g){ super.paint(g); if(g instanceof Graphics2D){ Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); } g.drawImage(bg,0,0,null); g.drawImage(Start,10,10,null); } }andJava Code:g.drawImage(bg,0,0,null);
..right?Java Code:g.drawImage(Start,10,10,null);
- 01-31-2011, 08:24 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,608
- Rep Power
- 5
You have your answer here:
Can't put the image on the screen??
I suggest you actually read the replies - if they don't make sense then ask for clarification (FWIW, the problem in this example is completely different (what is TheWindow?))Last edited by doWhile; 01-31-2011 at 08:33 PM.
Similar Threads
-
Move from one screen fto other screen
By jprgmr75 in forum CLDC and MIDPReplies: 0Last Post: 01-02-2011, 06:32 PM -
how to scroll 2 images at a time(synchronisation),both images are on different panels
By smitharavi in forum AWT / SwingReplies: 4Last Post: 12-16-2010, 04:32 PM -
How to do a screen capture of content on web page/join 2 images
By raabie in forum JavaServer Pages (JSP) and JSTLReplies: 3Last Post: 08-27-2010, 01:02 PM -
Can't show images onto the screen
By javaexplorer in forum AWT / SwingReplies: 9Last Post: 01-14-2010, 06:31 PM -
Blank Screen while navigating from one screen to another
By mohana.krishna in forum Java ServletReplies: 0Last Post: 03-03-2009, 05:03 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks