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...
Type: Posts; User: snowguy13
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...
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...
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...
Okay. Thank you! That is good to know before I accidentally write 20 more methods than I actually need to. :P
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...
I did now. Problem fixed. :P Thanks. :D
-_- 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...
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?
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)
{
...
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...
I have to go now... Sorry for the abruptness. I'll work on that code and put it here when I finish.
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...
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
...
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,...
...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...
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[]...
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...
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...
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();...
So, if you would say...
ref2 = "Cake";
System.out.print(ref1 + " " + ref3);
...the result would be...
Cake Cake
...?
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...
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...
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...
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...
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...