jtable

vertical scroll bar vanishes after resize the column width

Hi, I hava a table in a scrollPane. There are 6 columns in my table. I want the last 2 columns to be wider than other columns. But after I set the size of the columns, the vertical scroll bar disappeared. If I comment out the code for resetting the columns width, everything goes back to normal. Could anyone tell me what's the problem o...

Java - get text of selected JTable header

So, JTable has some headers ... (with rowsorters) ... I want : text of header which has been clicked I do NOT want : name of selected column (lets pretend, we dont click on cells just on headers) Anyone knows? ...

Getting a JTable with a custom table model to show up in JScrollPane

Hello. I am attempting to create my own custom TableModel for my JTable (because I would like to incorporate a row of JCheckBox's into my table.) I have the JTable in a JScrollPane as well. Before I attempted to incorporate the JCheckBox and custom AbstractTableModel, the JTable would show up fine if I used the default (Object[][], Ob...

How to easily Bind any database VIEWS to a jtable with netbeans?

Netbeans can easily bind jtable with relational database tables(mysql,deby,etc).. How can i easily bind "Views" table to a jtable... If that is not possible, is there any easy way to join tables and display the result in JTable... Thank you so much. ...

JTable sort with dual tables to keep in sync in Java 1.4

Is there a way where I can have a parent JTable sort value be passed and set the sort of a child JTable in Java 1.4? What I have is a parent JTable of subjects with about 6 columns and a child JTable that is a subset of the parent JTable with the same columns. What I need to do is when the user selects a item from the parent JTable and...

Java Swing: Recalculating values in a JTable, to use the TableModel or write a custom editor?

Hi, I use a JTable to display data sourced from a streaming data feed. Each data point is represented as an object of type X, which has one field of interest, lets call it valueField. My implementation of the TableModel interface has a HashMap of objects X keyed on X.getId(). The users of the GUI are able to change the values us...

Showing Data in JTable with Max Count.

Hi, There is a jbutton in my Jpanel , when i clicked it , it loads up my Jtable , sometimes a query return so many records (500 rows). So i wanna restrict it with 5 record.When query return i wanna count it if its higher than 5 then Jtable shows up only first 5 record when user click Forward button it will shows up next 5 record.When us...

How to use Vector as DataSource ?

Hi, I wanna use this vector as DataSource for my Jtable.There is 4 Column here (ADI,SOYADI,BABA ADI, ANA ADI). ResultSet is adding every row to vector named _kisivector.This is my DataSource.But i dont wanna get whole records at start.I wanna get only 5 records from this vector.Than there will be 2 button , back and forward.When i click...

Adjust size and colour of JTable-grid and make cells resizable

How to adjust the size and colour of grid in JTable and how to set JTable so that length of column or row can be increased and decreased by dragging it? ...

Editing JTable from RestulSet Table

Continuing this question. My problem is that I can not edit my JTable. I get an exception and the Object value instead of what I should be seeing. I am using the ResultSet Table code with a MS-Access database and with a few modifications. My code can be found here. I run into an error when I rs.updateRow() is called. java.sql.SQLExcept...

Java - how to make "runnable" JTable?

Hello, I have problem creating JTable, which will show every second some text. I make MainView, place JTable and have Class "TableHandler(JTable table) implements Runnable" which is supposed to add some text in intervals to JTable ... Here is run method : public void run() { for (int i=0; i<5; i++) { table.setValueAt("text",...

How to instantiate an empty JTable?

I am climbing the java learning curve, and for the first time I need a JTable. What I would like to do is display an empty table, with all cells vacant except for column headings. Then as a result of user actions, the tables is filled with a mix of strings, integers, and floats. All the examples I find on the web create tables that ar...

How can i sort java JTable with an empty Row and force the Empty row always be last?

I am using JTable with an empty row at the bottom of the table in order to give the ability of adding new line to the table. After insert or writing data in the empty row i am adding automtacly a new empty row below it. (It suppose to act like the Microsoft visual tables) I am using the java default row sorter, The problem is that i n...

JTable won't show column headers.

I have the following code to instantiate a JTable: the table comes up with the right number of rows and columns, but there is no sign of the titles atop the columns. public Panel1() { int nmbrRows; setLayout(null); setBackground(Color.magenta); Vector colHdrs; //create column headers colHdrs = new Vector(10); ...

Jtable content won't refresh after add the data as a parameter

Hi, I have a jtable, everything works fine if I set the table data as a public variable(don't put it on tablemodel's parameter). But right now I need to set the table data as a parameter, and the table won't refresh its contents. I print out some cell value and the rows number, they are both updated and correct. Just the display is not c...

NetBeans(Java) - JTable header problem

Hi, I use JTable GUI component with NetBeans. I want to create multi-line headers I am able to this, when I create custom renderer for table headers BUT I don't want to, because I like default one (I use it everywhere else in program). So the problem is : How to make header heigher? My code : String headers[] = new String[3]; ...

Add a row to a jTable each pass through a loop??

I have a jTable and a jButton. When clicked, the button's actionPerformed method calls another method that contains a while loop and adds a row to the table's model (DefaultTableModel) each time though the loop. The while loop can run for a few minutes so I want it to show in the GUI the rows being added to the table each time, one by on...

Use SwingWorker to add rows to jTable and update the GUI

I'm trying to create a jTable that, once a button is clicked, adds rows one at a time with just a number starting at zero and continues adding rows until it gets to row 1000000. I'm using a SwingWorker's doInBackground, publish and process methods to increment the row counter and and add each row, which means the gui doesn't freeze while...

How to set the background color of target cells in a jtable?

I don't want to set the background color for all the cells in the jtable, just the ones I choose. How do i go about doing this? ...

How to indicate that a column in a table is sortable (UI design question)?

In the application that I am working on, there is tabular data (for the record, it is a Java Swing app using JTables). In some cases the data is sortable by clicking on the column headers. What I want to know is what is a good way to indicate to the user if a given column is sortable or not? I have come up with the following possibiliti...