Forum: Java 23 Days Ago |
| Replies: 20 Views: 568 I see one thing that could be a problem, getValues.nextLine()=="n" will (should) always return false, because it compares the memory addresses, so you should replace it with... |
Forum: Java 23 Days Ago |
| Replies: 3 Views: 428 That's only necessary if there are other things on the JPanel (buttons other panels etc..)
The problem is that your image is null, as for why, I am not sure, but that is the reason that the... |
Forum: Java Jun 14th, 2009 |
| Replies: 17 Views: 899 Look at the java tutorial on collections there is an entire trail there, here is a link: Collections trail (http://java.sun.com/docs/books/tutorial/collections/index.html) |
Forum: Computer Science Feb 1st, 2009 |
| Replies: 30 Views: 3,139 |
Forum: Game Development Jan 14th, 2009 |
| Replies: 1 Views: 784 you never redisplay the scene, for that kind of animation to work you have to redisplay for every frame. |
Forum: Java Sep 9th, 2008 |
| Replies: 3 Views: 4,599 using JFileChooser you can set the type of file that the chooser will open or save to by using a filter HERE (http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html#filters) the... |
Forum: Java Sep 9th, 2008 |
| Replies: 9 Views: 2,053 your professor is correct except for one thing, Scanner Doesn't have a nextChar method, i believe it is the only primitive not supported.
use this instead:
Scanner yourName = new... |
Forum: Computer Science Aug 26th, 2008 |
| Replies: 9 Views: 1,849 well, that's good advice for me, all of those fields have undergraduate classes at my school, so, i will just take some of them while working towards a computer science degree |
Forum: Computer Science Aug 25th, 2008 |
| Replies: 9 Views: 1,849 WOW! i have the same questions, I'm glad there is a thread on it now |
Forum: Java Aug 25th, 2008 |
| Replies: 1 Views: 921 why would you have to use Swing? you can just take a URL as a command line argument, or as a prompt from within your program, you don't need a GUI. |
Forum: Java Aug 24th, 2008 |
| Replies: 2 Views: 954 keyboard.next(); returns a string, not an int, so int value = number is trying to assign a string value to an int type. try putting this instead: int value = Integer.parseInt( number ); |
Forum: Java Aug 24th, 2008 |
| Replies: 7 Views: 1,916 true enough, but ImageIO will most likely lead to easier to read code, and is also very clear what is being done. |
Forum: Java Aug 24th, 2008 |
| Replies: 7 Views: 1,916 or use ImageIO.read() (http://java.sun.com/docs/books/tutorial/2d/images/loadimage.html) and ImageIO.write() (http://java.sun.com/docs/books/tutorial/2d/images/saveimage.html) |
Forum: Java Aug 23rd, 2008 |
| Replies: 14 Views: 3,101 yes, the blurry text is because of int rounding error. a better way to do it would be affinetransform, but i haven't used it much, and the sun tutorial... |
Forum: Java Aug 23rd, 2008 |
| Replies: 14 Views: 3,101 ok, I wrote these two classes CustomPane is the one that has the rotateImage() method.
//CustomPane.java
import javax.swing.* ;
import java.awt.* ;
import java.awt.image.* ;
public class... |
Forum: Java Aug 22nd, 2008 |
| Replies: 14 Views: 3,101 i didn't notice it had these calls... i'll write a method like this myself, that doesn't use afflinetransform.. but it will be slow, i should be able to post one before midnight, but likely in the... |
Forum: Java Aug 22nd, 2008 |
| Replies: 14 Views: 3,101 a search i did i found this:
public static BufferedImage rotate(Image image, double angle, int cx, int cy){
int width = image.getWidth(null);
int height = image.getHeight(null);
//The... |
Forum: Java Aug 17th, 2008 |
| Replies: 7 Views: 1,387 i believe that with setJMenuBar it doesn't matter what layout manager you use, it will always be at the top, but i may be wrong |
Forum: Java Aug 17th, 2008 |
| Replies: 7 Views: 1,387 you never set the menubar for the JFame
this.setJMenuBar(menu) |
Forum: Java Aug 11th, 2008 |
| Replies: 5 Views: 1,246 i don't really know, i assume you have read the sun tutorial on focus (http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html), but i don't see how you include an applet, being the root, i... |
Forum: Java Aug 11th, 2008 |
| Replies: 5 Views: 1,246 i don't know whether this will work, but try setting using .setFocusable(false) on the buttons. i don't think it will work, but it's worth a try
EDIT: it may ruin the way that you use the... |
Forum: Java Aug 8th, 2008 |
| Replies: 9 Views: 674 ok, but why would bluej do things differently? |
Forum: Java Aug 7th, 2008 |
| Replies: 9 Views: 674 weird, i get the same type of results as your from the command prompt
6893
huh i cannot explain that, when bluej runs it through it's virtual machine it must be doing something different than... |
Forum: Java Aug 7th, 2008 |
| Replies: 9 Views: 674 these are the results i got from running in bluej are they similar to yours?
for some reason the last call to println() didn't do anything, i don't have an explanation for that though.
64979064 /... |
Forum: Java Aug 1st, 2008 |
| Replies: 8 Views: 668 you don't have too, you can store the information that the GUI takes in a text file that has a certain, syntax that you design, so that it can save the information in a file that can be reopened... |
Forum: Java Aug 1st, 2008 |
| Replies: 9 Views: 1,893 not very, you do need the class files in the jar, you don't need the name of the jar file at compile time. that last code should work fine except that you need the class files in the jar too, and... |
Forum: Java Aug 1st, 2008 |
| Replies: 8 Views: 668 if you just need something to hold info, why do you want it to be html? usually info would be stored in XML, but if it won't be web based then you could just use a txt file, with info that your... |
Forum: Java Aug 1st, 2008 |
| Replies: 8 Views: 668 why did you post this twice?
if it will be stand alone why not write to a plain old file? |
Forum: Java Aug 1st, 2008 |
| Replies: 9 Views: 1,893 thanks Alex Edwards
VernonDozier if you don't know how to add images to a jar there is a thread here (http://www.daniweb.com/forums/thread42410.html) if you search daniweb there are many image and... |
Forum: Java Aug 1st, 2008 |
| Replies: 9 Views: 1,893 package the images in a jar file with the classes and use getClass().getResource(path); to get a url for it and you can use the url directly as an argument to your ImageIO.read()
you won't get... |
Forum: Java Jul 31st, 2008 |
| Replies: 9 Views: 785 |
Forum: Java Jul 30th, 2008 |
| Replies: 9 Views: 785 |
Forum: Java Jul 28th, 2008 |
| Replies: 9 Views: 785 the only generation tool that i can think of at the moment is JavaCC, but i know there are more of them, try google for more options, if parser generator doesn't turn up anything you want try adding... |
Forum: Java Jul 26th, 2008 |
| Replies: 9 Views: 785 well there are parser generation programs, that probably will do it for you |
Forum: Java Jul 23rd, 2008 |
| Replies: 9 Views: 785 you could write your own XML parser with SAX or DOM, i'm not sure but i think DOM is the one that allows XSD, but i haven't messed around with it much :(
hope it helps :) |
Forum: Java Jul 20th, 2008 |
| Replies: 5 Views: 537 huh? backspace and entering a new number works fine, it gives the too high or too low message every time i press enter, and when i get it right it displays correct, hit new game it picks a new... |
Forum: Java Jul 20th, 2008 |
| Replies: 5 Views: 537 no it doesn't, just keep putting in numbers and pressing enter, it works fine.
what problem are you having? |
Forum: Java Jul 19th, 2008 |
| Replies: 19 Views: 2,643 i was going to suggest interfaces too, i think moveable is a good idea. i was going to suggest GamePiece as an interface with a method such as isValidMove(x,y), and maybe isAlive() and some others. |
Forum: Java Jul 19th, 2008 |
| Replies: 5 Views: 1,029 isn't that what i said, except with if's and not switch's? |
Forum: Java Jul 18th, 2008 |
| Replies: 5 Views: 1,029 well, you would use a(n)( series of) if statement(s) and put your print statements in it/them,
all you really need to write to more than one file is more than one PrintWriter, with different file... |