Components
- Table based attribute builder, each type of available node, with it's possible attributes, appearance, and label are all defined.
- Includes a node/chooser pop-up window, to allow the user to see the different types of node styles possible.
Notes
First thing is to figure out javas table objects.
Editable spreadsheet style tables are available through the JTable class, They're created like This :
//Build our JFrame
JFrame frame = new JFrame("Table Demo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Put the Column Names into a String Array
String[] columnNames = {"One", "Two", "Three", "Four"};
//Put the data into a nested Object Array.
Object[][] data = {
{"This", "Is", "The", "First"},
{"This", "Is", "The", "Second"},
{"This", "Is", "The", "Third"}
};
//Build the JTable passing it both arrays
JTable table = new JTable (data, columnNames);
//Add the table to a ScrollPane, this intermediate step
//is necessary in order for the column names to be displayed
JScrollPane scrollPane = new JScrollPane(table);
//Add the Scrollpane, and do all the other
//Gui Work to get it ready to present, then make
//it visible.
frame.add(scrollPane);
frame.setSize(400, 400);
frame.pack();
frame.setVisible(true);
Attached is an attempt to implement a table model class in order to allow for better control. Haven't quite figured out whats going on yet, but I'll deal with it more later.
Figured out the problem with the abstract table model, I had placed it in the BuildGraph class. After I fixed that I realized that the way I've constructed it, using this table model can cause a crash. A little poking around and I realized that depending on get and set methods for the table data and column descriptions allowed for a table to be created without any data. I've fixed it temporarily by adding the following constructor :
public void myTableModel(String[] c, Object[][] d){
columnNames = c;
data = d;
}
I've left the get and set methods because I figure that they could be useful at some point down the road, but for now they're a little superfluous. New BuildGraph is attached as BuildGraph02-05-07.java