Jerry McClain

Greenhorn
+ Follow
since Jul 15, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jerry McClain

Thanks Saager. Adding the JScrollPane did the trick. Columns now appear. Can you send me the link of the Java API that talks about adding a scrollpane will cause the columns to appear, if u have it.
Also, I had the getValueAt method, but it seems like I forgot to paste it up there.
22 years ago
I have a JTable within my application and utilizing a class that extends AbstractTableModel to display the columns and data. However, the columns are not being displayed. I simply created a array of Strings and passed that array to getColumnName method do display the columns. But it is not working. Do I need to implment an instance of TableColumnModel as well? If not, any ideas on what can be wrong ? Thanks
Here's the relevant code:
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
import java.util.*;
public class VerbTableModel extends AbstractTableModel {
final String[] columnNames = {"Present", "Present Subjunctive", "Future", "Conditional", "Preterite", "Imperfect"};
String[][] cellData = new String[columnNames.length][6];
public boolean isCellEditable(int row, int col){
return false;
}
public int getColumnCount() {
return columnNames.length;
}
public int getRowCount() {
return cellData.length;
}
public String getColumnName(int col) {
return columnNames[col];
}
}
This code goes into my class where I display the GUI and where the table exists:
JPanel tablePanel = new JPanel();
tablePanel.setLayout(new FlowLayout());
tm = new VerbTableModel();
JTable verbTable = new JTable(tm);
tablePanel.add(verbTable);
22 years ago
I am completely lost on this issue, so as much information I can get would be helpful.
Is there an object that will hold several arrays? Then when I call that object, I would like to reference specific element from a specific array held within this object. Does anything like this exist ?
I am just reading about Collections, but I have not found anything that could do this.
Thanks for any help.
22 years ago
Are you sure about that Mike ?
I tried extending the the WindowAdapter from the inner class, but then the ActionListener method does not seem to be recognized. When I try to compile my code, its states the actionPerformed method cannot be found even though its within the inner class. Are you sure you can extend a class from an inner class ?
Thanks
22 years ago
I am writing a java application and trying to implement event handling. I'm trying to implement a WindowsAdapter and a ActionListener. Since I'm already extending JFrame for my Java app, I can't extend the WindowsAdapter. So I decided to create inner classes for the WindowsAdapter and the ActionListener. My question is: is it possible to have two inner classes within an eclosing class ? If not how do I get around my problem of trying to implement WindowsAdapter and ActionListener ?
Thanks
22 years ago