Multiple JTables with dynamic names - java

I'm working on my first java program. I'm making a Project Manager program.
The base idea is that i have a JList which contains the names of the Co-workers. If you double click one of the names a JTabbedPane will pop up a new tab and will be populated a JTable what is containing the specific persons tasks.
And here comes the tricky part. I want to use this JTable to modify the datas so i need to give a specific name to the JTable so i can use that later on in my methods to call it.
The question is how can i create dynamic names to these tables so i can call it later (something like this: table+tabID).
OR
Is there a better solution to my problem?
Any help or advice is greatly appreciated.

I solved it. The solution was:
I made an ArrayList<JTables> to store the tables and I'm using the tab indexes to get the proper table.

Related

How to implement codes in GUI formed apps in Java swing?

I really have a hard time finding help on internet since no one is giving examples on how to implement codes in GUI formed app. So I have my interface created and whole app works through buttons. Every code I find is for just workspace line, or how would I call it. Now I want do the following:
I have an input page for registering members in the gym. When I register them, they go to jTable. Now, I want to make it possible to edit columns Weight and Instructor from the table. I saw how to add ComboBox into table column, but don't know how do it in GUI formed app, where table is not created by the code. And I want to edit Weight column with jTextField the same I would do with ComboBox for instructors.
The question can also be: How do I define these custom things in table (or any other object in GUI Java App) when I already have GUI table set on place with drag and drop in NetBeans?

Select from a UI list and perform an action

we're building a small chat app for an assignement in our university. I have a question regarding how I can implement something.
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.
Any pointers and advice in general would be greatly appreciated.
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.

Connecting two columns in two different comboBoxes

I connected MySql database with Java app, I see data from two different columns (Items, Price) but I want to connect them somehow, for example, if choose in first combobox item "Desk" the other combobox should automatic find "Desk" price and display it in second combobox. Anyone have idea how to make that ?
You could write a changelistener for the first box, then have it go into another sql query which will populate the second box. Check out this guide, it'll explain to you how to do it
https://docs.oracle.com/javase/tutorial/uiswing/events/changelistener.html
First, I think that you don't want to ComboBoxes being correlated in such a way. There must be a better design for your gui.
Is your ComboBox from JFace? There are JFace Data Bindings. Normally, you use them to automatically update your model if someone changes values in the user interface. If your model contains an id from your database, both comboboxes can have a binding to this id.

How to put multiple checkboxes into a form with Apache Wicket?

I want to create a webpage that looks like this one:
This is done using a table. Each row describes an object and I want to be able to select multiple of those objects. When one of the submit-buttons is clicked, I want to get the list of selected objects. I know there is the class CheckBoxMultipleChoice, but the generated output is not what I need.
I think I should use a ListView, but since the number of objects is dynamic, I do not know how to access the states of the checkboxes. Could you please tell me how I can achieve this layout?
You should use a CheckGroup with one Check component in each row.

Multi column list in Swing

First of all, I'm using Swing in Java. In my application, I need to have a multi column list (if that's what I should call it). What I mean by a multi column list is something like windows explorer's list view mode of showing files and folders.
So, all of the columns of my list are going to have the same object (files for instance), but I want to be able to put them on different columns, in order to have a wider view.
Does anyone have any suggestion how I can do that?
Thanks,
Reza
One may use:
list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
Alternatively you can use a JScrollPane. This will handle creating scroll bars and such for you, which would solve the issue of running out of vertical space, and thus eliminating the need for extra columns.

Categories

Resources