How would I go about doing this? I have a program with a lot of objects (JButtons, JLists, Tabs, etc.) that I need to be able to save to a file during any time that my program is running and then be...
Type: Posts; User: captain
How would I go about doing this? I have a program with a lot of objects (JButtons, JLists, Tabs, etc.) that I need to be able to save to a file during any time that my program is running and then be...
that was in there with my save code. I just forgot to take it out
I could only see one possibility that was in the main method. I changed it to Example ex = new Example(); I honestly don't know what else it could be. It compiles in eclipse for me.
I was able to cut it down to about 340 lines and it still compiles
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;...
Wow i'm sorry. I cut some of the methodcreation class out. hope that helps. also the jbuttons have icons set for them, but that shouldn't stop it from compiling
I'm sorry I just tried to cut it down as much as possible. i edited it. check again please
Ok i cut it down as much as I could. still a lot to read through, sorry..
Basically the program allows the user to create a java program with visuals then translate it into code and export it to a...
So I've created a program that allows you to create a tab when you click on a JButton. that button allows you to name the tab and then it is created. once the tab is created, it adds a new JPanel to...
I'm having trouble figuring this out. I would normally just do something like
JButton blah = new JButton("blah");
String str = e.getActionCommand();
if(str.equals("blah") {
//do something
}
I'm trying to write a program that can create lines in a JPanel by clicking and dragging the mouse. That part I have down. The next thing I'm trying to do is create a perpendicular line to the line...
nvm guys answered my own question
Hey everyone. I'm trying to create a MouseListener event so that when a Tile is clicked on my grid it will black out all tiles that are of the same color as the one I clicked, except the one I...
I got it guys! I kinda worked through it my own way. It may not be the most efficient but tell me what ya think. I ended up avoiding 2D arrays altogether and just used the gridlayout.
Thanks for...
Sorry about this guys but I'm still having trouble. I just can't seem to get it to color only a certain amount of tiles. It either colors them all one color or gives me a nullpointer at
that is my code. the only error I'm getting is a type mismatch where I would have been putting the equation that I posted above. I understand why its giving me that, but I'm not sure what the correct...
So I've been given a practice test for one of my CSC courses that is asking me this:
Provide the definition for the Java class Point so that it supports
the three Java statements that appear...
so you're basically saying something like this
public void setColor() {
for(int i = 0; i < tiles.length; i++)
if(tiles[i] == null){
setBackground(Color.YELLOW);...
Well my thought process for that piece of code was that it would set the i-th tile in the array to yellow. I'm not sure where I would assign a value to it initially though.
Exception in thread "main" java.lang.NullPointerException
at Tile.setColor(Tile.java:16)
at GameBoard.buildTilePanel(GameBoard.java:55)
at GameBoard.<init>(GameBoard.java:39)
at...
Alright so basically what I'm trying to do is create a 16x16 square board of tiles (256 total) and when I run the program I need it to set up the tiles randomly into the following colors
39...
Alright so basically what I'm trying to do is create a 16x16 square board of tiles (256 total) and when I run the program I need it to set up the tiles randomly into the following colors
39...