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
Hi Garion, I'm afraid its not quite as easy as that (though its not too difficult either) You need to define a clipboard object, either local or System, and to implement the ClipboardOwner interface .. among other things. A good example of using cut/copy/paste is available here : JavaWorld - cut/copy and paste
Its not what you do, its the way you say you've done it.
Matt - No he doesn't. Not for simply cut/copy/pasting text. Garion - The only thing I can possibly derive from your NullPointerException, since you failed to tell us anything else about the error, is that m_textArea has not been instantiated yet? I don't know. Could you provide more of your code possbily, or at the very least, the exact NullPointerException error. It should tell you which component you are getting that error on.
*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.