-1

we're building a small chat app for an assignement in our university. I have a question regarding how I can implement something.

ui

This is our ui. The big white part is a jTabbedPane where conversations the user is participating in will appear. The two small ones are where active groups and active users will appear.

I found out that I can populate a jcombobox from a linkedlist using .toArray. I don't know what ui element to use, in order to display the list elements one under the other, and being "selectable" (only one at a time). The concept is that the user will select a group and press "Join", to, well, join.

This is what I have in my as to how it will look in the end.

list

Any pointers and advice in general would be greatly appreciated.

Community
  • 1
  • 1
Ema Black
  • 63
  • 1
  • 12

1 Answers1

3

It looks like you're wanting to use either a JTable or a JList -- one with a custom renderer, a renderer that displays both the group name and its "status"(?).

If a JTable, then your key job is to create a TableModel that will accept your data well, either by using the DefaultTableModel (the easiest way to do this), or by creating your own model derived from the AbstractTableModel (a little more difficult, but more flexible).

For a more detailed answer, consider providing pertinent code, preferably as a minimal example program or MCVE.

Community
  • 1
  • 1
Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
  • We do not have code yet, I've taken it upon myself to create the UI and find how we'll implement stuff. The concept is that we'll have a list of objects "groups" which have a name and a status in the client program. Then I have to display at least the name, and preferrably the status as well. The join functionality is not relevant to this question, it's more to explain what I need (to pick a group to join) – Ema Black Nov 24 '16 at 14:28
  • @MrUber: Then you've got quite a bit of work ahead of you, but hopefully it will be fun and fruitful. You can find links to the Swing tutorials and to other Swing resources here: [Swing Info](http://stackoverflow.com/tags/swing/info). Good luck with your project. – Hovercraft Full Of Eels Nov 24 '16 at 14:32