Search:

Type: Posts; User: MW130

Search: Search took 1.58 seconds.

  1. Two questions: setting an image icon and closing up a game

    Hi guys!
    I recently made a game. (really corny!)
    But, I want to package it and give it to my friends
    I know that I can create a jar of it and add the images to the folder, but what I would...
  2. Replies
    1
    Views
    86

    [SOLVED] Re: Problem in Swing Game

    Never mind guys, I fixed it :D
    Guess I'm the javamaster
  3. Replies
    1
    Views
    86

    [SOLVED] Problem in Swing Game

    The problem I am having is that I have a character peter griffin that runs into a burger, and when he does, he and the burger are supposed to reset to a random position. The game runs, other things...
  4. Re: I always need to resize my window to see my programs

    Hi! Thanks for your reply
    Unfortunately, that didn't solve it for me :(
    Here is an example program:

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

    class SwingT extends JComponent {
    public void...
  5. I always need to resize my window to see my programs

    Whenever I make something in Swing, I always need to resize the window for me to see the graphics on the window. I have been told to use the pack() method on it, which I have, but the problem with it...
  6. Replies
    1
    Views
    102

    Why isn't my program showing the image :(?

    I couldn't really figure out the easiest way to display an image. I tried the following way (in my code below), and it runs with no error but does not display the image. The image is called...
  7. Re: I get no error, my window opens, but the graphics don't show

    So, I have to extend JComponent?
  8. I get no error, my window opens, but the graphics don't show

    I wrote a program to display a rectangle within a window, but it won't show. Is it because I didn't call the paint() method?
    Sorry for indentation, I am using a text editor

    import javax.swing.*;...
  9. Replies
    16
    Views
    865

    Re: Java animation code

    I can't figure it out could you fix it?
  10. Replies
    16
    Views
    865

    Re: Java animation code

    Ok, my new code is:



    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    import javax.swing.Timer;

    public class Square extends JFrame {
  11. Replies
    16
    Views
    865

    Re: Java animation code

    Ok. I know i'm not supposed to really explicitly ask, but do you think you could make my code work? I know you're one of the best on the site and could do it in an instance(no pun intended :P )....
  12. Replies
    16
    Views
    865

    Re: Java animation code

    Where should I define the setBackground and repaint methods?
  13. Re: Objects as parameters, and implicit calling?i

    Oh, ok. Does this only apply to the paint method though? For all others you have to explicitly call them in the main method? Thanks Norm, and i read a part
  14. Re: Objects as parameters, and implicit calling?i

    Hi Norm. I know what constructors are, and realize that doing new Carz() is just calling the constructor. What I don't get is how paint method is executed without being called. Thank you.
  15. Objects as parameters, and implicit calling?i

    Hey guys! I had a question on two things. First, can you explain the parameters part of public void paint(Graphics g){} ? I don't understand graphics g? Is it an object? It doesn't have an instance...
  16. Replies
    16
    Views
    865

    Re: Java animation code

    ok here is the code..





    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.ActionListener;
    import javax.swing.Timer;
  17. Replies
    16
    Views
    865

    Re: Java animation code

    It still does not work I made it an action listener
  18. Replies
    16
    Views
    865

    Re: Java animation code

    I did and it still doesn't work.
  19. Replies
    16
    Views
    865

    Re: Java animation code

    Hey! I redid the code as you asked, and now I only get one error. Could you help me figure out how to fix this error? Below is the code.


    import javax.swing.*;

    import java.awt.*;

    import...
  20. Replies
    16
    Views
    865

    Java animation code

    Hello I am new to the forum and hope you can help me I put my code and then the errors I receive thank you so much

    import javax.swing.*;
    import java.awt.*;
    import javax.swing.Timer;
    public...
Results 1 to 20 of 20