This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Swing- taking inputs based on a previous user input. Please help!

 
Kritika Kamath
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm developing a Swing application for the first time, so please forgive me if my doubt is a little naive.

To test my application, I have currently hardcoded some text labels and fields in a JPanel, so that a user can enter input details for a maximum of 3 segments. But this limits the maximum number of segments to 3. However, the requirement is that when the user enters the number of segments (could be greater than 3 as well), corresponding number of input sets need to be taken.

Screenshot attached, with values entered.

Basically I want to know how I should go about taking the inputs from the user.

Thanks in advance!
hAUL ROUTE INFO.png
[Thumbnail for hAUL ROUTE INFO.png]
 
Rob Camick
Ranch Hand
Posts: 2475
8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would probably use a JTable. Then you create an "Add Segment" button to add a new row to the JTable.

Read the section from the Swing tutorial on How to Use Tables for more information and examples.
 
Kritika Kamath
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob! I will try that..
 
Campbell Ritchie
Sheriff
Pie
Posts: 47232
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Presumably you can write a non‑GUI application which stores its state somehow.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic