📄 message.java
字号:
} g.drawString(display_text[a],screenWidth*5/100 ,temp2+(font.getHeight()*0) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+1],screenWidth*5/100 ,temp2+(font.getHeight()*1) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+2],screenWidth*5/100 ,temp2+(font.getHeight()*2) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+3],screenWidth*5/100 ,temp2+(font.getHeight()*3) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+4],screenWidth*5/100 ,temp2+(font.getHeight()*4) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+5],screenWidth*5/100 ,temp2+(font.getHeight()*5) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+6],screenWidth*5/100 ,temp2+(font.getHeight()*6) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+7],screenWidth*5/100 ,temp2+(font.getHeight()*7) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+8],screenWidth*5/100 ,temp2+(font.getHeight()*8) ,Graphics.TOP|Graphics.LEFT); draw_scroll_bar(type); } if (type ==4) { draw_image("ug_bg.png",screenWidth*40/100,screenHeight*60/100 ); g.drawString ("How To Use",screenWidth*5/100,screenHeight*5/100,Graphics.TOP|Graphics.LEFT ); temp2 =screenHeight*18/100; g.setFont(font); if (font.stringWidth(content) >screenWidth*9/10){ for (int i=0; i<content.length();i++) { if (content.charAt(i)==' ') { temp=content.substring(k,i); if (font.stringWidth(temp) >screenWidth*9/10){ temp = content.substring(k,j); display_text[l]=temp; l++; k=j+1; temp=content.substring(k,content.length()); if (font.stringWidth(temp) <=screenWidth*9/10) { display_text[l]=temp; break; } } j=i; } } }else { //g.drawString(content ,screenWidth*5/100 ,temp2,Graphics.TOP|Graphics.LEFT); } g.drawString(display_text[a],screenWidth*5/100 ,temp2+(font.getHeight()*0) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+1],screenWidth*5/100 ,temp2+(font.getHeight()*1) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+2],screenWidth*5/100 ,temp2+(font.getHeight()*2) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+3],screenWidth*5/100 ,temp2+(font.getHeight()*3) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+4],screenWidth*5/100 ,temp2+(font.getHeight()*4) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+5],screenWidth*5/100 ,temp2+(font.getHeight()*5) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+6],screenWidth*5/100 ,temp2+(font.getHeight()*6) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+7],screenWidth*5/100 ,temp2+(font.getHeight()*7) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+8],screenWidth*5/100 ,temp2+(font.getHeight()*8) ,Graphics.TOP|Graphics.LEFT); draw_scroll_bar(type); } if (type==5){ g.drawImage (preview, 0, screenHeight/20, Graphics.TOP | Graphics.LEFT); } flushGraphics(); } private void draw_content(String content, int temp2) { String temp; int k=0; int l=0; int j=0; g.setFont(font); if (font.stringWidth(content) >screenWidth*9/10){ for (int i=0; i<content.length();i++) { if (content.charAt(i)==' ') { temp=content.substring(k,i); if (font.stringWidth(temp) >screenWidth*9/10){ temp = content.substring(k,j); g.drawString(temp,screenWidth*5/100 ,temp2+(font.getHeight()*l) ,Graphics.TOP|Graphics.LEFT); l++; k=j+1; temp=content.substring(k,content.length()); if (font.stringWidth(temp) <=screenWidth*9/10) { g.drawString(temp,screenWidth*5/100 ,temp2+(font.getHeight()*l) ,Graphics.TOP|Graphics.LEFT); } } j=i; } } }else { g.drawString(content ,screenWidth*5/100 ,temp2,Graphics.TOP|Graphics.LEFT); } } private void draw_scroll_bar(int type) { int h; if (type==3) { h=9*9*font.getHeight()/(l+10); g.setColor(250,180,10); g.fillRect(screenWidth-6, screenHeight/20+font_title.getHeight()+1,6,9*font.getHeight()); g.setColor(251,224,171); g.fillRect(screenWidth-5,progress_h,4,h); } if (type==4) { h=9*9*font.getHeight()/(l+1); g.setColor(250,180,10); g.fillRect(screenWidth-6, screenHeight/20+font_title.getHeight()+1,6,9*font.getHeight()); g.setColor(251,224,171); g.fillRect(screenWidth-5,progress_h,4,h); } } public void key_Pressed() { int keyState =getKeyStates(); if ((keyState & UP_PRESSED) !=0) { if (type==3) { if (a==0) { }else{ a--; } g.setColor(255,255,255); g.fillRect(screenWidth*1/100 ,temp2,screenWidth*98/100,(font.getHeight()*9)); g.setColor(0,0,0); g.drawString(display_text[a],screenWidth*5/100 ,temp2+(font.getHeight()*0) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+1],screenWidth*5/100 ,temp2+(font.getHeight()*1) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+2],screenWidth*5/100 ,temp2+(font.getHeight()*2) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+3],screenWidth*5/100 ,temp2+(font.getHeight()*3) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+4],screenWidth*5/100 ,temp2+(font.getHeight()*4) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+5],screenWidth*5/100 ,temp2+(font.getHeight()*5) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+6],screenWidth*5/100 ,temp2+(font.getHeight()*6) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+7],screenWidth*5/100 ,temp2+(font.getHeight()*7) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+8],screenWidth*5/100 ,temp2+(font.getHeight()*8) ,Graphics.TOP|Graphics.LEFT); progress_h=(screenHeight/20+font_title.getHeight()+1)+(a)*9*font.getHeight()/(l+10); draw_scroll_bar(type); } if (type ==4) { if (a==0) { }else{ a--; } g.setColor(255,255,255); g.fillRect(screenWidth*1/100 ,temp2,screenWidth*98/100,(font.getHeight()*9)); draw_image("ug_bg.png",screenWidth*40/100,screenHeight*60/100 ); g.setColor(0,0,0); g.drawString(display_text[a],screenWidth*5/100 ,temp2+(font.getHeight()*0) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+1],screenWidth*5/100 ,temp2+(font.getHeight()*1) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+2],screenWidth*5/100 ,temp2+(font.getHeight()*2) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+3],screenWidth*5/100 ,temp2+(font.getHeight()*3) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+4],screenWidth*5/100 ,temp2+(font.getHeight()*4) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+5],screenWidth*5/100 ,temp2+(font.getHeight()*5) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+6],screenWidth*5/100 ,temp2+(font.getHeight()*6) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+7],screenWidth*5/100 ,temp2+(font.getHeight()*7) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+8],screenWidth*5/100 ,temp2+(font.getHeight()*8) ,Graphics.TOP|Graphics.LEFT); progress_h=(screenHeight/20+font_title.getHeight()+1)+(a)*9*font.getHeight()/(l+10); draw_scroll_bar(type); } } if ((keyState & DOWN_PRESSED) !=0) { if (type ==3) { if (a==l+9-6-2) { }else{ a++; } g.setColor(255,255,255); g.fillRect(screenWidth*1/100 ,temp2,screenWidth*98/100,(font.getHeight()*9)); g.setColor(0,0,0); g.drawString(display_text[a],screenWidth*5/100 ,temp2+(font.getHeight()*0) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+1],screenWidth*5/100 ,temp2+(font.getHeight()*1) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+2],screenWidth*5/100 ,temp2+(font.getHeight()*2) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+3],screenWidth*5/100 ,temp2+(font.getHeight()*3) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+4],screenWidth*5/100 ,temp2+(font.getHeight()*4) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+5],screenWidth*5/100 ,temp2+(font.getHeight()*5) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+6],screenWidth*5/100 ,temp2+(font.getHeight()*6) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+7],screenWidth*5/100 ,temp2+(font.getHeight()*7) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+8],screenWidth*5/100 ,temp2+(font.getHeight()*8) ,Graphics.TOP|Graphics.LEFT); progress_h=(screenHeight/20+font_title.getHeight()+1)+(a)*9*font.getHeight()/(l+10); draw_scroll_bar(type); } if (type ==4) { if (a==l-8) { }else{ a++; } g.setColor(255,255,255); g.fillRect(screenWidth*1/100 ,temp2,screenWidth*98/100,(font.getHeight()*9)); draw_image("ug_bg.png",screenWidth*40/100,screenHeight*60/100 ); g.setColor(0,0,0); g.drawString(display_text[a],screenWidth*5/100 ,temp2+(font.getHeight()*0) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+1],screenWidth*5/100 ,temp2+(font.getHeight()*1) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+2],screenWidth*5/100 ,temp2+(font.getHeight()*2) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+3],screenWidth*5/100 ,temp2+(font.getHeight()*3) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+4],screenWidth*5/100 ,temp2+(font.getHeight()*4) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+5],screenWidth*5/100 ,temp2+(font.getHeight()*5) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+6],screenWidth*5/100 ,temp2+(font.getHeight()*6) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+7],screenWidth*5/100 ,temp2+(font.getHeight()*7) ,Graphics.TOP|Graphics.LEFT); g.drawString(display_text[a+8],screenWidth*5/100 ,temp2+(font.getHeight()*8) ,Graphics.TOP|Graphics.LEFT); progress_h=(screenHeight/20+font_title.getHeight()+1)+(a)*9*font.getHeight()/(l+1); draw_scroll_bar(type); } } flushGraphics(); } public void run() { while (!select_pressed) { key_Pressed(); try { Thread.sleep(100); }catch (InterruptedException ie) {} } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -