• 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

Swings

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am working on a swing application that retrives the details of flights that take off on a particular date and span of time.I want to limit my JTextFields(that diplays the flight name) & Jbutton that retrieves details based on the no of flights retrieved.Can any Swingers help me Swing thro this

Hari
SCJP
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can probably get you a start, but I don't at all understand what you are trying to do. Are you trying to display labels and text fields dynamically?

From where are you retrieving the data?
 
Narahari Gundappa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi alan

The application looks somewhat like this.
A.There is a Flight Plan page that takes in the date and route of flights.
B.The next page retrieves the names Flight id/nums that are flying ont tht date at that time from the DB.Now, this is where i need the dynamic textfields and buttons, ie, I want to limi the tf's and but's to the number of flights retrieved.That is 10 Flights 10 tf's ,20 -20 and so on dynamically.
TextField ------>Flight Id/Name Button------>(named details)to retieve details from the DB.

Hope u can help me.

hari
 
C. Alan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I think I understand what you are trying to do... I'll start with some rough psuedocode and see if that helps you understand. (This is just how I would do it, and there are many different ways it can be done)



The actual code for dynamically creating buttons is not too hard... do the buttons need listeners?

The loop will look something like this:

Now, to create the panel, you just need a loop to extract the elements. Depending on which version of Java that you have, you will have to cast the button back when you want to add it to your panel or frame, ie:
myPanel.add((JButton)flightNumbers.get(i)
myPanel.add((JLabel)flightTimes.get(i)

Does that get you going a little?

[ April 28, 2005: Message edited by: C. Alan ]
[ April 28, 2005: Message edited by: C. Alan ]
 
Narahari Gundappa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank Alan!
It seriously got me going!!???
But, its all very vague.Any ways I will try it!!! and get back to you!!

Bye
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Narahari,
I would suggest you to use a GridLayout for the couples JTextField/JButton.
Once you retrieve how many flight/textfield/buttons you need, you can create a grid that will contain all the textfields and buttons you need.
If you need to update the entire thing in a second moment, you can still remove the components in the panel where you put the grid and redo the same thing.

I hope this helps
Giovanni
 
C. Alan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know it's vague.. the idea was to get you started on your project, and then as you progress, we can help you work through different aspects.
 
Narahari Gundappa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI All,

Well its all fine!!!i shall come back with many more.....

bye
Thank You Al..an
 
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic