Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Garion Winters

Greenhorn
+ Follow
since Oct 01, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Garion Winters

Will do. Thanks.
Oh, and sorry for first posting in begginer-- thought it still qualified, but also didn't notice we had a forum just for this stuff... should have known. My apologies.
19 years ago
Hi again, all.
I was having a minor problem, and wondered if someone could point me the right direction. Basically, within a GUI JFrame I want a button to pop up another dialog box, or what not. Then, I want that box to only be movable within the JFrame... if you move it out, it hides the portion that goes off. I guess this would make it a child window? Well, I am having trouble finding how to do this. Any places I should look, or examples I could see? Thanks again.
19 years ago
Wow. I can't believe I didn't catch that. Thanks a lot, Bill. I'm sure that was my problem with all the other areas as well. Sometimes we just have to remember the basics. Thanks again.
19 years ago
*smacks himself* Yes, I guess telling you what is really wrong would help. Sorry, I was a bit sleepy. Anywhere, first off, here is my entire code...

Well, this is without the copy/paste/cut... I had worked on it a while and was working on Save. Seems to be the same problem. The actual NullPointer occurs at
String fileText = m_textArea.getText();
I think it basically does everytime I try to getText or write using m_textArea, but I'm not sure why. Just let me know what you think.
19 years ago
Alright, yet another problem to tackle. Might not be that bad. Here is the thing-- I am having NullPointerExceptions when im trying to get the cut/copy/paste methods to work for a JTextArea.
I have buttons made for each, and an Action listener, like so...

Now, my m_textArea (is on screen and all) is what I take is causing the error. Is there something you have to do to make the methods work besides just call em like that? New to gui, so just wondering. Thanks a lot! You people are great
19 years ago
*smacks himself*
Oh, I see. Thank you very much. Helped out a bundle!
19 years ago
That is what I thought... but everytime I tried to do that, it says I can't. MyList is an interface, and it won't allow me to initialize it so. Hmmmm =(
I figure looking at the code they have would help greatly... just can't seem to find it for some reason. Thx everyone!
19 years ago
Hmm.. I wrote like 170 or so lines of code now, and that one part is STILL causing me errors... I tried adding a while hasNext part, to make sure there is a next before going on, but the test cases all still reveal a NULL POINTER EXCEPTION ERROR! ... here is where I am having the trouble

Silly thing is driving me nuts. Any suggestions?
19 years ago
(Sorry for the delay.. networking troubles)
Well, I have thought about basically extending our class, MyAbstractList, then for the constructor, make a new MyList by iterating through the startIndex and endIndex and add it to the new MyList. Of course, now I am having all null pointer exceptions (We have 10 test cases... all fail at the same point in the constructor)
Here is what I have. Any help would be great Thx again.
BTW... we can't change the constructor params.
The MySubList (what we are writing)

The MyAbstractList (that I extended)

And the MyList...

If you need to see any other files, let me know. We made a lot over the time, but those are the ones I can see as important. Can't get over the nulls...
19 years ago
Hi there. I was wondering if anyone could help me out here... We are currently doing a project that involves creating a new class called sublist. This takes params of (MyList list, int startIndex, int endIndex). It is basically a partial view of the list (MyList is used because we have been making our own). I'm not looking for an answer, just help here.
We are not to change that constructor, and if you edit anything about the sublist, it should change the actual list. (IOW if you look from the 3rd object to the 5th, and add a new one, it should be so in the original, non-sub list as well)
Any help would be appreciated.
19 years ago
Yup. I know its not really anything special, but all I can say is what is likely obvious: wait a bit to see what others say about it, and if there are too many problems wait a bit till they fix it. Also, if there isn't anything coming from it you need, it wouldn't hurt to hang around a bit (though you might not want to stick back forever )
19 years ago
It is the same kind of problem, different loop. Your program says: while(iter.hasNext())
What if iter doesn't have a next? Then it won't even execute the if nor the else part. See what I mean? It would avoid it altogether and jump out of the while loop and return nothing. Sorry for missing that!
19 years ago
Okay, I am getting the concept here, but I am having a brain fart or something and cannot think... could someone give me a simple example of code that would create a TreeMap, then add in a value for it. Then, if someone wanted to add another value for the same key, it would create a list for that key with all values in it (could be multiple linkedlists since there could possibly be one for each key). Thx.
19 years ago
If you notice your return part of code is within an if clause. What happens IF the case isn't true? Then nothing is returned. Hope that helps.
19 years ago
Hmm... still not getting it. Seems I am doing something really wrong. Anyway, any ideas would help, otherwise I will see what I can do.
19 years ago