• Post Reply Bookmark Topic Watch Topic
  • New Topic

textarea question  RSS feed

 
Mich Robinson
Ranch Hand
Posts: 260
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a popup that displays textual info and sometimes gets text input from the user. I'm using the following code:
This shows a nice text area and an input field underneath it.
The getGameHistory() method just returns a long string detailing the current game.

Is there a way of just showing the text area without the input field underneath?
Can the text area also be used for input instead?
Mike

PS sorry for the rather basic question.
 
Ron McLeod
Saloon Keeper
Posts: 1564
222
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mich Robinson wrote:Is there a way of just showing the text area without the input field underneath?

Take a look at the JOptionPane documentation - there are different methods for a various types of dialogues.
 
Mich Robinson
Ranch Hand
Posts: 260
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, using a different method stopped the input field from appearing. Thank you.

I'm still unsure how to use the text area as an input field though. Is this possible? any clues?

Mike
 
Rob Camick
Ranch Hand
Posts: 2788
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JOptionPane uses a JTextField when you use the showInputDialog(...) method. That is why you use one of the other methods that allows you to specify ANY component to be added to the option pane.

Check out the section from the Swing tutorial on How to Make Dialogs for more information and examples.
 
Mich Robinson
Ranch Hand
Posts: 260
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, already read that. I always come away feeling that the writers of these manuals might be knowledgeable programmers but they're pretty poor at getting that info across. Then again it might be just me.

I'll keep trying random examples and see what happens. Thanks for the help

Mike
 
Rob Camick
Ranch Hand
Posts: 2788
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always come away feeling that the writers of these manuals might be knowledgeable programmers but they're pretty poor at getting that info across.


Well, no tutorial can possibly cover every programming situation you will encounter.

The point of the tutorial is to give you some working examples to start from. Then you can use the examples and information found in the API to customize the examples for your requirements. You can also search the web for examples.

I spend more time answering questions then asking questions because I also learn from other who post answers and give additional approaches to solving problems.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!