Search:

Type: Posts; User: snowguy13

Page 1 of 2 1 2

Search: Search took 0.12 seconds.

  1. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Okay. I'll do that in the future, after this is solved (pointless to start a new thread halfway through a solution).

    g2d.setPaint() is telling the g2d (Graphics2D Class, right? or is g2d an...
  2. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Hmm... A random curiosity struck me. Is there any way to create a gradient fill for components, instead of just using...

    <Component>.setBackground(Color c);

    ...? Or perhaps a special type of...
  3. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Alright, now I've got a new little idea. Soon, I will have my OpenGameGUI completed. One of the sections of the OpenGameGUI will be the "Levels" tab. What I want to happen is this: when the user...
  4. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Okay. Thank you! That is good to know before I accidentally write 20 more methods than I actually need to. :P
  5. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    This question probably belongs more in object-oriented programming, but I've grown attached to this thread now. :P

    The way I'm organizing my tower classes is that I have a superclass, called...
  6. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    I did now. Problem fixed. :P Thanks. :D
  7. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    -_- Well yes, I surmised that much. However, how is the enter key's code not equal to KeyEvent.VK_ENTER? I don't know what else it would be...
  8. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Well firstly how did you get the program to display this:

    ..?

    And if you say the listener is being called, why aren't my statements printing?
  9. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Oh. I think I'm misunderstanding you. By printlns, I thought you meant this (which is what I did):
    if(e.getKeyCode() == KeyEvent.VK_ESCAPE)
    {

    ...
  10. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Okay. Here's the SSCCE I made.

    package GUIs;

    import java.awt.GridBagLayout;
    import java.awt.GridBagConstraints;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import...
  11. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    I have to go now... Sorry for the abruptness. I'll work on that code and put it here when I finish.
  12. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    printlns? Why would it have those? None of my program is done in the terminal.


    I don't completely understand... Do you want me just to copy the code for the NewGameGUI (from which the above...
  13. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Alright I have a new problem, this time with a KeyListener.

    Here is the code I'm using for the KeyListener:

    //KeyListener for NewGameGUI
    private class KListener implements KeyListener
    ...
  14. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    YESSSSSS!

    I got the rename function to work! Now, I can start working on the actual game GUI! And then, it's the end of the easy stuff, for I have to start thinking about complex tower, bullet,...
  15. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    ...THANK YOU!!!!! It works GREAT! :D :D :D :D :D

    It was as simple as adding this:

    fr.close();
    br.close();

    where fr is a FileReader, and br is a BufferedReader!

    Thank you so much! And...
  16. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Well, it's complicated to explain, but I think it may be the GUI itself that is using the files. The GUI I picture above creates the panels inside of it by this code:
    private static String[]...
  17. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Okay. Now I'm working on saving/deleting files and the GUI's associated with the process. I have a pretty awesome load game GUI (at least I think) and now I'm working on the delete button. The only...
  18. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    I forgot to cast the Component to a JLabel. Nevertheless, I do not intend to apply this MouseListener to a JPanel, so there is not an issue with that.

    After some exploring, I found out how it...
  19. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    That's what I thought. But then how does it work with getComponent()?

    If...

    //Allow an implied MouseEvent, e; let's also say that JPanel trigger caused the event

    JLabel x = e.getComponent();...
  20. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    So, if you would say...

    ref2 = "Cake";
    System.out.print(ref1 + " " + ref3);

    ...the result would be...

    Cake Cake

    ...?
  21. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Well, I'm thinking that I'm going to have to create my own events. For example, there may be an event that enemies used called a HitByBulletEvent, and there may be an event that towers use called a...
  22. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    The getComponent() method is in the MouseEvent class, though I am relatively sure that it will also be in other Event classes. It returns the Component that triggered the event.

    If you look at my...
  23. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    No, that's not what I meant.

    I meant to ask how could I manually write code that would do the same thing as the getComponent() method -- return a component and have whatever edits that are...
  24. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    I remembered my other question! But, it has a length explanation before I get to it.

    In the main menu code, I had multiple JLabels formatted to look like menu buttons. So, I worked on a...
  25. Replies
    60
    Views
    9,982

    Re: Tower Defense on Java

    Really? Okay, I'll have to try that. Of course, I'll have to totally switch my method of thinking to test the class idea! :P

    But again, thanks for your help! :)

    I still can't remember that...
Results 1 to 25 of 32
Page 1 of 2 1 2