网站建设资讯

NEWS

网站建设资讯

java课程表显示代码 创建课程表代码

用Java怎样实现课表代码?有周次

课表数据时存储于数据库中的吗?

成都创新互联公司是专业的保德网站建设公司,保德接单;提供网站建设、成都做网站,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行保德网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

/**

* 获取一周的时间集合(从周一到周日)

* @param weekNum ;-1:上周;0:本周;1:下周

*/

public static ListDate getWeekDates(int weekNum){

ListDate list = new ArrayListDate();

Calendar cal = Calendar.getInstance();

// 获取指定下几个星期

cal.add(Calendar.DAY_OF_WEEK, weekNum * 7);

cal.setFirstDayOfWeek(Calendar.MONDAY);

cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);

list.add(cal.getTime());

for(int i = 0;i 6;i++){

cal.add(Calendar.DAY_OF_WEEK, 1);

list.add(cal.getTime());

}

return list;

}

这个是获取这一周时间的代码 ,之后用下面的代码获取周一到周日的日期

ListDate ds = DateUtil.getNowWeekDates(weekNum);

ds.get(0)//周一

ds.get(6)//周日

用这两个时间到数据库中进行范围查询,之后的你应该明白了吧

java 课程表,网页中显示

String[] content=new String[40];

int i=0;

while(rs.next()){

content[i]=rs.getString(1);//content是你声明号的数组

i++;

}

%

body

form name="form" action="showstudent.jsp" method="post"

TABLE border=0 bgcolor="000000" cellspacing="1" width=400

TR bgcolor="FFFFFF"

TD id="td1" /TD

TD星期一/TD

TD星期二/TD

TD星期三/TD

TD星期四/TD

TD星期五/TD

TD星期六/TD

TD星期日/TD

/TR

TR bgcolor="FFFFFF"

TD第一节/TD

TD%=content[0]%/TD

TD%=content[7]%/TD

TD%=content[14]%/TD

TD%=content[21]%/TD

TD%=content[28]%/TD

TDx/TD

TDx/TD

/TR

TR bgcolor="FFFFFF"

TD第二节/TD

TD%=content[1]%/TD

TD%=content[8]%/TD

TD%=content[15]%/TD

TD%=content[22]%/TD

TD%=content[29]%/TD

TDx/TD

TDx/TD

/TR

TR bgcolor="FFFFFF"

TD第三节/TD

TD%=content[2]%/TD

TD%=content[9]%/TD

TD%=content[16]%/TD

TD%=content[23]%/TD

TD%=content[30]%/TD

TDx/TD

TDx/TD

/TR

TR bgcolor="FFFFFF"

TD第四节/TD

TD%=content[3]%/TD

TD%=content[10]%/TD

TD%=content[17]%/TD

TD%=content[24]%/TD

TD%=content[31]%/TD

TDx/TD

TDx/TD

/TR

TR bgcolor="FFFFFF"

TD第五节/TD

TD%=content[4]%/TD

TD%=content[11]%/TD

TD%=content[18]%/TD

TD%=content[25]%/TD

TD%=content[32]%/TD

TDx/TD

TDx/TD

/TR

TR bgcolor="FFFFFF"

TD第六节/TD

TD%=content[5]%/TD

TD%=content[12]%/TD

TD%=content[19]%/TD

TD%=content[26]%/TD

TD%=content[33]%/TD

TDx/TD

TDx/TD

/TR

TR bgcolor="FFFFFF"

TD第七节/TD

TD%=content[6]%/TD

TD%=content[13]%/TD

TD%=content[20]%/TD

TD%=content[27]%/TD

TD%=content[34]%/TD

TDx/TD

TDx/TD

/TR

/TABLE

/form

/body

/html

,将结果保存在一维数组中,直接调用这些值。

java表格代码怎么写

java表格就是java swing。

//创建表头

String[] columnNames = { "First Name", "Last Name", "Sport",

"# of Years", "Vegetarian" };

//创建显示数据

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) } };

/*

* JTable还提供了一个重载的构造方法,传入两个Vector

* JTable(Vector rowData, Vector columnNames)

*

*/

final JTable table = new JTable(data, columnNames);

table.setBackground(Color.YELLOW);


分享标题:java课程表显示代码 创建课程表代码
网址分享:http://cdweb.net/article/hpgsop.html