⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pageturner.java

📁 简易的OA办公软件系统 包含部门管理 短消息管理 公告管理 考勤管理 员工管理 状态管理 可使公司全密管理在职员工 效率更高!
💻 JAVA
字号:
package com.buat.util;

public class PageTurner {

	public int total=0;		    //记录总条数
	public int countPerPage=0;	//记录每一页的条数
	public int pageNO=0;		//记录当前页数
	public int beginIndex=0;	//记录开始的索引值
	public int endIndex=0;		//记录结束的索引值
	public int pageCount=0;	    //记录总页数
	
	public PageTurner(int total,int countPerPage){
		this.total=total;
		this.countPerPage=countPerPage;
		this.pageCount=(total-1)/this.countPerPage+1;
	}
	
	public int getBeginIndex(){		//获取开始记录的索引值
		this.beginIndex=pageNO*this.countPerPage;
		return this.beginIndex;
	}

	public int getEndIndex(){		//获取结束记录的索引值
		if(this.pageNO==this.pageCount-1){
			this.endIndex=this.total-1;
		}else{
			this.endIndex=(this.pageNO+1)*this.countPerPage-1;
		}
		return this.endIndex;
	}
	
	public void getFirstPage(){	//显示第一页
		this.pageNO=0;
	}
	
	public int getNextPage(){		//下一页
		this.pageNO=this.pageNO+1;
		if(this.pageNO>this.pageCount-1){
			this.pageNO=this.pageCount-1;
		}
		return this.pageNO;
	}
	
	public int getPreviousPage(){		//上一页
		this.pageNO=this.pageNO-1;
		if(this.pageNO<0){
			this.pageNO=0;
		}
		return this.pageNO;
	}
	
	public int getLastPage(){		//显示最后一页
		this.pageNO=this.pageCount-1;
		return this.pageNO;
	}
	
	public int getTotal() {
		return total;
	}

	public int getCountPerPage() {
		return countPerPage;
	}

	public void setCountPerPage(int countPerPage) {
		this.countPerPage = countPerPage;
	}

	public int getPageNO() {
		return pageNO;
	}

	public void setPageNO(int pageNO) {
		
		this.pageNO=pageNO;
	}

	public void setBeginIndex(int beginIndex) {
		this.beginIndex = beginIndex;
	}

	public void setEndIndex(int endIndex) {
		this.endIndex = endIndex;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -