1
need help!
I’m developing an application in college that will use Bubblesort - yes! We had the misfortune to catch this one! - to draw some data within a table.
I created the table through a class that extended Abstracttablemodel, but I can’t make it stay in the jPanel that I created with Swing. Does anyone know how to solve ?
https://github.com/irom-theprogrammer/ProgramaDengueV3
At this link is the netbeans project - the code is a bit messy. I hope you understand.
In the 'table' package are the table definition classes. In the 'screen' package is the Telaregistrar class - which is the class I’m trying to place the table in. Base on it.
I appreciate the attention of those who can help.
You must place the table inside a Jscrollpane, not inside a Jpanel.
– user28595
The table is inside Jpanel and this is inside Jscrollpane.
– Iago Mello
This order is wrong, jtables are special components that can increase in size according to the data contained in it, should be placed inside an adaptive container, otherwise they will not display the columns correctly (will not display the header) and not all rows in the table. Invert this order ai, jtabel should be inserted straight into jscrollpane.
– user28595
Wouldn’t it have been better to put the source code here? You don’t have to take the link from github, but putting the source code would be better. Also, seriously you want to use Bubblesort? With so much ordering algorithm out there simple to implement and much better (Mergesort, Quicksort,
java.util.Arrays.sort(int[])
, etc), you take just the one that is considered to be the standard example of a bad algorithm?– Victor Stafusa
I ran the code and saw no problem. The table is being displayed normally.
– user28595
Victor, we were given several topics and this was drawn for us. We are obliged to use it. And I didn’t put the code, because there are several classes and packages at inheritance levels, and you better see this. You understand?
– Iago Mello
Diego. Regarding the adaptive container. I hadn’t thought of it, but in fact the jpanel cuts the table when it’s big. I’ll check that too. The code compiles normal. The problem is that a table is being generated (which is done in Abstracttablemodel) outside the swing window I created. So there are two tables there. I need the new table to take the old one’s place.
– Iago Mello