Search:

Type: Posts; User: jm24

Search: Search took 0.09 seconds.

  1. Replies
    4
    Views
    1,134

    Re: Multiple Collision Detection in Invaders Game

    Actually that was the problem haha. I messed with the timer a little bit and got it to work. Thanks anyway though :)
  2. Replies
    4
    Views
    1,134

    Re: Multiple Collision Detection in Invaders Game

    I'm honestly not completely sure. I think it has something to do with the timing of the laser moving upwards and which collision it happens to be checking at that moment. It does register some...
  3. Replies
    4
    Views
    1,134

    Multiple Collision Detection in Invaders Game

    Ok so I'm not getting any errors with this code or anything, but there is a small problem. Basically I'm making an invaders game and to hold the different invaders I have an 2D array called invaders...
  4. Replies
    3
    Views
    5,265

    Re: Change a JLabel value that is in another class?

    Awesome! Thanks it worked perfectly :cool:
  5. Replies
    3
    Views
    5,265

    Change a JLabel value that is in another class?

    So I'm making a pong game that's almost done, but the one problem I have is that the JLabel that should display the score is in the main class on the JFrame and I need to change the value of it in...
  6. Replies
    17
    Views
    2,023

    Re: Choosing the jpanel to draw on?

    Yea I figured that was my problem. I just wanted to make the whole thing in one class, but yea I guess that's not possible. Thanks for the help! :cool:
  7. Replies
    17
    Views
    2,023

    Re: Choosing the jpanel to draw on?

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

    @SuppressWarnings("serial")
    public class PongDrawer extends JPanel implements ActionListener, KeyListener {
    JFrame table;...
  8. Replies
    17
    Views
    2,023

    Re: Choosing the jpanel to draw on?

    Ok I just added panel to the JFrame before I made it the content pane but it's still not drawing anything. I also did table.getContentPane().add(panel); instead of table.setContentPane(panel);
  9. Replies
    17
    Views
    2,023

    Re: Choosing the jpanel to draw on?

    Yea but I'm saying how would I specify so that it will draw on panel. I think I remember something about using the getGraphics() method, but I don't remember where to put it. Lol sorry for my...
  10. Replies
    17
    Views
    2,023

    Re: Choosing the jpanel to draw on?

    Well what I'm really asking is how I would add the paintComponent to the JPanel panel. Would I have to make the JFrame and JPanel and such in the main class to do that?
  11. Replies
    17
    Views
    2,023

    Re: Choosing the jpanel to draw on?

    This is my main class


    public class PongMain {

    public static void main(String[] args) {
    PongDrawer game = new PongDrawer();
    game.display();
    }
  12. Replies
    17
    Views
    2,023

    Re: Choosing the jpanel to draw on?

    No as in I had that before you told me lol. I still have the problem, which is that it's not drawing on the JPanel panel for some reason.
  13. Replies
    17
    Views
    2,023

    Re: Choosing the jpanel to draw on?

    Lol sorry I should have said that I already have all that stuff (I thought it would be implied lol)
  14. Replies
    17
    Views
    2,023

    Choosing the jpanel to draw on?

    I'm trying to draw on the JPanel panel, but for some reason nothing shows up when I run the code. Is it because I have to set the panel on which to draw? If so, can someone please tell me how to do...
  15. Replies
    1
    Views
    2,554

    Alternative to thread.sleep?

    Ok, so basically I want to use a swing timer and an actionListener and use thread.sleep in the middle of the actionPerformed method to make it wait 2 seconds before doing the next action. The...
  16. Replies
    10
    Views
    1,769

    Re: Help with actionListener and buttons

    Alright well thanks for the help anyway. I'll try to figure this out lol.
  17. Replies
    10
    Views
    1,769

    Re: Help with actionListener and buttons

    No the name of my main class is MoleMain but yea I get that last line every time I export it into a runnable jar file and try to run it
  18. Replies
    10
    Views
    1,769

    Re: Help with actionListener and buttons

    I would but I'm not really sure how to do that lol. And yea I was almost sure it was ok to use == as long as I wasn't messing around with aliases or anything like that but idk.

    EDIT: Oh ok I get...
  19. Replies
    10
    Views
    1,769

    Re: Help with actionListener and buttons

    So wait, I can have two different actionListeners within the same class? (sorry I'm a bit of a noob lol) Also if you could show me an example of the way you're saying to use casting with the try...
  20. Replies
    10
    Views
    1,769

    Help with actionListener and buttons

    Ok so basically I want this program to change the text of a random JButton out of the 9 on the panel every 5 seconds (I have a timer firing with intervals of 5 seconds) to "mole" and then wait 5...
  21. Re: Problem with adding an arraylist of jbuttons to a jpanel

    Haha wow it's funny because I knew that too. I guess I just didn't catch the error in the code. Thanks for the help :cool:
  22. Problem with adding an arraylist of jbuttons to a jpanel

    Hello, I'm having a problem with the following code where I keep getting the following error:

    Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 9, Size: 9
    at...
Results 1 to 22 of 22