java之swing表格实现方法
作者:cj_gameboy 时间:2023-06-05 09:44:03
本文实例讲述了java之swing表格实现方法。分享给大家供大家参考。具体如下:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;
public class test extends JApplet{
public void init(){
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
final String[] colHeads = {"Name", "Phone", "Fax"};
final Object[][] data={
{"cai", "1122","1122" },
{"jie", "2222","2222" },
{"tt", "3322","3322" }
};
JTable table = new JTable(data, colHeads);
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp = new JScrollPane(table, v, h);
contentPane.add(jsp, BorderLayout.CENTER);
}
}
希望本文所述对大家的java程序设计有所帮助。
标签:java,swing
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
java程序中protobuf的基本用法示例
2022-06-12 07:33:46
java模拟http的Get/Post请求,并设置ip与port代理的方法
2021-11-25 11:30:57
Java中super和this关键字详解
2023-03-18 15:49:08
![](https://img.aspxhome.com/file/2023/4/63054_0s.png)
c# for循环中创建线程执行问题
2021-09-15 20:43:23
![](https://img.aspxhome.com/file/2023/3/108703_0s.png)
关于SpringSecurity配置403权限访问页面的完整代码
2023-11-13 02:03:59
![](https://img.aspxhome.com/file/2023/3/86833_0s.png)
C# WinForm窗体编程中处理数字的正确操作方法
2022-11-21 04:57:10
Java基础知识之Java语言概述
2023-11-28 04:36:35
![](https://img.aspxhome.com/file/2023/0/60080_0s.jpg)
C#实现给图片添加日期信息的示例详解
2021-07-29 21:19:28
![](https://img.aspxhome.com/file/2023/2/84462_0s.png)
spring boot 静态资源处理方法
2022-07-14 22:12:42
![](https://img.aspxhome.com/file/2023/6/108356_0s.png)
自己动手写一个java版简单云相册
2022-09-08 01:28:56
![](https://img.aspxhome.com/file/2023/5/129965_0s.png)
SpringBoot如何优雅的处理全局异常
2021-06-09 21:28:13
![](https://img.aspxhome.com/file/2023/5/69355_0s.png)
Android之来电秀实战示例
2023-10-05 08:02:27
![](https://img.aspxhome.com/file/2023/5/137665_0s.png)
详解JAVA类加载机制
2023-11-08 04:05:16
![](https://img.aspxhome.com/file/2023/0/74910_0s.png)
Android的RV列表刷新详解Payload与Diff方式异同
2023-07-05 13:17:29
Java AWT中常用的三种布局管理器详解
2023-02-11 20:55:25
![](https://img.aspxhome.com/file/2023/6/65586_0s.png)
C#之CLR内存原理初探
2023-02-16 00:58:09
![](https://img.aspxhome.com/file/2023/7/102277_0s.png)
C#控制台进行文件读写的方法
2022-02-13 22:03:27
Android编程ProgressBar自定义样式之动画模式实现方法
2022-02-10 12:54:29
![](https://img.aspxhome.com/file/2023/1/117061_0s.png)
Flutter实现图文并茂的列表
2023-11-10 21:21:45
![](https://img.aspxhome.com/file/2023/3/139283_0s.jpg)
Android防止按钮重复点击示例代码
2023-10-11 18:15:24
![](https://img.aspxhome.com/file/2023/8/138768_0s.gif)