cross-posted: Java Assignment Question
Type: Posts; User: Fubarable
cross-posted: Java Assignment Question
Cross-post: How would I create this solution algorithm using pseudocode?
OK, but the data itself will be held by the model. The GUI only provides a view to the data and nothing more.
No. It needs access to the model via the control. Again, the JPanels above only...
Below is another example uploaded as a .zip file although in reality it's a runnable .jar file:
1437
A single file example of it is posted below:
import java.awt.*;
import...
You have only one model object, and as mentioned by copeg above, you hook it up to the view object via the control. If set up well, this can often be done with just a few lines of code in the main...
You have the usual problems that people complain about with singletons -- risk of tight coupling, difficulty in mocking, difficulty in testing, risk of more than one instance if more than one class...
Or even briefer:
public static final byte[] NUMBER_BYTES = {0x31, 0x20, 0x74, 0x6f, 0x20, 0x31, 0x30};
Always, ALWAYS, enclose all blocks in curly braces, even one line blocks. This includes all if blocks and else blocks.
Doing this will solve your problem.
You should simplify your problem to solve it. Just use a simple text file and a very simple Java program that reads in the text file into say a collection of Strings. If and when that works, move to...
I mean using printStackTrace method of Exception:
}catch(Exception e){
e.printStackTrace();
}
Your catch block does not post informative information. If you instead print a stacktrace, what errors do you see? Also, are you sure that you want to use files? You might consider using resources...
Welcome. Most of us don't change diapers though. Best of luck!
I would recommend that you not use the default package (meaning that it is in no package at all), that you put all classes in appropriate packages, and then give it a try again. Please let us know if...
public class OneToTen {
public static final byte[] NUMBER_BYTES = {
0x4f, 0x6e, 0x65, 0x2c, 0x20, 0x54, 0x77, 0x6f, 0x2c, 0x20, 0x54,
0x68, 0x72, 0x65, 0x65, 0x2c, 0x20,...
First look for obvious problems, such as: Where do you add the JMenuBar to the JFrame? JFrame has a method for this, setJMenuBar(...), and I don't see it being called anywhere.
I suggest that you...
It's a common mistake to try to find a specific example of the exact code you're looking for. Rather Just study the basic Java tutorials and the API related to this issue and you'll learn how to code...
We can't read minds, and so if you need our help, you'll need to tell us more. Likely the error is not due to classes being in different classes, but honestly given what you've posted, I have no idea...
This is a double post of an already active question: http://www.javaprogrammingforums.com/java-theory-questions/16777-help-needed-know-how-code-running.html#post71106
If I were a moderator on this...
c = c + 1; isn't necessarily in error per se. It's just when you add a char to an int, you get an int, so for this to work you must cast the result as a char:
c = (char) (c + 1); // this works...
Surely you don't want us to simply do your work for you right? Usually it's best for you to attempt to solve this yourself first, and then if that doesn't work, post your code attempt with specific...
Consider using nested JPanels with the outer JPanel using BorderLayout. It holds a JPanel on its WEST side that can use BoxLayout, and then it holds another JPanel in the BorderLayout.CENTER position...
No, it takes lack of laziness. Please go do your own grunt work. Don't just dump it in this or other forums.
A NullPointerException (NPE) means that you are trying to use a variable that has not been initialized yet. The exception will tell you which line of your code is causing the error, and so you'll...
So if I am understanding you correctly, you are asking if you can create a class that inherits from another class that is located in a different package. The answer is "yes" as long as that other...
Most here would love to help you, but all you've done so far is post your requirements. No one is going to do this for you of course, but to be able to help you, we must see a clear answerable...