?? mediamanagerframe.java
字號(hào):
tapeTable = new JTable(tapeContent, tapeHead);
tapeScroll = new JScrollPane(tapeTable);
tape.add(tapeScroll);
tabbedPane.addTab(" 磁帶明細(xì) ",tape);
JPanel info = new JPanel();
info.setLayout(new GridLayout(2,1,3,3));
JPanel help = new JPanel();
help.setLayout(new GridLayout(8,1));
help.setBorder(new TitledBorder("簡易使用說明"));
JLabel help1 = new JLabel("本系統(tǒng)界面簡潔美觀,功能實(shí)用。可以對(duì)圖書,CD與磁帶進(jìn)行管理。");
JLabel help2 = new JLabel("點(diǎn)擊『插入記錄』根據(jù)信息提示來添加新的條目。");
JLabel help3 = new JLabel("選中一條記錄后點(diǎn)擊『刪除記錄』可以將選中的記錄刪除");
JLabel help4 = new JLabel("點(diǎn)擊『查詢記錄』可以按照不同類型根據(jù)關(guān)鍵詞進(jìn)行模糊查詢");
JLabel help5 = new JLabel("如果想退出系統(tǒng),可以點(diǎn)擊『退出系統(tǒng)』按鈕");
JLabel help6 = new JLabel();
JLabel help7 = new JLabel();
JLabel help8 = new JLabel();
help.add(help1);
help.add(help2);
help.add(help3);
help.add(help4);
help.add(help5);
help.add(help6);
help.add(help7);
help.add(help8);
JPanel about = new JPanel();
about.setLayout(new GridLayout(8,1));
about.setBorder(new TitledBorder("關(guān)于本系統(tǒng)"));
JLabel about1 = new JLabel("音像圖書管理系統(tǒng)");
JLabel about2 = new JLabel("Media Manager 2005 beta1 build 0426");
JLabel about3 = new JLabel();
JLabel about4 = new JLabel("版權(quán)所有: 軟件學(xué)院.55030106.徐徐");
JLabel about5 = new JLabel("版權(quán)聲明: 本軟件開放源代碼。");
JLabel about6 = new JLabel(" 如果您在使用過程中發(fā)現(xiàn)本系統(tǒng)存在什么不足,請(qǐng)及時(shí)指出,謝謝");
JLabel about7 = new JLabel();
JLabel about8 = new JLabel("請(qǐng)密切留意本系統(tǒng)的最新版本");
about.add(about1);
about.add(about2);
about.add(about3);
about.add(about4);
about.add(about5);
about.add(about6);
about.add(about7);
about.add(about8);
info.add(help);
info.add(about);
tabbedPane.addTab(" 其他信息 ",info);
main.add(tabbedPane);
}
protected void windowClosed() {
System.exit(0);
}
protected void bookQuery(){
BookQuery bookQuery = new BookQuery(this,"請(qǐng)輸入",true);
bookQuery.setVisible(true);
boolean find=false;
if(bookQuery.key!=null && !bookQuery.key.equals("")){
String des = bookQuery.key.toLowerCase();
for(int i=0;i<bookCount;++i){
String cnt=bookContent[i][bookQuery.type].toLowerCase();
if(cnt.contains(des)){ //[模糊查詢]
find=true;
BookInput newBook = new BookInput(this,"查詢到符合條件",true);
newBook.setValue(bookContent[i][0],bookContent[i][1],bookContent[i][2],
bookContent[i][3],bookContent[i][4],bookContent[i][5],bookContent[i][6],"下一個(gè) (O)","取 消 (C)");
newBook.setVisible(true);
if(newBook.mediaName==null)break;
}
}
if(!find){
JOptionPane.showMessageDialog(this,"很抱歉,沒有查詢到符合條件的記錄");
}
}
}
protected void bookInsert(){
BookInput newBook = new BookInput(this,"請(qǐng)?zhí)顚懹涗?quot;,true);
newBook.setVisible(true);
if(newBook.mediaName!=null && !newBook.mediaName.equals("")){
MyBook a = new MyBook();
a.setMediaName(newBook.mediaName);
a.setArtist(newBook.artist);
a.setEditor(newBook.editor);
a.setPress(newBook.press);
a.setPrice(newBook.price);
a.setPublishDate(newBook.publishDate);
a.setBookISBN(newBook.bookISBN);
bookInfo[bookcp++]=a;
++bookCount;
showBookTable();
}
}
protected void bookDelete(){
if(bookTable.getSelectedRowCount()!=1){
JOptionPane.showMessageDialog(this,"請(qǐng)選中一條記錄");
}
else{
int i,id=bookTable.getSelectedRow();
for(i=0;i<bookcp;++i){
if(!bookInfo[i].delete && bookInfo[i].id==id){
bookInfo[i].delete=true;
--bookCount;
break;
}
}
showBookTable();
}
}
protected void showBookTable(){
bookContent = null;
bookContent = new String[bookCount][7];
for(int i=0,j=0;j<bookcp;++j){
if(!bookInfo[j].delete){
bookContent[i][0]=bookInfo[j].getMediaName();
bookContent[i][1]=bookInfo[j].getArtist();
bookContent[i][2]=bookInfo[j].getEditor();
bookContent[i][3]=bookInfo[j].getPress();
bookContent[i][4]=bookInfo[j].getPrice();
bookContent[i][5]=bookInfo[j].getPublishDate();
bookContent[i][6]=bookInfo[j].getBookISBN();
bookInfo[j].id=i;
++i;
}
}
book.remove(bookScroll);
bookTable = null;
bookScroll = null;
bookTable = new JTable(bookContent, bookHead);
bookTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
bookScroll = new JScrollPane(bookTable);
book.add(bookScroll);
book.setVisible(false);
book.setVisible(true);
}
protected void cdQuery(){
CdQuery cdQuery = new CdQuery(this,"請(qǐng)輸入",true);
cdQuery.setVisible(true);
boolean find=false;
if(cdQuery.key!=null && !cdQuery.key.equals("")){
String des = cdQuery.key.toLowerCase();
for(int i=0;i<cdCount;++i){
String cnt = cdContent[i][cdQuery.type].toLowerCase();
if(cnt.contains(des)){
find=true;
CdInput newCd = new CdInput(this,"查詢到符合條件",true);
newCd.setValue(cdContent[i][0],cdContent[i][1],cdContent[i][2],
cdContent[i][3],cdContent[i][4],cdContent[i][5],"下一個(gè) (O)","取 消 (C)");
newCd.setVisible(true);
if(newCd.mediaName==null)break;
}
}
if(!find){
JOptionPane.showMessageDialog(this,"很抱歉,沒有查詢到符合條件的記錄");
}
}
}
protected void cdInsert(){
CdInput newCd = new CdInput(this,"請(qǐng)?zhí)顚懹涗?quot;,true);
newCd.setVisible(true);
//[:)]
if(newCd.artist.equals("ViVo"))JOptionPane.showMessageDialog(this,"I LOVE YOU!");
if(newCd.mediaName!=null && !newCd.mediaName.equals("")){
MyCD a = new MyCD();
a.setMediaName(newCd.mediaName);
a.setArtist(newCd.artist);
a.setPress(newCd.press);
a.setPrice(newCd.price);
a.setCdPublisher(newCd.publisher);
a.setCdISRC(newCd.ISRC);
cdInfo[cdcp++]=a;
++cdCount;
showCdTable();
}
}
protected void cdDelete(){
if(cdTable.getSelectedRowCount()!=1){
JOptionPane.showMessageDialog(this,"請(qǐng)選中一條記錄");
}
else{
int i,id=cdTable.getSelectedRow();
for(i=0;i<cdcp;++i){
if(!cdInfo[i].delete && cdInfo[i].id==id){
cdInfo[i].delete=true;
--cdCount;
break;
}
}
showCdTable();
}
}
protected void showCdTable(){
cdContent = null;
cdContent = new String[cdCount][6];
int i,j;
for(i=0,j=0;j<cdcp;++j){
if(!cdInfo[j].delete){
cdContent[i][0]=cdInfo[j].getMediaName();
cdContent[i][1]=cdInfo[j].getArtist();
cdContent[i][2]=cdInfo[j].getPress();
cdContent[i][3]=cdInfo[j].getPrice();
cdContent[i][4]=cdInfo[j].getCdPublisher();
cdContent[i][5]=cdInfo[j].getCdISRC();
cdInfo[j].id=i;
++i;
}
}
cd.remove(cdScroll);
cdTable = null;
cdScroll = null;
cdTable = new JTable(cdContent, cdHead);
cdTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
cdScroll = new JScrollPane(cdTable);
cd.add(cdScroll);
cd.setVisible(false);
cd.setVisible(true);
}
protected void tapeQuery(){
TapeQuery tapeQuery = new TapeQuery(this,"請(qǐng)輸入",true);
tapeQuery.setVisible(true);
boolean find=false;
if(tapeQuery.key!=null && !tapeQuery.key.equals("")){
String des = tapeQuery.key.toLowerCase();
for(int i=0;i<tapeCount;++i){
String cnt = tapeContent[i][tapeQuery.type].toLowerCase();
if(cnt.contains(des)){
find=true;
TapeInput newTape = new TapeInput(this,"查詢到符合條件",true);
newTape.setValue(tapeContent[i][0],tapeContent[i][1],tapeContent[i][2],tapeContent[i][3],
tapeContent[i][4],"下一個(gè) (O)","取 消 (C)");
newTape.setVisible(true);
if(newTape.mediaName==null)break;
}
}
if(!find){
JOptionPane.showMessageDialog(this,"很抱歉,沒有查詢到符合條件的記錄");
}
}
}
protected void tapeInsert(){
TapeInput newTape = new TapeInput(this,"請(qǐng)?zhí)顚懹涗?quot;,true);
newTape.setVisible(true);
if(newTape.mediaName!=null && !newTape.mediaName.equals("")){
MyTape a = new MyTape();
a.setMediaName(newTape.mediaName);
a.setArtist(newTape.artist);
a.setPress(newTape.press);
a.setPrice(newTape.price);
a.setTapeISRC(newTape.ISRC);
tapeInfo[tapecp++]=a;
++tapeCount;
showTapeTable();
}
}
protected void tapeDelete(){
if(tapeTable.getSelectedRowCount()!=1){
JOptionPane.showMessageDialog(this,"請(qǐng)選中一條記錄");
}
else{
int i,id=tapeTable.getSelectedRow();
for(i=0;i<tapecp;++i){
if(!tapeInfo[i].delete && tapeInfo[i].id==id){
tapeInfo[i].delete=true;
--tapeCount;
break;
}
}
showTapeTable();
}
}
protected void showTapeTable(){
tapeContent = null;
tapeContent = new String[tapeCount][5];
int i,j;
for(i=0,j=0;j<tapecp;++j){
if(!tapeInfo[j].delete){
tapeContent[i][0]=tapeInfo[j].getMediaName();
tapeContent[i][1]=tapeInfo[j].getArtist();
tapeContent[i][2]=tapeInfo[j].getPress();
tapeContent[i][3]=tapeInfo[j].getPrice();
tapeContent[i][4]=tapeInfo[j].getTapeISRC();
tapeInfo[j].id=i;
++i;
}
}
tape.remove(tapeScroll);
tapeTable = null;
tapeScroll = null;
tapeTable = new JTable(tapeContent, tapeHead);
tapeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tapeScroll = new JScrollPane(tapeTable);
tape.add(tapeScroll);
tape.setVisible(false);
tape.setVisible(true);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -