Search:

Type: Posts; User: jerinjose61

Search: Search took 0.11 seconds.

  1. Finding difficulty with getResource() method to find path.

    String filename = new String();
    while (i < 70)
    {
    filename = i+".png";
    URL alphaurl = ImageF.class.getResource(filename);
    Image[i] = new ImageIcon(alphaurl);
    i++;
    }
  2. [SOLVED] Re: How to change image when a key is pressed?

    All because of you!!! :)
  3. [SOLVED] Re: How to change image when a key is pressed?

    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...
  4. [SOLVED] Re: How to change image when a key is pressed?

    :(
    Only the WELCOME image is being loaded. There are no errors but the Image is not changing upon Key press.
  5. [SOLVED] Re: How to change image when a key is pressed?

    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...
  6. [SOLVED] Re: How to change image when a key is pressed?

    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[]...
  7. [SOLVED] Re: How to change image when a key is pressed?

    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".
  8. [SOLVED] Re: How to change image when a key is pressed?

    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...
  9. [SOLVED] Re: How to change image when a key is pressed?

    So I Should paint the screen first then only can I check for any keystrokes and then paint it again?
  10. [SOLVED] Re: How to change image when a key is pressed?

    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!...
  11. [SOLVED] Re: How to change image when a key is pressed?

    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...
  12. [SOLVED] Re: How to change image when a key is pressed?

    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.*;...
  13. [SOLVED] Re: How to change image when a key is pressed?

    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...
  14. [SOLVED] Re: How to change image when a key is pressed?

    //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.*;
  15. [SOLVED] How to change image when a key is pressed?

    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...
  16. How to find whether a number is palindrome or not?

    Can any one provide the simplest code to check whether a number is palindrome or not?
Results 1 to 16 of 16