數據加載中……

          程序設計

          JAVA:JTextField文本框輸入過濾
               摘要: import javax.swing.text.AttributeSet;
          import javax.swing.text.BadLocationException;
          import javax.swing.text.PlainDocument;

          public class LimitedDocument extends PlainDocument {

          private int maxLength = -1;
          private String allowCharAsString = null;

          public LimitedDocument() {
          super();
          }  閱讀全文

          posted @ 2009-05-25 10:32 YeeYang 閱讀(918) | 評論 (0)  編輯

          JAVA:DES可逆加密算法
               摘要: import java.security.*;
          import javax.crypto.*;

          public class DESPlus {
          private static String strDefaultKey = "national";
          private Cipher encryptCipher = null;
          private Cipher decryptCipher = null;

          /**
          * 將byte數組轉換為表示16進制值的字符串, 如:byte[]{8,18}轉換為:0813, 和public static byte[]
          * hexStr2ByteArr(String strIn) 互為可逆的轉換過程
          *
          * @param arrB
          * 需要轉換的byte數組
          * @return 轉換后的字符串
          * @throws Exception
          * 本方法不處理任何異常  閱讀全文

          posted @ 2009-05-24 11:18 YeeYang 閱讀(6724) | 評論 (0)  編輯

          JAVA:MD5不可逆加密算法
               摘要: import java.security.MessageDigest;
          import java.security.*;
          import java.security.spec.*;

          /*
          * To change this template, choose Tools | Templates
          * and open the template in the editor.
          */
          /**
          *
          * @author Administrator
          */
          public class MD5 {  閱讀全文

          posted @ 2009-05-23 10:27 YeeYang 閱讀(732) | 評論 (0)  編輯

          JAVA:對JFrame窗口的一些操作(個人累積)
               摘要: 下面就是在jFrame下的一些方法經驗積累,可能很微小很不起眼,或許對新手有點點幫助,我會不定時更新一下的:

          1)改變界面為系統默認狀態:
          1 //需要導入這個包
          2 import javax.swing.UIManager;
          3
          4 //改變界面為系統默認狀態
          5
          6 try {
          7
          8 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); //設置界面樣式
          9
          10 javax.swing.SwingUtilities.updateComponentTreeUI(this); //更新界面
          11
          12 } catch (Exception ex) { //捕捉錯誤
          13
          14 ex.printStackTrace(); //輸出錯誤  閱讀全文

          posted @ 2009-05-22 10:35 YeeYang 閱讀(714) | 評論 (0)  編輯

          JAVA:獲取本機外網IP地址的小工具
               摘要: 本人的思路是讓程序去訪問(HttpURLConnection)一個可以查IP地址的,然后把這個網頁下載(FileOutputStream)到本地,通過(BufferedReader)去讀取那個臨時文件,最后通過操作文件(File),把臨時文件刪除,并以彈出“對話框”形式把獲取的“外網 IP”顯示出來。

          提供幾個查IP反回頁面相對簡單的網址,訪問不同的網址,讀取關鍵字符串的時候可能會不同,請做出相應的修改。

          http://www.bliao.com/ip.phtml
          http://www.5di1.com/getip/getip.asp
          http://www.m5home.com/myip
          http://vbnet.mvps.org/resources/tools/getpublicip.shtml  閱讀全文

          posted @ 2009-05-19 23:35 YeeYang 閱讀(5742) | 評論 (3)  編輯

          主站蜘蛛池模板: 邯郸县| 新昌县| 梅州市| 区。| 和平区| 南安市| 福州市| 体育| 鄂伦春自治旗| 兴义市| 永嘉县| 平安县| 西城区| 南安市| 岳普湖县| 汉川市| 博罗县| 广河县| 洛南县| 临武县| 文昌市| 射阳县| 乌鲁木齐市| 阿勒泰市| 凤山市| 简阳市| 吉林市| 理塘县| 出国| 兰考县| 昌都县| 闽侯县| 乐业县| 屯门区| 河北区| 沁水县| 康平县| 新疆| 元朗区| 五常市| 英山县|