第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

java 讀取xls表格然后實(shí)現(xiàn)上一頁和下一頁 (寫了出來但是不能用,不知道為什么,封裝另外的類中)

java 讀取xls表格然后實(shí)現(xiàn)上一頁和下一頁 (寫了出來但是不能用,不知道為什么,封裝另外的類中)

九天冰塵 2016-12-25 21:36:07
package shizi;import java.awt.*;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.File;import javax.swing.*;import javazoom.jl.player.advanced.jlap;import jxl.Sheet;import jxl.Workbook;public class Xue_1 extends JFrame implements ActionListener{ JButton x1=new JButton("上一個(gè)"); JButton x2=new JButton("下一個(gè)"); JButton r1=new JButton("返回主菜單"); JButton r2=new JButton("切換音樂"); JButton r3=new JButton("切換背景"); JButton r4=new JButton("靜音模式"); JLabel bj2=new JLabel(new ImageIcon("image/215452.jpg")); Xinxi[] xinxis; JLabel h1=new JLabel("字"); JLabel h2=new JLabel("組詞"); JLabel h3=new JLabel("造句"); JLabel h4=new JLabel("拼音"); JLabel h5=new JLabel("喇叭"); Font font1=new Font("楷體",Font.BOLD,90); Font font2=new Font("微軟雅黑",Font.BOLD,30); int n; public Xue_1(){ Container c=this.getContentPane(); c.setLayout(null); xinxis=this.getXinxis(); h1.setBounds(270,50, 100,100); h4.setBounds(100,200, 300,70); h2.setBounds(100,260, 300,70); h3.setBounds(100,320, 300,70); h5.setBounds(410,150, 50,50); h1.setFont(font1); h2.setFont(font2); h3.setFont(font2); h4.setFont(font2); bj2.setBounds(0,0,500,600); x1.setBounds(100, 520, 100, 40); x2.setBounds(300, 520, 100, 40); r1.setBounds(0, 0, 100, 30); r2.setBounds(0, 30, 100, 30); r3.setBounds(0, 60, 100, 30); r4.setBounds(0, 90, 100, 30); x1.addActionListener(this); x2.addActionListener(this); r1.addActionListener(this); r2.addActionListener(this); r3.addActionListener(this); r4.addActionListener(this); c.add(h1); c.add(h2); c.add(h3); c.add(h4); c.add(h5); c.add(r1); c.add(r2); c.add(r3); c.add(r4); c.add(x1); c.add(x2); c.add(bj2); this.showXinxi(xinxis[0]); this.setTitle("識(shí)字板塊"); this.setSize(500, 600); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } public static void main(String[] args) { Xue_1 xue=new Xue_1(); } @Override public void actionPerformed(ActionEvent e) { this.getXinxis(); // TODO Auto-generated method stub if(e.getSource()==x1){ n--; if(n<0){ n++; JOptionPane.showMessageDialog(null, "親!已經(jīng)到第一頁了!"); } }else if(e.getSource()==x2){ n++; if(n>40){ n--; JOptionPane.showMessageDialog(null, "親!已經(jīng)學(xué)完了,快去做練習(xí)游戲吧!"); } }else if(e.getSource()==r1){ Jiemian_1 jm=new Jiemian_1(); }else if(e.getSource()==r2){ }else if(e.getSource()==r3){ }else if(e.getSource()==r4){ } } public Xinxi[] getXinxis(){ Xinxi[] xinxis=null; try{ File file=new File("file/1.xls"); Workbook workbook=Workbook.getWorkbook(file); Sheet sheet=workbook.getSheet(0); int rows=sheet.getRows(); int columns=sheet.getColumns(); xinxis=new Xinxi[rows]; Xinxi xx=new Xinxi(); System.out.println("n="+n); xx.setZi(sheet.getCell(0,0+n).getContents()); xx.setCi(sheet.getCell(1,0+n).getContents()); xx.setJu(sheet.getCell(2,0+n).getContents()); xx.setPinyin(sheet.getCell(3,0+n).getContents()); xx.setYuyin(sheet.getCell(4,0+n).getContents()); xinxis[n]=xx; workbook.close(); }catch(Exception ex){ ex.printStackTrace(); } return xinxis;} public void showXinxi(Xinxi xinxi){ h1.setText(xinxi.getZi()); h2.setText(xinxi.getCi()); h3.setText(xinxi.getJu()); h4.setText(xinxi.getPinyin()); h5.setText(xinxi.getYuyin()); }}
查看完整描述

1 回答

?
botao555

TA貢獻(xiàn)48條經(jīng)驗(yàn) 獲得超46個(gè)贊

你的jar包和類的代碼沒給全,自己?jiǎn)尾秸{(diào)試下吧

查看完整回答
1 反對(duì) 回復(fù) 2017-05-09
  • 1 回答
  • 0 關(guān)注
  • 1829 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)