• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

textarea question

 
Ranch Hand
Posts: 287
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 4499
572
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 287
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 287
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic