Netbeans 如何设置JTable的列标题?
我们可以轻松地在netbeans中拖放Netbeans 如何设置JTable的列标题?,netbeans,Netbeans,我们可以轻松地在netbeans中拖放JTable,但我在属性中看不到任何选项来更改netbeans中的列标题。请尝试以下文档: 这是建议的方法之一: // The table in SimpleTableDemo.java declares the column names in a String array: String[] columnNames = {"First Name", "Last Name",
JTable
,但我在属性中看不到任何选项来更改netbeans中的列标题。请尝试以下文档:
这是建议的方法之一:
// The table in SimpleTableDemo.java declares the column names in a String array:
String[] columnNames = {"First Name",
"Last Name",
"Sport",
"# of Years",
"Vegetarian"};
// Its data is initialized and stored in a two-dimensional Object array:
Object[][] data = {
{"Kathy", "Smith",
"Snowboarding", new Integer(5), new Boolean(false)},
{"John", "Doe",
"Rowing", new Integer(3), new Boolean(true)},
{"Sue", "Black",
"Knitting", new Integer(2), new Boolean(false)},
{"Jane", "White",
"Speed reading", new Integer(20), new Boolean(true)},
{"Joe", "Brown",
"Pool", new Integer(10), new Boolean(false)}
};
// Then the Table is constructed using these data and columnNames:
JTable table = new JTable(data, columnNames);
另一个学习Java而不是使用编辑器来创建程序的重要原因。如果编码是唯一的方法,那么这仍然是石器时代。如果IDE可以完成程序员的工作,我们就不需要程序员了。像Netbeans这样的IDE提供的快捷方式对于经验丰富的程序员来说非常有用。但首先你需要了解如何编程。事实上,IDE不是在为您服务,而是在为它服务。祝你好运。@M.Sanjay,IDE非常有助于编译、调试等,但你更擅长逻辑设计类和实现易于维护的结构化代码。如果您需要切换,从一个IDE生成的代码将无法在另一个IDE中维护(手动更改除外)。