JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

That's because the new lines are coded in the string as \n characters (the first at position 4 in the string), which are new lines in an ordinary text area, but ignored in an HTML context. To display them in HTML you need to replace all "\n" by "<br>" befreo displaying it. (There's a String method for that!)

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

So how do you think your enter/return key presses are represented in the notes variable? If you're not sure, try searching for "\n" characters in the string, eg
System.out.println(notes.indexOf("\n"));

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

OK, so let's play a guessing game. Does the notes string have a \n in it?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

YOu're not giving enough info to diagnose this properly (eg what are the eaxct strings that are in the areas). It seems you have new lines in the address etc, so what's different about the two problem descriptions?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

If it doesn't then why did I bother to make that post? Did you try it???

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

That should be "<br>" not "<br />"

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Insert a "<br>" into your input wherever you want to start a new line.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

HTML <BR> tag is like a \n

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

What's (presumably) happening is that you have a null reference in your program somewhere. You pass that as a parameter to a Swing/AWT method, that calls other methods until the null reference is actually used and the NPE is thrown. In this case that finally happens in AWT's Component class. The dubugger tries to show you the line of code in question, but it doesn't have access to the Java API source code.
You can safely ignore Component because that's not where the problem is caused. Look at the complete stack when the NPE is thrown and look for the last entry that is in your code. Thast's where your bug is really manifesting itself.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You don't suppy a lot of info, but I'm 99% sure you should have a Player class with one instance for each player. Obe class per player misses the whole point of classes.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Line 23 you create a new data array every time you go through the loop, thus loosing the data from every earlier pass. You probably want to just create one data array, before you enter the loop.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You could try to trim() both strings to get rid of any leading or trailing white space.
The NPE must be because userName2 is null in that case.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

What output do you get from lines 12 and 13?
Also, print the length() of those two strings in case you have anything like trailing blanks or newline characters in there.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

This sounds like a problem with the specification, not with your Java!
In reality there can always be two or more equal "highest" grades (eg supose Mr Genius scores 100% on every subject). You have a choice of just printing one of them or printing them all. In real life you would probably have to print all the equal highest grades, but maybe your teacher wants something different, or maybe because this is a beginner class you can assume all the grades are different and forget about this problem for now. You need to ask your teacher.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Some slightly confusing replies here, so to clarify...
To understand these examples you need to be clear on the difference between a String object (contains a sequence of characters stored on the heap somewhere) and a String variable (contains a reference (like a pointer) to a String object).

new String("cat") creates a a new String object containing the character sequence "cat"
String q = ... creates a reference variable that refers to that new String object
String r = q; creates another reference variable, and copies the value (reference) from q into it. r and q now both refer to the same String object.
new String(r) creates another new String object. It gets its character sequence by copying the character sequence from the String that r refers to. You now have two distinct String objects which contain identical sequences of characters
String f = ... creates a reference variable that refers to that new String object

Philippe.Lahaie commented: +1 +6
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

can't pass the String object as a parameter to create a string with that

Suggest you read the API doc for String. Passing a String as a parameter to a String copnstructor is perfectly OK.

public String(String original)

Initializes a newly created String object so that it represents the same sequence of characters as the argument; in other words, the newly created string is a copy of the argument string.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

ps: depending on how you define your rows, it may also be true that the row numbers increase going upwards (top row has the highest row number), whereas Java y coordinates always increase in the downwards direction.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Here's a little grid in [row][col] notation:

[1][1]  [1][2]
[2][1]  [2][2]
[3][1]  [3][2]

now here's the same thing in (x,y):

(1,1)  (2,1)
(1,2)  (2,2)
(1,3)  (2,3)

see how they are in opposite order?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

my Location objects are created with a similar form (x (corresponds to row),y (corresponds to column)

No, you use x for horizontal ( = column number), and y for vertical ( = row number). That's where you are confused.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I didn't try to understand all your code, but maybe your problem starts from the fact that you are mixing [row][col] coordinates and x,y coordinates? Note that x corresponds to col and y corresponds to row, so the order of the coordinates is opposite between those two representations. Sooner or later it's inevitable that you will get something the wrong way round!

eg line 183:

if (gameBoard[from.getxLocation()][from.getyLocation()] ...  // equivalent to gameBoard[col][row]
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Something like, but not exactly...
those variablea are all Strings, so for safety you need equals(...), not == (in this particular case there's a good chance that == will work because there are probably only two String ionstances underlying all those variables, but sooner or later somethiong's going to break that.)
Personally my immediate instinct is to make Player a class - yes it's going to be a small simple class, but in the end it's going to make everything clearer and safer.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Like the message says, the case expressions must be constants, and player1/2 are variables. Looks like David was having a bad day when he posted that. :)
You could make player1/2 values of an enum, then you could use them in switches etc.

DavidKroukamp commented: lmao +0
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

does generics could be imply on LinkList too?

Yes, absolutely.
ps: You may be able to speed up the learning process by having a quick look at Java's own LinkedList implementation and how that uses generics.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Assuming that by now you're fixed the original code problem...
Your LinkedList and Stack classes should be updated to support generics so youy can code something like
Stack<Movie> tS = new Stack<Movie>();
which will save you a load of uneccessary casts, and maybe some bugs.
... but if your course hasn't covereed that yet, just set this post aside for later.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

... also, you can't define a method inside another method - you try to define push inside the constructor (that would have been more obvious had you posted the exact complete error message rather than your own summary of it)

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

That doesn't look like the standard Java LinkedList. Is that a class you wrote/were given? If so, we'll need the code for that too.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

If you replace your JTextArea with a JEditorPane the you can still use HTML to format the contents
http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JEditorPane.html

instead of plain text you just add HTML tags, stuff kinda like
"<HTML><H1>" + gui.results.getText() + "<\H1><BR><center>Customer Signature ... etc

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

JTextFields support a basic subset of HTML tags, so you can achieve a lot of formatting by setting the text of the JTextField to some valid HTML (start with <HTML> )

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Basically you can construct your JFrame any way you want. Read through the link that stultuske provided, especially "Printing the Contents of a User Interface" page

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I'm with stultuske on this one. Use the knowledge you already have to construct the whole page as if it was a JFrame, then use the print api to print that instead of displaying it on the screen.
ps sorry @softswing, but I would advise some caution about roseindia - their quality control doesn't seem too good, so the code there may be OK, or it may be badly out of date, or it may just be bad code... and if you're a learner it can be hard to tell which is which.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

When you have a main object that the other objects need to refer to, it's normal to pass the main object as a parameter to the other object's constructors, eg

... in Main...
PwGUI pwgui = new PwGUI(this);
FirstPageGUI fpgui = new FirstPageGUI(this);

... in PwGUI ...
Main mainObject;
public PwGUI(Main m){
    mainObject = m;
    ok.addActionListener(this);
    ...

mainObject.setPage(2);

... etc
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Main.setPage(2) Main is the name of a class, so whatever follows Main. is in a "static context". setPage is an instance mtheod, not static, so it needs an intance when you call it.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

David's post has incorrect syntax for a switch - it's missing the "case" keyword. Check the official doc for the correct version.
ps: A switch using a String is only available from Java 1.7 onwards.

DavidKroukamp commented: thank you my mistake +8
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Maybe there's a constructor for that class that takes that value as a parameter???

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

If a class has a private attribute, and the developer didn't supply a setter, that means you're not supposed to set it (eg look at the get methods for the String class - you won't find any corresponding set methods because they don't want you to change a String object in any way). If it is required to set the value then there should be a set method to do that - maybe you need to write that, I can't say because I haven't seen the question.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You can read your big file into a BufferedImage, then use its getSubimage method to pick out the separate icons, and pass those to the ImageIcon constructor

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

I'm really sorry man, that was for the AWT text field, not JTextField. I should have said add a DocumentListener. You'll find more info and an example in the API doc for JTextField. My apologies for that mistake.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Post the exact complete text of the null pointer error message, and the exact line(s) of code it refers to.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Burning the CPU in an infinite loop is a very bad way to look for changes.
Add a TextListener to your JTextField. It will be called once every time the text is updated in any way, so that's the ideal place for you to check the length.
See the API documentation for details.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

You need:
1: a reference to the instance of "another class" that has the JPane you are interested in
2: a method in "another class" that returns the JPane
Then you can just call that method on that instance to get a reference to the JPane and thus its contents

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Without getting very picky, that looks OK now.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Some piece of code that you are executing inbetween the two is re-setting it. This is easy to find, it just a bit tedious, that's all: just keep moving your print statements to find out execatly which method call is changing it, then go into that method and find out why/where

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster
  1. Is there some piece of code that's overwriting your input with the original value when you press the button?
  2. Have you managed to declare or create two gui variables or notes variables?
  3. Did you try that print as the very first statement in the processSaveEdit method?
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

That looks a lot better, can't see any obvious faults, so...
Same advice as always - lots of print statements so you can see what's being executed and where the values are going wrong

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Sorry, but if you don't give details of the error(s) then it's hard to comment on them. Post the exact complete text of the null pointer error message, and the exact line(s) of code it refers to.

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

This looks a bit like it's a cross between a create-a-new-repair and an update-an-existing-repair that won't do either correctly.
Like I said before, repair.setNotes is enough, it's completely redundant to re-add the repair to the map.
What's missing in the code you posted is the bit where you get the text from the text field where the new notes have been enterd/edited.
Also, you only try to update the repair if there is no ref (!) and then if the ref is NOT (!) found - that seems exactly the opposite of what it should be!

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

JToolbar's addSeparator() method adds a standard sized gap

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Probably because on line 102 you add the file chooser to your window?

JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

http://bugs.sun.com/view_bug.do?bug_id=6199075
It's a Java compiler bug. Fixed in Java 7.

DavidKroukamp commented: good finding I guess my neybeans complied using jre 6 rules but not compiler +8
JamesCherrill 4,733 Most Valuable Poster Team Colleague Featured Poster

Thank you David. So what could it be about hszforu's configuration that's different?