?? web158_com_config.java
字號:
package web158.com;
/**
* @param 李建東
*
* 聯(lián)系電話:0898-62925341
*
* 聯(lián)系QQ:813751 657597 8912740
*
* 網(wǎng) 址:
* http://www.web156.com
* http://www.web158.com
*/
import java.awt.Font;
import java.awt.Graphics;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.UIManager;
class Web158_Com_Config {
Web158_Com_Config()
{
}
//初始化字體
void initFont()
{
Font font = new Font("宋體",0,12);
UIManager.put("Label.font", font);
UIManager.put("Button.font", font);
UIManager.put("OptionPane.font", font);
UIManager.put("OptionPane.messageFont", font);
UIManager.put("OptionPane.buttonFont", font);
}
//配置參數(shù)是否完整
public boolean web_158_config_ok()
{
try
{
File web158_skin=new File("web158_com_config/info.dll");
File web158_photo=new File("web158_com_skin/nophoto.dll");
//位圖資源文件存在返回正確
if(web158_skin.exists()&&web158_photo.exists())
{
//新建試題文件
File f=new File("D:/myexam/exam/");
//創(chuàng)建文件夾
if(!f.exists())
{
f.mkdirs();
}
return true;
}
//讀取資源文件失敗反回假值
else
{
return false;
}
}
catch(Exception web158_skin_no)
{
System.out.print(web158_skin_no.getMessage());
return false;
}
}
//打開技術(shù)支持
public boolean gotoWeb158_com()
{
File f=new File("C:\\Program Files\\Internet Explorer\\Iexplore.exe");
// 是XP存在
if(f.exists())
{
try{
String command = f+" http://www.web158.com";
Runtime.getRuntime().exec(command);
return true;
}//end of try
//出錯返回
catch(IOException ex)
{
return false;
}
}
//不存在返回
else
{
return false;
}
}
}
//系統(tǒng)皮膚
//窗口背景Panel
class web158_com_getSkin extends JPanel
{
web158_com_getSkin(){
}
public void paintComponent(Graphics g)
{
int x=0;
int y=0;
ImageIcon im = new ImageIcon("web158_com_config/info.dll");
while(true)
{
g.drawImage(im.getImage(),x,y,this);
if(x>getSize().width&&y>getSize().height)
break;
if(x>getSize().width)
{
x=0;
y+=im.getIconHeight();
}
else
x+=im.getIconWidth();
}
}
}
//考生圖片
class web158_com_pic extends JPanel
{
String picurl="nophoto.dll";
String name="nophoto.dll";
web158_com_pic()
{
this.setBorder(BorderFactory.createLineBorder(new Color(255,255,255)));
}
//接受外來參數(shù)
public void setPicurl(String url,String name)
{
this.picurl=url;
this.name=name;
}
public void paintComponent(Graphics g)
{
File f=new File("web158_com_skin/"+picurl);
if(!f.exists())
{
picurl="nophoto.dll";
}
int x=0;
int y=0;
try
{
ImageIcon im = new ImageIcon("web158_com_skin/"+picurl);
while(true)
{
g.drawImage(im.getImage(),x,y,this);
//如果是沒有圖片
if(picurl.equals("nophoto.dll"))
{
g.setColor(new Color(120,140,150));
g.drawString("華夏網(wǎng)建 ",im.getIconWidth()-70 , im.getIconHeight()-16);
}
else
{
g.setColor(new Color(0,0,0));
g.drawString("考生:"+name,(im.getIconWidth()-name.length())/4 , im.getIconHeight()-5);
}
if(x>getSize().width&&y>getSize().height)
break;
if(x>getSize().width)
{
x=0;
y+=im.getIconHeight();
}
else
x+=im.getIconWidth();
}
}catch(Exception ef)
{
System.out.print("出現(xiàn)頭象錯誤");
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -