Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Wheres my devil?

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Thanked 0 Times in 0 Posts

    Default Wheres my devil?

    hey guys, Im wondering where my program would be going to find a .gif file IE folder ect
    package labelDemo;

    import java.awt.*;
    import javax.swing.*;

    public class labelDemo

    public static void main (String[] args)

    JFrame frame = new JFrame("Label Demo");
    frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);

    ImageIcon icon = new ImageIcon("devil.gif");

    JLabel label1, label2, label3;

    label1 = new JLabel ("Devil left", icon, SwingConstants.CENTER);

    label2 = new JLabel ("Devil right", icon, SwingConstants.CENTER);
    label2.setHorizontalTextPosition (SwingConstants.LEFT);
    label2.setVerticalTextPosition (SwingConstants.BOTTOM);

    label3 = new JLabel ("Devil above", icon, SwingConstants.CENTER);
    label3.setHorizontalTextPosition (SwingConstants.CENTER);
    label3.setVerticalTextPosition (SwingConstants.BOTTOM);

    JPanel panel = new JPanel();
    panel.setBackground (Color.cyan);
    panel.setPreferredSize(new Dimension (200, 250));
    panel.add (label1);
    panel.add (label2);
    panel.add (label3);



  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Washington, DC
    My Mood
    Thanked 632 Times in 540 Posts

    Default Re: Wheres my devil?

    Why don't you do something like new File("devil.gif") and print out the full path?
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. how come this program only loops twice? wheres my mistake?
    By Rainy in forum What's Wrong With My Code?
    Replies: 2
    Last Post: September 3rd, 2011, 09:49 AM
  2. wheres the thread about inverted String?
    By chronoz13 in forum Java Theory & Questions
    Replies: 5
    Last Post: July 29th, 2009, 11:13 AM