去掉F5全屏,

package a;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;

public class Main extends JFrame implements ActionListener, KeyListener {

	public static void main(String[] args) {
		Main m = new Main();
		m.setBounds(0, 0, 1900, 1000);
		m.setExtendedState(JFrame.MAXIMIZED_BOTH);
		m.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		m.setVisible(true);
	}

	public Main() {
		this.add(this.jpWEST(), BorderLayout.WEST);
		this.add(this.jpEAST(), BorderLayout.EAST);
		this.add(this.jspCenter(), BorderLayout.CENTER);
	}

	public JPanel jpWEST() {
		String[] s = { "创", "出", "利", "民", "申", "书", "士", "得", "撒上", "撒下", "王上", "王下", "代上", "代下", "拉", "尼", "斯", "伯",
				"诗", "箴", "传", "歌", "赛", "耶", "哀", "结", "但", "何", "珥", "摩", "俄", "拿", "弥", "鸿", "哈", "番", "该", "亚",
				"玛" };
		int l = s.length;
		GridLayout gl = new GridLayout(l, 1);
		JPanel jp = new JPanel(gl);
		JButton[] jb = new JButton[l];
		for (int i = 0; i < l; i++) {
			jb[i] = new JButton(s[i]);
			jb[i].addActionListener(this);

			if (i < 5) {
				jb[i].setBackground(new Color(255, 51, 51));
				jb[i].setForeground(Color.WHITE);
			} else if (i < 8) {
				jb[i].setBackground(new Color(255, 102, 51));
				jb[i].setForeground(Color.WHITE);
			} else if (i < 14) {
				jb[i].setBackground(new Color(255, 255, 0));
			} else if (i < 17) {
				jb[i].setBackground(new Color(0, 255, 0));
			} else if (i < 22) {
				jb[i].setBackground(new Color(0, 255, 255));
			} else if (i < 27) {
				jb[i].setBackground(new Color(0, 191, 255));
			} else if (i < 36) {
				jb[i].setBackground(new Color(153, 0, 255));
				jb[i].setForeground(Color.WHITE);
			} else if (i < 39) {
				jb[i].setBackground(new Color(255, 0, 255));
				jb[i].setForeground(Color.WHITE);
			}

			jp.add(jb[i]);
		}

		return jp;
	}

	public JPanel jpEAST() {
		String[] s = { "太", "可", "路", "约", "徒", "罗", "林前", "林后", "加", "弗", "腓", "西", "帖前", "帖后", "提前", "提后", "多", "门",
				"来", "雅", "彼前", "彼后", "约壹", "约贰", "约叁", "犹", "启" };
		int l = s.length;
		GridLayout gl = new GridLayout(l, 1);
		JPanel jp = new JPanel(gl);
		JButton[] jb = new JButton[l];
		for (int i = 0; i < l; i++) {
			jb[i] = new JButton(s[i]);
			jb[i].addActionListener(this);
			if (i < 4) {
				jb[i].setBackground(new Color(255, 51, 51));
				jb[i].setForeground(Color.WHITE);
			} else if (i < 5) {
				jb[i].setBackground(new Color(255, 102, 51));
				jb[i].setForeground(Color.WHITE);
			} else if (i < 18) {
				jb[i].setBackground(new Color(255, 255, 0));
			} else if (i < 26) {
				jb[i].setBackground(new Color(0, 255, 0));
			} else if (i < 27) {
				jb[i].setBackground(new Color(0, 255, 255));
			}
			jp.add(jb[i]);
		}

		return jp;
	}

	JTextPane jtp = new JTextPane();
	JScrollPane jsp = new JScrollPane(jtp);

	public JScrollPane jspCenter() {
		this.jtp.setEditable(false);
		this.jtp.setBackground(Color.BLACK);
		this.jtp.setFont(new FontUIResource("微软雅黑", Font.BOLD, 80));
		this.addKeyListener(this);
		this.jsp.addKeyListener(this);
		this.jtp.addKeyListener(this);
		return this.jsp;
	}

	public void actionPerformed(ActionEvent ae) {
		String s = ae.getActionCommand();
		this.jspFill(s);
//		GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
//		GraphicsDevice gd = ge.getDefaultScreenDevice();
//		gd.setFullScreenWindow(this);
	}

	public void jspFill(String s) {
		String ChapterSN = "";
		String VerseSN = "";

		UIManager.put("OptionPane.messageFont", new FontUIResource("微软雅黑", Font.BOLD, 50));
		UIManager.put("OptionPane.buttonFont", new FontUIResource("微软雅黑", Font.BOLD, 50));
		UIManager.put("TextField.font", new FontUIResource("微软雅黑", Font.BOLD, 50));
		while (ChapterSN.equals("")) {
			String jopid = JOptionPane.showInputDialog("请输入要查询的章数", "1");
			if (jopid == null || jopid.equals("") || jopid.length() > 3 || !jopid.trim().matches("^[0-9]*$")) {
				continue;
			}
			ChapterSN = jopid.trim();
		}

		while (VerseSN.equals("")) {
			String jopid = JOptionPane.showInputDialog("请输入要查询的节数", "1");
			if (jopid == null || jopid.equals("") || jopid.length() > 3 || !jopid.trim().matches("^[0-9]*$")) {
				continue;
			}
			VerseSN = jopid.trim();
		}

		ArrayList<HashMap<String, String>> alhmss = this.select(s, ChapterSN, VerseSN);
		this.jtp.setText("");
		StyledDocument sd = jtp.getStyledDocument();
		Style sty = jtp.addStyle(null, null);

		for (int i = 0; i < alhmss.size(); i++) {
			String zhang = alhmss.get(i).get("zhang");
			String jie = alhmss.get(i).get("jie");
			String jingwen = alhmss.get(i).get("jingwen");
			String zhangjiejingwen = "【" + s + "】" + zhang + ":" + jie + jingwen + "\n";

			if (i % 8 == 0) {
				StyleConstants.setForeground(sty, new Color(255, 0, 102));
			} else if (i % 8 == 1) {
				StyleConstants.setForeground(sty, new Color(255, 102, 51));
			} else if (i % 8 == 2) {
				StyleConstants.setForeground(sty, new Color(255, 255, 102));
			} else if (i % 8 == 3) {
				StyleConstants.setForeground(sty, new Color(0, 255, 0));
			} else if (i % 8 == 4) {
				StyleConstants.setForeground(sty, new Color(0, 255, 255));
			} else if (i % 8 == 5) {
				StyleConstants.setForeground(sty, new Color(0, 204, 255));
			} else if (i % 8 == 6) {
				StyleConstants.setForeground(sty, new Color(204, 51, 255));
			} else if (i % 8 == 7) {
				StyleConstants.setForeground(sty, new Color(255, 102, 255));
			} else {
				StyleConstants.setForeground(sty, Color.WHITE);
			}

			try {
				sd.insertString(sd.getLength(), zhangjiejingwen, sty);
			} catch (Exception e) {
				e.printStackTrace();
			}

		}

		this.jtp.setCaretPosition(0);
		this.jtp.requestFocusInWindow();

	}

	public static ArrayList<HashMap<String, String>> select(String juan, String zhang, String jie) {
		ArrayList<HashMap<String, String>> alhmss = new ArrayList<HashMap<String, String>>();
		try {
			Class.forName("org.sqlite.JDBC");
			try (Connection conn = DriverManager.getConnection("jdbc:sqlite:hb.sqlite3")) {
				try (PreparedStatement ps = conn.prepareStatement(
						"select juan, suoxie, zhang, jie, jingwen from t_hb where suoxie = ? and zhang = ? and jie between ? and 200")) {
					ps.setString(1, juan);
					ps.setString(2, zhang);
					ps.setString(3, jie);
					try (ResultSet rs = ps.executeQuery()) {
						while (rs.next()) {
							HashMap<String, String> hmss = new HashMap<String, String>();
							hmss.put("juan", rs.getString("juan"));
							hmss.put("suoxie", rs.getString("suoxie"));
							hmss.put("zhang", rs.getString("zhang"));
							hmss.put("jie", rs.getString("jie"));
							hmss.put("jingwen", rs.getString("jingwen"));
							alhmss.add(hmss);
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return alhmss;
	}

	public void keyPressed(KeyEvent e) {
//		int i = e.getKeyCode();
// 
//		GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
//		GraphicsDevice gd = ge.getDefaultScreenDevice();
// 
//		if (i == 116 || i == 10) {
//			gd.setFullScreenWindow(this);
//		} else if (i == 27) {
//			gd.setFullScreenWindow(null);
//		}
	}

	public void keyReleased(KeyEvent e) {

	}

	public void keyTyped(KeyEvent e) {

	}

}

<template> <div id="app" class="full-screen"> <div class="centered-container"> <div class="container"> <!-- 固定顶部区域 --> <div class="fixed-header"> <div class="search-container"> <h2>搜索条件</h2> <div class="search-columns"> <div class="search-column"> <div class="search-item"> <label for="startTime">开始时间</label> <input type="datetime-local" id="startTime" v-model="searchForm.startTime"> </div> <div class="search-item"> <label for="endTime">结束时间</label> <input type="datetime-local" id="endTime" v-model="searchForm.endTime"> </div> <div class="search-item"> <label for="phone">手机号</label> <input type="text" id="phone" v-model="searchForm.phone" placeholder="请输入手机号"> </div> </div> <div class="search-column"> <div class="search-item"> <label for="serviceId">业务ID</label> <input type="text" id="serviceId" v-model="searchForm.serviceId" placeholder="请输入业务ID"> </div> <div class="search-item"> <label for="province">省份</label> <select id="province" v-model="searchForm.province"> <option value="">全部</option> <option v-for="province in provinceOptions" :value="province.value">{{ province.label }}</option> </select> </div> <div class="search-item"> <label for="sign">状态</label> <select id="sign" v-model="searchForm.sign"> <option value="">全部</option> <option v-for="sign in signOptions" :value="sign.value">{{ sign.label }}</option> </select> </div> </div> </div> <div class="search-buttons"> <button class="search-button" @click="handleSearch" :disabled="loading"> {{ loading ? '搜索中...' : '搜索' }} </button> <button class="reset-button" @click="handleReset" :disabled="loading">重置</button> </div> </div> <h2 class="table-title">数据列表</h2> </div> <!-- 可滚动内容区域 --> <div class="scrollable-content"> <div class="table-wrapper"> <table> <thead> <tr> <th>手机号</th> <th>标识</th> <th>省份</th> <th>业务ID</th> <th>订购时间</th> </tr> </thead> <tbody> <template v-if="loading"> <tr> <td colspan="5" class="loading-cell"> <div class="status-message">加载中...</div> </td> </tr> </template> <template v-else-if="tableData.length === 0"> <tr> <td colspan="5" class="no-data-cell"> <div class="status-message">暂无数据</div> </td> </tr> </template> <template v-else> <tr v-for="(item, index) in tableData" :key="index"> <td>{{ item.phone }}</td> <td :class="{'sign-new': item.sign === '0', 'sign-retained': item.sign === '1'}"> {{ item.sign === '0' ? '新增' : item.sign === '1' ? '留存' : '' }} </td> <td>{{ item.province }}</td> <td>{{ item.serviceId }}</td> <td>{{ formatDateTime(item.orderTime) }}</td> </tr> </template> </tbody> </table> </div> <div class="pagination-container"> <div class="pagination-info"> 显示第 {{ pagination.startIndex }} 到 {{ pagination.endIndex }} 条记录,共 {{ pagination.total }} 条 </div> <div class="pagination-controls"> <select v-model="pagination.pageSize" @change="handlePageSizeChange" class="page-size-select"> <option v-for="size in pageSizeOptions" :value="size" :key="size">{{ size }}条/页</option> </select> <button class="pagination-button first-page" @click="goToFirstPage" :disabled="pagination.currentPage === 1" > 首页 </button> <button class="pagination-button prev-page" @click="goToPrevPage" :disabled="pagination.currentPage === 1" > 上一页 </button> <template v-for="page in displayedPages" :key="page"> <button v-if="page === '...'" class="pagination-ellipsis" disabled > ... </button> <button v-else class="pagination-button" :class="{active: page === pagination.currentPage}" @click="goToPage(page)" > {{ page }} </button> </template> <button class="pagination-button next-page" @click="goToNextPage" :disabled="pagination.currentPage === pagination.totalPages || pagination.totalPages === 0" > 下一页 </button> <button class="pagination-button last-page" @click="goToLastPage" :disabled="pagination.currentPage === pagination.totalPages || pagination.totalPages === 0" > 末页 </button> <div class="page-jump"> <span>跳至</span> <input type="number" v-model.number="jumpPage" min="1" :max="pagination.totalPages" @keyup.enter="handleJumpPage" > <span>页</span> <button @click="handleJumpPage">确定</button> </div> </div> </div> </div> </div> </div> </div> </template> <script> import axios from 'axios'; import dayjs from 'dayjs'; export default { name: 'PhoneStatus', data() { return { searchForm: { startTime: this.getDefaultStartTime(), endTime: this.getDefaultEndTime(), phone: '', serviceId: '', province: '', sign: '', }, provinceOptions: [ {value: '山西', label: '山西'}, {value: '上海', label: '上海'}, {value: '广东', label: '广东'}, {value: '浙江', label: '浙江'}, {value: '江苏', label: '江苏'} ], signOptions: [ {value: '0', label: '留存'}, {value: '1', label: '发货'} ], tableData: [], loading: false, apiUrl: 'phoneorderstatus/test/list', pagination: { currentPage: 1, pageSize: 10, total: 0, totalPages: 0, startIndex: 0, endIndex: 0 }, pageSizeOptions: [10, 20, 50, 100], jumpPage: 1, maxDisplayedPages: 5 } }, computed: { displayedPages() { const {currentPage, totalPages} = this.pagination; const {maxDisplayedPages} = this; const pages = []; if (totalPages <= maxDisplayedPages) { for (let i = 1; i <= totalPages; i++) { pages.push(i); } } else { const half = Math.floor(maxDisplayedPages / 2); let start = currentPage - half; let end = currentPage + half; if (start < 1) { start = 1; end = maxDisplayedPages; } else if (end > totalPages) { end = totalPages; start = totalPages - maxDisplayedPages + 1; } if (start > 1) { pages.push(1); if (start > 2) { pages.push('...'); } } for (let i = start; i <= end; i++) { pages.push(i); } if (end < totalPages) { if (end < totalPages - 1) { pages.push('...'); } pages.push(totalPages); } } return pages; } }, methods: { getDefaultStartTime() { return dayjs().startOf('month').format('YYYY-MM-DDTHH:mm'); }, getDefaultEndTime() { return dayjs().format('YYYY-MM-DDTHH:mm'); }, formatDateTime(dateTime) { return dayjs(dateTime).format('YYYY-MM-DD HH:mm:ss'); }, getToken() { return "123"; }, createAxiosInstance() { const instance = axios.create(); instance.interceptors.request.use(config => { const token = this.getToken(); if (token) { config.headers.Authorization = `Bearer ${token}`; } return config; }, error => { return Promise.reject(error); }); return instance; }, async handleSearch() { try { this.loading = true; const params = { startTime: this.searchForm.startTime, endTime: this.searchForm.endTime, phone: this.searchForm.phone, serviceId: this.searchForm.serviceId, province: this.searchForm.province, sign: this.searchForm.sign, current: this.pagination.currentPage, size: this.pagination.pageSize }; Object.keys(params).forEach(key => { if (params[key] === '' || params[key] === null || params[key] === undefined) { delete params[key]; } }); const axiosInstance = this.createAxiosInstance(); const response = await axiosInstance.get(this.apiUrl, {params}); this.tableData = response.data.data?.records || []; this.updatePagination({ total: response.data.data?.total || 0, currentPage: params.current || 1, pageSize: params.size || 10, totalPages: Math.ceil((response.data.data?.total || 0) / (params.size || 10)) }); } catch (error) { console.error('获取数据失败:', error); this.$message.error('获取数据失败,请稍后重试'); } finally { this.loading = false; } }, updatePagination({total, currentPage, pageSize, totalPages}) { this.pagination = { ...this.pagination, total, currentPage, pageSize, totalPages, startIndex: (currentPage - 1) * pageSize + 1, endIndex: Math.min(currentPage * pageSize, total) }; this.jumpPage = currentPage; }, handleReset() { this.searchForm = { startTime: this.getDefaultStartTime(), endTime: this.getDefaultEndTime(), phone: '', serviceId: '', province: '', sign: '' }; this.updatePagination({ currentPage: 1, pageSize: 10, total: 0, totalPages: 0 }); this.handleSearch(); }, handlePageSizeChange() { this.pagination.currentPage = 1; this.handleSearch(); }, goToFirstPage() { if (this.pagination.currentPage !== 1) { this.pagination.currentPage = 1; this.handleSearch(); } }, goToPrevPage() { if (this.pagination.currentPage > 1) { this.pagination.currentPage--; this.handleSearch(); } }, goToNextPage() { if (this.pagination.currentPage < this.pagination.totalPages) { this.pagination.currentPage++; this.handleSearch(); } }, goToLastPage() { if (this.pagination.currentPage !== this.pagination.totalPages && this.pagination.totalPages > 0) { this.pagination.currentPage = this.pagination.totalPages; this.handleSearch(); } }, goToPage(page) { if (page !== this.pagination.currentPage) { this.pagination.currentPage = page; this.handleSearch(); } }, handleJumpPage() { const page = parseInt(this.jumpPage); if (!isNaN(page) && page >= 1 && page <= this.pagination.totalPages && page !== this.pagination.currentPage) { this.pagination.currentPage = page; this.handleSearch(); } else { this.jumpPage = this.pagination.currentPage; } }, async fetchData() { await this.handleSearch(); } }, mounted() { this.fetchData(); } } </script> <style scoped> .full-screen { position: fixed; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; background-color: #f0f2f5; font-size: 16px; } .centered-container { display: flex; justify-content: center; align-items: flex-start; height: 100vh; padding: 20px; box-sizing: border-box; } .container { width: 95%; max-width: 1600px; min-width: 1200px; background-color: white; border-radius: 8px; box-shadow: 0 0 20px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; height: 95vh; overflow: hidden; } /* 固定顶部区域 */ .fixed-header { padding: 30px 30px 0; background: white; position: sticky; top: 0; z-index: 10; } .search-container { margin-bottom: 0; padding: 0; } .search-columns { display: flex; gap: 40px; margin-bottom: 20px; } .search-column { flex: 1; display: flex; flex-direction: column; gap: 20px; } .search-item { display: flex; flex-direction: column; } label { margin-bottom: 10px; font-weight: bold; font-size: 1.1em; color: #333; } input, select { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; font-size: 1em; background-color: #fff; transition: all 0.3s; } input:focus, select:focus { border-color: #1890ff; outline: none; box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2); } .search-buttons { display: flex; justify-content: flex-end; margin: 25px 0; gap: 20px; } button { padding: 12px 24px; border: none; border-radius: 6px; cursor: pointer; font-size: 1em; transition: all 0.3s; } button:disabled { opacity: 0.6; cursor: not-allowed; } .search-button { background-color: #4CAF50; color: white; } .search-button:hover:not(:disabled) { background-color: #45a049; } .reset-button { background-color: #f44336; color: white; } .reset-button:hover:not(:disabled) { background-color: #d32f2f; } .table-title { font-size: 1.8em; margin: 20px 0 15px; color: #333; font-weight: 600; padding: 0 0 10px; border-bottom: 1px solid #eee; } /* 可滚动内容区域 */ .scrollable-content { flex: 1; overflow-y: auto; padding: 0 30px 30px; } .table-wrapper { border: 1px solid #ddd; border-radius: 8px; overflow: auto; max-height: calc(100% - 100px); } table { width: 100%; border-collapse: collapse; font-size: 1.1em; } th, td { border: 1px solid #ddd; padding: 16px; text-align: left; } th { background-color: #f2f2f2; font-weight: bold; position: sticky; top: 0; } tr:nth-child(even) { background-color: #f9f9f9; } tr:hover { background-color: #f1f1f1; } .sign-new { color: green; font-weight: bold; } .sign-retained { color: blue; font-weight: bold; } .loading-cell, .no-data-cell { height: 300px; vertical-align: middle; text-align: center; } .status-message { padding: 40px; color: #666; font-size: 1.5em; } .pagination-container { display: flex; flex-direction: column; align-items: flex-end; margin-top: 20px; font-size: 1.1em; } .pagination-info { margin-bottom: 15px; color: #666; } .pagination-controls { display: flex; align-items: center; gap: 10px; } .page-size-select { padding: 10px 15px; border: 1px solid #ddd; border-radius: 6px; margin-right: 15px; font-size: 1em; background-color: #fff; } .pagination-button { min-width: 50px; height: 45px; padding: 0 15px; background-color: #fff; border: 1px solid #ddd; border-radius: 6px; color: #333; cursor: pointer; transition: all 0.3s; font-size: 1em; } .pagination-button:hover:not(:disabled) { background-color: #f5f5f5; } .pagination-button:disabled { color: #ccc; cursor: not-allowed; } .pagination-button.active { background-color: #1890ff; color: #fff; border-color: #1890ff; } .pagination-ellipsis { min-width: 50px; height: 45px; padding: 0 15px; background: transparent; border: none; color: #666; font-size: 1.2em; } .page-jump { display: flex; align-items: center; margin-left: 20px; font-size: 1em; gap: 8px; } .page-jump input { width: 70px; height: 45px; padding: 0 10px; border: 1px solid #ddd; border-radius: 6px; text-align: center; font-size: 1em; } .page-jump button { height: 45px; padding: 0 20px; background-color: #1890ff; color: #fff; border: none; border-radius: 6px; font-size: 1em; } .page-jump button:hover { background-color: #40a9ff; } </style>将布局撑满全屏,左右不需要有空白位置
最新发布
08-20
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值