W
wooks
I would appreciate some urgent assistance with this simple code.
When it run it displays a blank frame. What do I need to do to get the
JTable to display?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class RunFileMatcher extends JFrame {
RunFileMatcher() {
JFrame frame = new JFrame("MatchTable");
frame.setSize(600,400);
String[] columnNames = {"File", "Size"};
String dataValues[][] = {
{ "A", "234" },
{ "B", "43" },
{ "C", "89.2" },
{ "D", "9033" }
};
JTable table = new JTable(dataValues,columnNames);
getContentPane().add(new JScrollPane(table), "Center");
frame.setVisible( true );
frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
}
}
When it run it displays a blank frame. What do I need to do to get the
JTable to display?
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
public class RunFileMatcher extends JFrame {
RunFileMatcher() {
JFrame frame = new JFrame("MatchTable");
frame.setSize(600,400);
String[] columnNames = {"File", "Size"};
String dataValues[][] = {
{ "A", "234" },
{ "B", "43" },
{ "C", "89.2" },
{ "D", "9033" }
};
JTable table = new JTable(dataValues,columnNames);
getContentPane().add(new JScrollPane(table), "Center");
frame.setVisible( true );
frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
}
}