Ok! :) Thanks for all the help! Very appreciated!
Type: Posts; User: gargamel7
Ok! :) Thanks for all the help! Very appreciated!
So itīs nothing thatīs going to make my program run slower then? (So that I know for bigger projects)
Well, not loaded three times each, but the img is returned three times each.
I moved the loading of images to the constructor and it worked. The flowers are now drawn. The output is:
The pointer class now looks like this:
I guess the images are loaded three times...
Everything you wanted me to do was already in there.
Pointer class:
fileName=pink.jpg
fileName=weird.jpg
fileName=rose.jpg
is the output, so we just want to fix the issues with calling...
Why introduce the new variable fPath when i had the variable fileName that did the same thing?
Nothing in my getImg() method ever happens during runtime (no printlns are executed etc), so I guess...
pink = something; //pink becomes something
I know what an assignment statement is.
I removed public String pink; (and rose, weird)
I did as you said and used this snippet:
pPink = new...
Yes, the filenames on my computer are pink.jpg, rose.jpg and weird.jpg. But, the variable fileName may be just pink, rose or weird, so there is a slight confusion there.
Your second paragraph: I...
The filenames are: pink, weird and rose
I canīt answer your second question but to again tell you about the idea about how it works, since pink not = something, but becomes a part of the pink.jpg ...
I think nobody can blame me for not being interested in solving this issue since Iīve been watching the code over and over the last days. Iīm new to programming so itīs of course possible to not see...
I donīt understand your question. I know how to assign a value to a var, but you got the code so I donīt see why you donīt just check it since itīs so short.
My idea of structuring this was to create these three pointer objects with the variables speed and fileName. The fileName that then is either pink, weird or rose are used in this method to get the...
public Clock(){
pPink = new Pointer(3600,pink);
pWeird = new Pointer(60,weird);
pRose = new Pointer(1,rose);
}
The filenames are: pink.jpg, weird.jpg and rose.jpg.
Hereīs the code with some changes. When compiled I see the wheel pic and the printlns: fileName=null.jpg, three times on separate lines.
...
Im using my android now so i cant check the code but i believe i put
System.out.println("img=" + img + ".jpg"); into the program. But it doesnt matter what string u write since it's not a reference...
That the img is not defined to an image and therefore is a null.jpg. Of course there are no images that is named null.jpg (as the code tells, there are wheel, pink, rose and weird).
img=null.jpg
img=null.jpg
img=null.jpg
When i insert that println nothing happens. Nothing happens when i insert a println before calling
the getImg() method either. The imageIcon snippet is still in the getImg() method since there are...
Yes, I understand that you learn me debug tips, simply just didnīt understand what you wrote that i should do. However, the wheel picture is okay and everything, but the flower pics wont be shown....
When I move this to the pointer-constructor: ImageIcon ii = new ImageIcon(this.getClass().getResource(img+".jpg"));
img = ii.getImage();, i get error messages and it wont compile (I changed img to...
No there are no error messages. It compiles correct and I see a window with a bike wheel in it.
I did like they did in here: (scroll down a bit for the Image part).
Basics
What do I do wrong...
I see the bike wheel (wheel.png) when I execute the code (which I want). When I insert a System.out.println("this is loaded"); in the getImg() method, nothing happens. So the problem is in the...
Hello!
My first post! Woo!
Iīm making an analogue clock which consists of a bike wheel as "the clock" and three pointers which are images of different flowers!
Iīm having problem with...