String filename = new String();
while (i < 70)
{
filename = i+".png";
URL alphaurl = ImageF.class.getResource(filename);
Image[i] = new ImageIcon(alphaurl);
i++;
}
Type: Posts; User: jerinjose61
String filename = new String();
while (i < 70)
{
filename = i+".png";
URL alphaurl = ImageF.class.getResource(filename);
Image[i] = new ImageIcon(alphaurl);
i++;
}
All because of you!!! :)
Yippyyyyy!!!!! I got it!!! Sorry for the excitement!! But I just cant control it!! And THANK YOU very much Norm for your guidance!! Without you this would not have been possible. Thank you once...
:(
Only the WELCOME image is being loaded. There are no errors but the Image is not changing upon Key press.
The first code after your reply is what I did. Is the repaint() method in the right place? Because upon pressing "1" the image is not changing.
--- Update ---
import java.awt.*;
import...
package learnGUI.rev;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
public class ImageTest
{
public static void main(String[]...
Okay. I did that and thankfully my WELCOME image has loaded!!! :)
Now what should I do to load another Image when I press the key "1".
BEFORE the user presses any key I want to display a "WELCOME" image. I have the image.
And then when I press the key "1" I want to load another image and when I press the key "2" I want to load...
So I Should paint the screen first then only can I check for any keystrokes and then paint it again?
Yeah you are right! There is nothing in a! What is the solution to this problem?
How can I rectify it? Where should i actually place the keyPressed method?
--- Update ---
Yeah you are right!...
line 48 is actually the a.paintComponent(this,g,200,200) statement.
So that means a is having a value null? There is no image in a?
--- Update ---
But I used the img method to load an image to...
I refined my code and eclipse now shows no errors. But the image is not loading. And there are run time errors. The code and errors are given below.
--- Update ---
import java.awt.*;...
ThankYou!! I have edited my post. :)
So any advice on how to do the program?
--- Update ---
Okay! I tried doing the program using the following code. But there are errors. My idea is when I...
//The panel class
package learnGUI.rev;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.imageio.*;
import javax.swing.*;
import java.util.*;
I am very much new to Java. I have just started learning event handling. Currently I am learning about Key Events. And am learning by doing. Well that is how one could learn anything in fact. I want...
Can any one provide the simplest code to check whether a number is palindrome or not?