Okay, so as many of you who participated in our last FTV League may know, I have been working on a new and improved Java Applet that will write up all the forum code for the user quickly and easily without the need of writing it themselves or trying to hunt out and change words from a pre-written template.
I already have pretty much ALL of the Applet written out and working, but I've come upon two stumbling blocks (which should have quick/easy solutions) that I wanted to request help with.
First, I am trying to find a component like JTextArea that will allow me to use commands like \n and the like (which JLabel does not allow) and will allow the user to both highlight the text (like a JTextArea) AND right-click it - which JTextArea does not allow (even if you setEditable(true)).
JTextPane and JTextEditor both do NOT allow you to access the right-click menu apparently.
My second problem:
The way my applet currently works, it displays a pretty little GUI with buttons, radio buttons, and labels, etc. After the user has finished making all the selections, I
CODE setVisible(false);
removeAll();
add(JTextArea(code));
setVisible(true);
all with requisite getContentPane's or etc as needed. My problem is that the JTextArea doesn't actually become visible...you have to click in the Applet area for it to pop into visibility (otherwise you just see a white box). I've tried removing setVisible, rearranging where they are in the code, all to no avail. I'm not sure WHY it wont become visible, but it wont.
I've also tried getFocus(), btw.
So, if anyone knows a fix to either of the above problems (an effective way to display the string or a way to make the JTextArea be visible without clicking on the applet), please enlighten me.
If you'd like to see how the Applet currently looks, refer to my post in the FTV League Discussion thread, where you can grab a copy of the JApplet - this may be particularly useful for people trying to fix the second problem to see what I'm talking about.
If you would like snippets of relevant code, feel free to ask.
And yes, I know I can make the JTextArea I currently have prettier, but I plan to replace it anyway (remember?) so I haven't bothered doing anything with it.
I already have pretty much ALL of the Applet written out and working, but I've come upon two stumbling blocks (which should have quick/easy solutions) that I wanted to request help with.
First, I am trying to find a component like JTextArea that will allow me to use commands like \n and the like (which JLabel does not allow) and will allow the user to both highlight the text (like a JTextArea) AND right-click it - which JTextArea does not allow (even if you setEditable(true)).
JTextPane and JTextEditor both do NOT allow you to access the right-click menu apparently.
My second problem:
The way my applet currently works, it displays a pretty little GUI with buttons, radio buttons, and labels, etc. After the user has finished making all the selections, I
CODE setVisible(false);
removeAll();
add(JTextArea(code));
setVisible(true);
all with requisite getContentPane's or etc as needed. My problem is that the JTextArea doesn't actually become visible...you have to click in the Applet area for it to pop into visibility (otherwise you just see a white box). I've tried removing setVisible, rearranging where they are in the code, all to no avail. I'm not sure WHY it wont become visible, but it wont.
I've also tried getFocus(), btw.
So, if anyone knows a fix to either of the above problems (an effective way to display the string or a way to make the JTextArea be visible without clicking on the applet), please enlighten me.
If you'd like to see how the Applet currently looks, refer to my post in the FTV League Discussion thread, where you can grab a copy of the JApplet - this may be particularly useful for people trying to fix the second problem to see what I'm talking about.
If you would like snippets of relevant code, feel free to ask.
And yes, I know I can make the JTextArea I currently have prettier, but I plan to replace it anyway (remember?) so I haven't bothered doing anything with it.