Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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

Display an array in a swing type box

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am very new to Java. I am trying to create a swing display of a java keyword array that I have entered, but I'm not sure how to do so. The code so far is as follows:



} // end class

What I would like to do is under the switch case 2, have a list of all the array elemets (except 0) display on either a table type format (5 columns, 10 rows), or just some neat list format inside a swing dialog box. Any help would be appreciated.
 
Marshal
Posts: 28126
94
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The obvious way to display a "list" in a Swing GUI is via a... JList. Have a look through the Swing tutorial -- that should give you a better start than what you have so far.
 
Scotty Steven
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This code looks a little more involved then what I was hoping to achieve. I do not want to select anything from the list. I just want it to display the list on the screen. I am a beginner, and that code is too advanced for me.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> This code looks a little more involved then what I was hoping to achieve.

doesn't get much easier than one line of code

"f.getContentPane().add(new JScrollPane(new JList(javaKeyword)));"

 
Scotty Steven
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Michael Dunn

Thanks. This gives me something to study and learn from. You rock!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic