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

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?

Related

Options menu for one cell in java table

Welcome
In this table, I made the column mentioned cells editable to let the users make the needed value as they want ...
But they told me the values of this column can take just one of the values: 25,50,75,100, so, they asked me I make an options menu (like it is mention in the pic) allow them to choose directly the needed value and working fast.
So, how can I solve it, please!
(note: I'm working with java swing)
It's not the same question, but you can take a look on solution from below question:
How do I create a right click context menu in Java Swing?
you should create such listener, and add it to your Cell / Table.
you can take a look on below question to understand how to add listener to your Cell (it's not obvious :/)
JTable cell listener?

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.

Eclipse Java JTable vs Table

For my company, I'm working on an Eclipse plugin which should do the following: show a table with sentences from the active editor that are incorrect in some way, accompanied by proper feedback. So far, so good.
However, sometimes the sentences/feedback are incorrect. I want a third column with checkboxes so that, when clicked, the related sentence/feedback combination is put in a different tab. Because I'm only programming in Java for 2 weeks now, I'm stuck: the plugin (written by my predecessor) is a class 'public class feedbackView extends ViewPart' using TabFolder and Table. But when I try to include checkboxes, all examples on the Internet use JTable. And I cannot get JTable to work in the current script and in the way I want (in Eclipse itself, instead of in a separate frame).
Ideally, I want Example of feedbackView with TabFolder. If in the 'Hide?' column the checkbox is checked, the sentence/feedback row should be transferred to the '||Hidden||' tab.
After this long introduction (hopefully clear), my questions:
Can I use Tabfolder/Table for this? Or
Should I use the JTable class (and how can I get this to work)?
Thanks in advance!
JTable is from Java Swing, with is the Java GUI component. Where Eclipse Table is the an Eclipse GUI component. There are two different world, for building GUI's in Java.
Warning: You can not mix these two different Java GUI libraries!

Swing (Java) Category List

everyone.
I'm currently working on a project which is written in Java. As one of my features I want the application to display List of workout plans that are saved in the databases. Furthermore, I want the user to be able to click on particular instance of the workout Plan so that new JFrame is opened with further details which will be populated from the database.
You can see what I mean in the picture below, this is how I want my list to look like.
For this application I'm using Swing components to model my GUI. Its very important for me that those items within a list will act as a button so that you can open up new JFrame, but at the same time the content must be populated from database. Also when a new Workout Plan is added to the database the list must be updated and the item that will be added to that list has to be of the same format.
My question is whether it's possible to design that kind of list using Swing components, and if it is how would you do it.
Any suggestions or help will be appreciated.
I'm not that familiar with swing but, I think you can set your panel into a grid layout. Then divide the grid layout so that there are, for example, 10 rows and 1 column. Afterwards, fill the grid layout with JButton's. Whenever a button is pressed, it will open up a JFrame.
I feel like there's a better way to do this though.

Multiple JTables with dynamic names

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.

Categories

Resources