Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Hacking simulation game console

843806Dec 8 2007
i want to make a very simple hacking simulation game which contain some buttons and a console but i am facing some problems with the console here is what i tried

1-i made the console a java edit panel i want to put the path string and make the user unable to delete it or edit it so i tried to use the .settext option but it delete the previous jedit panel content and i found the i am able to delete the the path .
2-once the user hit enter i want to see what he wrote and if what he wrote match any of the commands then some operation will be executed i didn't found any thing to handle the enter key so i used key pressed event and then i used this code to check if there is an enter
String hold=jp.gettext();
if(hold.endswith("\n");
do operation //this is where the operation excution will happend
the code worked just fine but is there is any function to handle the enter key event
now
1-which text panel is more appropriate to use it as a console?
2-how to set a non editable string inside the text frame so it would act as user path?
thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 5 2008
Added on Dec 8 2007
0 comments
165 views