如是智能機(jī)而屏幕夠大的話, 可以使用pdf閱讀器, 如是非智能且支持java功能的話。就下個(gè)umd閱讀器。 實(shí)在不行就下jpg格式的圖片吧。放在大屏幕的播放器里,一樣可以看的很爽的。。。。。。

創(chuàng)新互聯(lián)公司從2013年成立,先為北海等服務(wù)建站,北海等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為北海企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。
基本架構(gòu)是建立個(gè)文件夾,一本漫畫一個(gè),然后把圖片按照1,2,3.jpg的方法編輯好。然后用a href="read.jsp?type=%****%page=%****%"/a這個(gè)是寫在jsp里的,定義幾個(gè)變量,然后用這個(gè)方法傳參數(shù)給自己,就能跳到你指定的圖片。圖片用img src="******%****%.jpg",就是把你輸入的值帶入,出來是第幾個(gè)jpg的圖,很簡單的,一個(gè)頁面就搞定了,不用連接數(shù)據(jù)庫什么的,也沒有什么js````
import?java.io.BufferedReader;
import?java.io.File;
import?java.io.FileReader;
import?java.util.ArrayList;
import?java.util.List;
import?java.util.Scanner;
public?class?BookWork?{
static?ListBook?data;
private?static?Scanner?input;
public?static?void?main(String[]?args)?{
if?(!initBook("d:/book.txt"))?{
System.out.println("初始圖書列表失敗?..");
return;
}
input?=?new?Scanner(System.in);
while?(true)?{
try?{
System.out.println("請(qǐng)輸入操作:");
System.out.println("1.找書??2.刪除圖書?3.退出");
int?number?=?Integer.parseInt(input.next());
if?(number?==?1)?{
findBook();
}?else?if?(number?==?2)?{
delBook();
}?else?if?(number?==?3)?{
System.out.println("退出");
break;
}?else?{
System.out.println("這個(gè)不是我要的...重來...");
System.out.println();
}
}?catch?(Exception?e)?{
e.printStackTrace();
System.out.println("這個(gè)不是我要的...重來...");
System.out.println();
}
}
}
private?static?void?delBook()?{
System.out.println("請(qǐng)輸入要?jiǎng)h除的書名或編號(hào):");
String?key?=?input.next();
if?(key?!=?null??!key.equals(""))?{
for?(Book?book?:?data)?{
if?(book.number.equals(key)?||?book.name.contains(key))?{
data.remove(book);
System.out.println("?圖書?"?+?book.toString()?+?"?已刪除");
return;
}
}
}
System.out.println("沒有您要?jiǎng)h除的");
}
private?static?void?findBook()?{
System.out.println("請(qǐng)輸入要查找的書名或編號(hào):");
String?key?=?input.next();
if?(key?!=?null??!key.equals(""))?{
for?(Book?book?:?data)?{
if?(book.number.equals(key)?||?book.name.contains(key))?{
System.out.println("找到了?圖書?"?+?book.toString());
return;
}
}
}
System.out.println("沒有您要找的");
}
private?static?boolean?initBook(String?string)?{
try?{
System.out.println("圖書導(dǎo)入中...");
System.out.println("列表文件?--?"?+?string);
File?file?=?new?File(string);
if?(!file.exists())?{
return?false;
}
data?=?new?ArrayListBook();
BufferedReader?bufferedReader?=?new?BufferedReader(new?FileReader(file));
String?line?=?"";
while?((line?=?bufferedReader.readLine())?!=?null)?{
String[]?strings?=?line.split(",");
Book?b?=?new?Book(strings[0],?strings[1]);
data.add(b);
System.out.println("導(dǎo)入"?+?b.toString());
}
}?catch?(Exception?e)?{
e.printStackTrace();
return?false;
}
return?true;
}
public?static?class?Book?{
String?number;
String?name;
public?Book(String?number,?String?name)?{
super();
this.number?=?number;
this.name?=?name;
}
@Override
public?String?toString()?{
return?"Book?[編碼:"?+?number?+?",?名稱:"?+?name?+?"]";
}
}
}
001,金瓶梅
002,雜事秘辛
003,飛燕外傳
004,控鶴監(jiān)秘記
005,漢宮春色
只提供一個(gè)小說閱讀,如下
package?reader;
import?java.awt.*;
import?java.awt.event.*;
import?java.io.*;
import?javax.swing.*;
public?class?Notebook?{
private?JFrame?frame;
private?JTextArea?textArea;
private?JMenuBar?menuBar;
private?JMenu?file,?format,?search,?help;
private?JMenuItem?open,?exit;
private?JMenuItem?font,?color,?background,?speed;
private?JMenuItem?find,?changeto;
private?JMenuItem?helps,?about;
private?Boolean?autoLineWrap?=?true;
private?String?fileName?=?"未命名";//?文件名
//?private?File?currentFile?;
private?JScrollPane?jsp;
private?JScrollBar?jsb;
private?Speed?sped;
private?font?font1;
int?delay?=?10;
Timer?timer?=?new?Timer(delay,?new?ActionListener()?{
public?void?actionPerformed(ActionEvent?evt)?{
jsb.setValue(jsb.getValue()?+?jsb.getUnitIncrement());
}
});
public?Notebook()?{
frame?=?new?JFrame();
frame.setTitle("未命名");
frame.setLayout(new?BorderLayout());
textArea?=?new?JTextArea();
textArea.setFont(new?Font("宋體",?Font.PLAIN,?18));//?設(shè)置默認(rèn)字體樣式字號(hào)
//?set?input?textArea?設(shè)置編輯區(qū)
textArea.setText("");
textArea.setEditable(false);
textArea.setLineWrap(autoLineWrap);//?設(shè)置自動(dòng)換行
jsp?=?new?JScrollPane(textArea);//?set?Scroll
jsb?=?jsp.getVerticalScrollBar();
jsb.addAdjustmentListener(new?AdjustmentListener()?{
public?void?adjustmentValueChanged(AdjustmentEvent?e)?{
int?i;
i?=?jsb.getUnitIncrement();
System.out.println(i);
}
});
frame.add(jsp,?BorderLayout.CENTER);
//?菜單
menuBar?=?new?JMenuBar();
file?=?new?JMenu("文件");
file.setMnemonic('F');
format?=?new?JMenu("格式");
search?=?new?JMenu("搜索");
help?=?new?JMenu("幫助");
menuBar.add(file);
menuBar.add(format);
menuBar.add(search);
menuBar.add(help);
//?文件菜單項(xiàng)
open?=?new?JMenuItem("打開...",?KeyEvent.VK_O);
exit?=?new?JMenuItem("退出");
file.add(open);
file.add(exit);
//?格式菜單項(xiàng)
//?autoLine?=?new?JCheckBoxMenuItem("自動(dòng)換行");
font?=?new?JMenuItem("字體...");
color?=?new?JMenuItem("顏色...");
background?=?new?JMenuItem("背景顏色...");
speed?=?new?JMenuItem("滾屏速度...");
//?format.add(autoLine);
format.add(font);
format.add(color);
format.add(background);
format.add(speed);
//?搜索菜單項(xiàng)
find?=?new?JMenuItem("查找...");
changeto?=?new?JMenuItem("轉(zhuǎn)到...");
search.add(find);
search.add(changeto);
//?幫助菜單項(xiàng)
helps?=?new?JMenuItem("幫助");
about?=?new?JMenuItem("關(guān)于");
help.add(helps);
help.add(about);
//?設(shè)置菜單條
menuBar.add(file);
menuBar.add(format);
menuBar.add(search);
menuBar.add(help);
frame.setJMenuBar(menuBar);
//?sped///
sped?=?new?Speed(jsb,?timer);
font1?=?new?font(textArea);
//?調(diào)用監(jiān)聽方法
addEventHandler();
//?////
textArea.addMouseListener(new?MouseListener()?{
public?void?mouseClicked(MouseEvent?e)?{
if?(e.getClickCount()?==?2)?{
timer.start();
}
if?(e.getClickCount()?==?1)?{
timer.stop();
}
}
public?void?mouseEntered(MouseEvent?arg0)?{
}
public?void?mouseExited(MouseEvent?arg0)?{
}
public?void?mousePressed(MouseEvent?arg0)?{
}
public?void?mouseReleased(MouseEvent?arg0)?{
}
});
//?監(jiān)聽上下鍵//
textArea.addKeyListener(new?KeyListener()?{
@Override
public?void?keyPressed(KeyEvent?arg0)?{
if?(arg0.getKeyCode()?==?KeyEvent.VK_UP)?{
jsb.setValue(jsb.getValue()?-?jsb.getUnitIncrement());
}
if?(arg0.getKeyCode()?==?KeyEvent.VK_DOWN)?{
jsb.setValue(jsb.getValue()?+?jsb.getUnitIncrement());
}
}
public?void?keyReleased(KeyEvent?arg0)?{
}
public?void?keyTyped(KeyEvent?arg0)?{
}
});
//
textArea.addMouseListener(new?MouseListener()?{
@Override
public?void?mouseClicked(MouseEvent?e)?{
if?(e.getClickCount()?==?2)?{
timer.start();
}
if?(e.getClickCount()?==?1)?{
timer.stop();
}
}
public?void?mouseEntered(MouseEvent?arg0)?{
}
public?void?mouseExited(MouseEvent?arg0)?{
}
public?void?mousePressed(MouseEvent?arg0)?{
}
public?void?mouseReleased(MouseEvent?arg0)?{
}
});
}
//?/////////初始化frame////////////////
protected?void?frameInit()?{
Dimension?d?=?Toolkit.getDefaultToolkit().getScreenSize();
frame.setSize(d.width,?d.height);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Dimension?b?=?frame.getSize();
}
private?void?addEventHandler()?{
//?文件項(xiàng)的監(jiān)聽
open.addActionListener(new?ActionListener()?{
public?void?actionPerformed(ActionEvent?e)?{
fileOpen();
jsb.setValue(0);
}
});
exit.addActionListener(new?ActionListener()?{
public?void?actionPerformed(ActionEvent?e)?{
fileExit();
}
});
//?格式菜單的監(jiān)聽
font.addActionListener(new?ActionListener()?{
public?void?actionPerformed(ActionEvent?e)?{
font1.addEventHandler();
}
});
color.addActionListener(new?ActionListener()?{
public?void?actionPerformed(ActionEvent?e)?{
formatColor();
}
});
background.addActionListener(new?ActionListener()?{
public?void?actionPerformed(ActionEvent?e)?{
formatBackground();
}
});
speed.addActionListener(new?ActionListener()?{
public?void?actionPerformed(ActionEvent?e)?{
sped.liser();
}
});
}
//?////////文件項(xiàng)的方法/////////////////////////
private?void?fileOpen()?{
textArea.setText("");
JFileChooser?fileChooser?=?new?JFileChooser();
fileChooser.showOpenDialog(frame);
File?file?=?fileChooser.getSelectedFile();
if?(file?==?null)
return;
fileName?=?file.getName();//?獲得文件名
frame.setTitle(file.getAbsolutePath());
FileInputStream?fis?=?null;
BufferedReader?br?=?null;
try?{
fis?=?new?FileInputStream(file);
br?=?new?BufferedReader(new?InputStreamReader(fis));
String?str?=?null;
while?((str?=?br.readLine())?!=?null)?{
textArea.append(str?+?"\n");
}
System.out.println("打開成功");
textArea.setCaretPosition(0);
}?catch?(IOException?e1)?{
JOptionPane.showMessageDialog(frame,?"文件不存在或已被損壞");
}?finally?{
if?(br?!=?null)
try?{
br.close();
}?catch?(IOException?e)?{
}
if?(fis?!=?null)
try?{
fis.close();
}?catch?(IOException?e)?{
}
}
}
private?void?fileExit()?{
int?option?=?-1;
Object?options[]?=?{?"Yes",?"No"?};
option?=?JOptionPane.showOptionDialog(frame,?"是否退出閱讀?",?"exit",
JOptionPane.YES_NO_OPTION,?JOptionPane.QUESTION_MESSAGE,?null,
options,?options[0]);
switch?(option)?{
case?JOptionPane.YES_OPTION:
System.exit(0);
}
}
//?//////////////////////////////////////////////////////////
//?///////////////格式項(xiàng)的方法/////////////////////////////////
private?void?formatColor()?{
//?彈出顏色色選擇器對(duì)話框
Color?color?=?JColorChooser.showDialog(textArea,?"選擇顏色",?Color.BLACK);
textArea.setForeground(color);
}
private?void?formatBackground()?{
//?彈出顏色色選擇器對(duì)話框
Color?color?=?JColorChooser.showDialog(textArea,?"選擇顏色",?Color.BLACK);
textArea.setBackground(color);
}
//?////////////////////////////////////////////////////////////
public?static?void?main(String?args[])?{
Notebook?nt?=?new?Notebook();
nt.frameInit();
}
}
class?font?{
private?JTextArea?textArea;
private?JButton?ok,?cancel;
private?JComboBox?fontName,?fontSize,?fontStyle;
GraphicsEnvironment?ge;//?定義系統(tǒng)字體對(duì)象
String[]?size?=?{?"8",?"10",?"12",?"14",?"16",?"18",?"20",?"22",?"24",
"26",?"28",?"32",?"36",?"48",?"72",?"96"?};
String[]?style?=?{?"PLAIN",?"BOLD",?"ITALIC"?};
JFrame?jf?=?new?JFrame("字體設(shè)置");
public?font(JTextArea?textArea)?{
this.textArea?=?textArea;
JLabel?label1?=?new?JLabel(
"????字體?????????????????????????????????????????");
JLabel?label2?=?new?JLabel("?字號(hào)????????");
JLabel?label3?=?new?JLabel("?樣式????????");
ge?=?GraphicsEnvironment.getLocalGraphicsEnvironment();//?獲取系統(tǒng)字體
String[]?fontname?=?ge.getAvailableFontFamilyNames();
fontName?=?new?JComboBox(fontname);
fontSize?=?new?JComboBox(size);
fontStyle?=?new?JComboBox(style);
ok?=?new?JButton("確定");
cancel?=?new?JButton("取消");
jf.setLayout(new?BorderLayout());
JPanel?p1?=?new?JPanel();
JPanel?p2?=?new?JPanel();
JPanel?p3?=?new?JPanel();
p1.add(label1);
p1.add(label2);
p1.add(label3);
p2.add(fontName);
p2.add(fontSize);
p2.add(fontStyle);
p3.add(ok);
p3.add(cancel);
jf.add(p1,?BorderLayout.NORTH);
jf.add(p2,?BorderLayout.CENTER);
jf.add(p3,?BorderLayout.SOUTH);
jf.setSize(360,?200);
jf.setLocation(300,?200);
jf.setVisible(false);
jf.setResizable(false);
//?addEventHandler();
}
void?addEventHandler()?{
jf.setVisible(true);
ok.addActionListener(new?ActionListener()?{
public?void?actionPerformed(ActionEvent?e)?{
String?n1?=?(String)?fontName.getSelectedItem();
int?n2?=?fontStyle.getSelectedIndex();
String?n3?=?(String)?fontSize.getSelectedItem();
textArea.setFont(new?Font(n1,?n2,?Integer.parseInt(n3)));
jf.setVisible(false);
}
});
cancel.addActionListener(new?ActionListener()?{
public?void?actionPerformed(ActionEvent?e)?{
jf.setVisible(false);//?
}
});
}
}
class?Speed?implements?ItemListener?{
private?JScrollBar?jsb;
private?JFrame?jfrm;
private?JLabel?jlb1;
//?JLabel?jlb2;
private?JButton?jbt;
//?private?JCheckBox?jcheckbox;
private?JComboBox?jcbb;
Integer?sudu;
Timer?timer;
private?Integer?msg[]?=?{?1,?10,?18,?36,?48,?66,?80,?90?};
public?Speed(final?JScrollBar?jsb,?final?Timer?timer)?{
this.jsb?=?jsb;
this.timer?=?timer;
jfrm?=?new?JFrame();
jlb1?=?new?JLabel("滾屏速度");
jbt?=?new?JButton("確定");
//?jcheckbox?=?new?JCheckBox("自動(dòng)滾屏");
jcbb?=?new?JComboBox(msg);
jfrm.setLayout(new?FlowLayout());
jfrm.add(jlb1);
jfrm.add(jcbb);
//?jfrm.add(jcheckbox);?jfrm.add(jbt);
jfrm.setVisible(false);
jcbb.setEditable(true);
jfrm.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
jfrm.pack();
}
void?liser()?{
jfrm.setVisible(true);
//?/////監(jiān)聽復(fù)選框///////////////////////////
jcbb.addItemListener(this);
/*
?*?jcbb.addActionListener(new?ActionListener(){?public?void
?*?actionPerformed(ActionEvent?e)?{
?*?jcbb.setSelectedIndex(jcbb.getSelectedIndex());?}});
?*/
//?///////監(jiān)聽按鈕//////////////////////////
jbt.addActionListener(new?ActionListener()?{
public?void?actionPerformed(ActionEvent?arg0)?{
jfrm.setVisible(false);
}
});
//?////////////////////////////////////
/*
?*?jcheckbox.addItemListener(new?ItemListener(){?public?void
?*?itemStateChanged(ItemEvent?e)?{?if(jcheckbox.isSelected()==false){
?*?System.out.println("false");?timer.stop();?}
?*?if(jcheckbox.isSelected()==true){?timer.start();?}?}}?);
?*/
}
@Override
public?void?itemStateChanged(ItemEvent?arg0)?{
sudu?=?(Integer)?jcbb.getSelectedItem();
//?jcbb.setSelectedItem(msg);//jcbb.updateUI()?;
jsb.setUnitIncrement(sudu.intValue());
}
}
文章名稱:java漫畫閱讀器代碼 java漫畫閱讀器代碼怎么用
當(dāng)前路徑:http://chinadenli.net/article16/hejidg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供自適應(yīng)網(wǎng)站、網(wǎng)站維護(hù)、商城網(wǎng)站、域名注冊(cè)、做網(wǎng)站、搜索引擎優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)