Java怎么添加滚动条附源程序
privatevoidshowWindow(){this.getTable();JTableHeadermyt=table.getTableHeader();jp.add...
private void showWindow() {
this.getTable();
JTableHeader myt = table.getTableHeader();
jp.add(myt, BorderLayout.NORTH);
jp.add(table, BorderLayout.CENTER);
this.add(jp);
this.setTitle("表格实例");
this.setBounds(300, 100, 550, 300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
this.setResizable(false);
} 展开
this.getTable();
JTableHeader myt = table.getTableHeader();
jp.add(myt, BorderLayout.NORTH);
jp.add(table, BorderLayout.CENTER);
this.add(jp);
this.setTitle("表格实例");
this.setBounds(300, 100, 550, 300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
this.setResizable(false);
} 展开
1个回答
展开全部
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class Day09_B extends JFrame {
private static final long serialVersionUID = 1L;
Day09_B() {
showWindow();
this.setTitle("表格实例");
this.setBounds(300, 100, 450, 300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
this.setResizable(false);
}
private void showWindow() {
this.add(new JScrollPane(new JTable(20,5),20 ,30));
}
public static void main(String[] args) {
new Day09_B();
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询