View Single Post
Old 10-25-2012, 08:10 PM   PM User | #3
Basic Chaos
New to the CF scene

 
Join Date: Oct 2012
Posts: 3
Thanks: 2
Thanked 0 Times in 0 Posts
Basic Chaos is an unknown quantity at this point
Question this is like what I need, but the data should be program generated not typed in by me

Code:
import java.awt.*;
import javax.swing.*;
class TableDemo {
	public static void main(String args[])
	{
 
		JFrame frame = new JFrame("Commission Sample Table");
		String columns[] = {"Total Sales","Total Compensation"};
		Object data[][] = {
				{"$400,000","$62,000"},
				{"405,000","$67,000"},
				{"410,000","$67,925"}
		};
		JTable table = new JTable(data,columns);
		frame.setVisible(true);
		frame.setBounds(0,0,600,600);
		frame.add(table.getTableHeader(),BorderLayout.PAGE_START);
		frame.add(table);
	}
}

Last edited by Basic Chaos; 10-26-2012 at 12:16 PM.. Reason: I edited this because I looked at my code ant it made no sense.
Basic Chaos is offline   Reply With Quote