getting the icon back to the header

i want to put an icon in the header(like  the fox icon in the FF browser etc.) instead of the Java icon.
i tried something out,but for now, i only managed to remove the icon at all... :-S
my code looks like that (not all of it, just the parts needed here...)

public class BootStrap
{      static String ImageIconFolder;
      static ImageIcon tPointerLogo;
      public BootStrap(String timageIconFolder,ImageIcon pointerLogo){
    public static void main(String args[])
    {      String ImageName="\\PointerLogo.jpg";
          String ImageFolder="C:\\Temp";
          String ImageIconFolder=ImageFolder.concat(ImageName);
        tPointerLogo = new ImageIcon(ImageIconFolder);

        new LoopSMS("Loop SMS    Ver. 1.01");
       // LoopSMS.setIconImage(PointerLogo.getImage());

...      //constructor
    public LoopSMS(String frameTitle)
           //initialise components
           //construct GUI
          //Display GUI

  private void construct()
        ImageIcon PointerLogo = new ImageIcon();

      //  JFrame MainFrame = new JFrame("Loop SMS Ver. 1.01");
    //    MainFrame.setLocationRelativeTo( null );
       // MainFrame.add(MainFramePanel);

how do i fix that?
Who is Participating?
ADSLMarkConnect With a Mentor Commented:
Different solution:

    public static void main(String args[])
        String ImageName="\\PointerLogo.jpg";
        String ImageFolder="C:\\Temp";
        String ImageIconFolder=ImageFolder.concat(ImageName);
        tPointerLogo = new ImageIcon(ImageIconFolder);

        LoopSMS ls = new LoopSMS("Loop SMS    Ver. 1.01");

Btw, a lot of rubbish in your code, try to keep your code clean and simple.
I think you are missing the idea of static vs non-static. If you have a class Student and you want an instance of that class you do:

Student instanceStudent = new Student();

Now if you want to call a method on such object you do:


This will call the object and all the class-attributes are set for this specific student. While if you do:


then you can only do so, if the attribute is static (since Student is not an instance/object but a class name).
So small example:

class Student
  final static String school = "university college";
  public int id;
  private int pid;

  public Student(int id)
  { = id; = id*2;

  public int getPid()
    return pid;

This class has one constructor (namely Student(int id)) and a method getId() which returns the id of the student. There are three attributes, one static (value) and one non-static (id). Id is public, but pid is private.

So lets look at the follow example code:
Student s1 = new Student(10);
System.out.println(; //outputs "university college"
System.out.println(;       //not possible, variable is non-static
System.out.println(;               //outputs 10
System.out.println(s1.getPid());      //outputs 20
System.out.println(;             //not possible, variable is private

I'm not sure if I explained this well enough for you to understand, but there is a lot of redundancy in your code.

Good luck.
Pass the icon in the ctor

new LoopSMS("Loop SMS    Ver. 1.01", tPointerLogo);
Then in construct you can do


(after you've assigned the icon passed in the ctor to an instance variable)
yabelsonAuthor Commented:
ok 10x,i got the point.
i'll try and make this better.
i've got another question, but it will go in another Q. :-)
(got lots of points to spread around LOL)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.