Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

JTables, AbstractTableModels and columnNames

$
0
0
Hello Java programmers. I have a game that I am working on, and I am at the stage where I am displaying the player's game history. I am using a JTable and an AbstractTableModel. The thing is, however, that I have the AbstractTableModel defined in a different Java file than the JTable is. The JTable is, in fact, defined in its own class. My JTable will display, but it doesn't have the columnNames displayed even though I explicitly defined them in the AbstractTableModel and overrode a method for displaying their names. Is it possible for me to display the column names in the JTable with my code the way it is? I am using
public GameHistoryTable(GameHistoryTableModel m) 
	{
		//Set up the table here.
		table = new JTable(m);
		table.setPreferredScrollableViewportSize(new Dimension(800,120));
	}



as constructor for JTable. Here, I included all of the GameHistoryTable(), so that you can see me giving the AbstractTableModel as parameter.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>