100分求助!!如何表格多列头和多行头?如何合并单元格?谢谢大侠!! 简单的话,使用colspan和rowspan复杂的话,使用多个表格 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 表格<%@ page contentType="text/html;charset=GB2312" %><%@ page import="java.util.*" %><html><title>The test of my first programming</title><body><table border="1" frame="box" width="50%" bgcolor="yellow"><tr><th colspan="5">The family</th></tr><tr bgcolor="#ffbbaa"><th>boyfriend</th><th align="left">Name</th><th>Sex</th><th>Age</th><th>Birthday</th></tr><tr align="right"><td rowspan="2">GiGi</td><td>xuguo</td><td valign="bottom">Male</td><td>22</td><td>1982.4.19</td></tr><tr align="right"><td>xuguo</td><td valign="bottom">Male</td><td>22</td><td>1982.4.19</td></tr></table><br><button>kjfskdjfk</button><p>You are thejdklsjk</p><table border="1"><caption>The information of the family</caption><colgroup span="3" width="25%" align="right" valign="bottom"></colgroup><thead><tr><th>Name</td><th>Sex</th><th>Age</th><th>Position</th></tr></thead><tbody><tr><td>xuguo</td><td>Male</td><td>22</td><td>Student</td></tr><tr><td bgcolor="#ff00ff">zhoukun</td><td>Male</td><td>22</td><td>Student</td></tr><tr><td bgcolor="#cc00ff">caiyun</td><td>Male</td><td>22</td><td>Student</td></tr><tr><td bgcolor="#7700ff">huangxianlong</td><td>Male</td><td>22</td><td>Student</td></tr><tr><td bgcolor="#1100ff">zhouchaoyang</td><td>Male</td><td>22</td><td>Student</td></tr></tbody><tfoot><tr><th colspan="4">xuguo resign 2004--3--12</th></tr></tfoot></table><%! int i=0; %><% int j=0;i++; j++;%><hr></hr><% i++; %><%= i %><%= j %><br>This programming is completed by xuguo at Grade three of college<br><%! Date myDate=new Date(); %><%= myDate %></body></html> 可以试一试colspan和rowspan和HTML中的合并单元格一样 谢谢各位!我是用java做,不是html或jsp,明确的说就是如何在JTable和JScrollPane上做出多行头和多列头的效果来,谢谢大家,请继续关注! 教你一种方法,曾经用过,代码比较多,不过重用性高,你可以写写看:首先你写一个GroupableTableHeaderUI类,这个类是从BasicTableHeaderUI继承下来的,你可以重写里面的方法,把表头定义成你想要的样子。然后写GroupableTableHeader类,这个类是从JTableHeader继承下来,可以在这个类中写表头的组合,记得一定要把GroupableTableHeader的UI设置成GroupableTableHeaderUI,最后可以写测试方法了。讲的比较简单,实现起来比较麻烦,可以研究一下我所的那两个类,相信你能写出很精美的Table来,如果不行,继续贴,关注··· 我这到是有楼上说的哪两个类。代码比较多,无法粘贴。要的请留下email。 [email protected]谢谢iceandfire(【OPENSOURCE】) 和jabiao011()!!! 如果你是做报表,jbuilderX已经提供了水晶报表了,你可以试试,不用自己编写了,用它提供的包吧。 这里有全套的东东:http://www2.gol.com/users/tame/swing/examples/SwingExamples.html 也给我发一份[email protected],,先谢了 在大家的帮助下,我写出来了,等我整理好了再贴出来,谢谢!尤其感谢 iceandfire(【OPENSOURCE】) ! 谢谢,能给我一份吗,我也正在做类似需求的东西,感激![email protected] http://y365.com/luoyepiaoxiang/java/swing/JTable/JTableExamples1.html一个很好的例子都是table的用法,也有grouptable的^_^ 这个写起来东西很多,总的思想就是继承重载BasicTableHeaderUI和JTableHeader。自己画tableHeader,再加上鼠标事件等就行了。做起来没说得这么轻松,代码量还是很大的,如果能找到网上现成的代码是最好不过的:)好了。结贴,大家都有份:) 关于java异常何时抛出问题 急!!!求救!encoding不支持怎么办? Class.forName是干什么的?书上说可以用它来动态加载类,文档好像是说它返回一个Class类 一个简单的小程序问题 java位操作问题 Document类是可串行化的么?可以在远程对象中传递么? 菜鸟~~~~~~~~求救!!!! UIManager.put(...) 那里可以下载JDK1。3 for solaris2.8? weblogic6什么时候需要重新启动2! java程序设计这书怎么样? 垃圾回收的三道SUN认证题,谁来给出答案并解释一下结果
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.util.*" %>
<html>
<title>The test of my first programming</title>
<body>
<table border="1" frame="box" width="50%" bgcolor="yellow">
<tr><th colspan="5">The family</th></tr>
<tr bgcolor="#ffbbaa"><th>boyfriend</th><th align="left">Name</th><th>Sex</th><th>Age</th><th>Birthday</th></tr>
<tr align="right"><td rowspan="2">GiGi</td><td>xuguo</td><td valign="bottom">Male</td><td>22</td><td>1982.4.19</td></tr>
<tr align="right"><td>xuguo</td><td valign="bottom">Male</td><td>22</td><td>1982.4.19</td></tr>
</table>
<br>
<button>kjfskdjfk</button>
<p>You are the
jdklsjk
</p>
<table border="1">
<caption>The information of the family</caption>
<colgroup span="3" width="25%" align="right" valign="bottom">
</colgroup>
<thead>
<tr><th>Name</td><th>Sex</th><th>Age</th><th>Position</th></tr>
</thead>
<tbody>
<tr><td>xuguo</td><td>Male</td><td>22</td><td>Student</td></tr>
<tr><td bgcolor="#ff00ff">zhoukun</td><td>Male</td><td>22</td><td>Student</td></tr>
<tr><td bgcolor="#cc00ff">caiyun</td><td>Male</td><td>22</td><td>Student</td></tr>
<tr><td bgcolor="#7700ff">huangxianlong</td><td>Male</td><td>22</td><td>Student</td></tr>
<tr><td bgcolor="#1100ff">zhouchaoyang</td><td>Male</td><td>22</td><td>Student</td></tr>
</tbody>
<tfoot>
<tr><th colspan="4">xuguo resign 2004--3--12</th></tr>
</tfoot>
</table>
<%! int i=0; %>
<%
int j=0;
i++;
j++;%>
<hr></hr>
<% i++; %>
<%= i %>
<%= j %>
<br>This programming is completed by xuguo at Grade three of college
<br>
<%! Date myDate=new Date(); %>
<%= myDate %>
</body>
</html>
和HTML中的合并单元格一样
我是用java做,不是html或jsp,明确的说就是如何在JTable和JScrollPane上做出多行头和多列头的效果来,谢谢大家,请继续关注!
首先你写一个GroupableTableHeaderUI类,这个类是从BasicTableHeaderUI继承下来的,你可以重写里面的方法,把表头定义成你想要的样子。然后写GroupableTableHeader类,这个类是从JTableHeader继承下来,可以在这个类中写表头的组合,记得一定要把GroupableTableHeader的UI设置成GroupableTableHeaderUI,最后可以写测试方法了。讲的比较简单,实现起来比较麻烦,可以研究一下我所的那两个类,相信你能写出很精美的Table来,如果不行,继续贴,关注···
代码比较多,无法粘贴。
要的请留下email。
谢谢iceandfire(【OPENSOURCE】) 和jabiao011()!!!
http://www2.gol.com/users/tame/swing/examples/SwingExamples.html
[email protected]
一个很好的例子都是table的用法,也有grouptable的^_^