User:Paurokawasu/sandbox

$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

Set-ItemProperty -Path $regPath -Name "ProxyEnable" -Value 1 Set-ItemProperty -Path $regPath -Name "ProxyServer" -Value "spxy.bpi.fr:3128"
 * 1) Enable proxy

Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name "ProxyServer" -Value "spxy.bpi.fr:3128"
 * 1) one liner


 * 1) Disable proxy
 * 2) Set-ItemProperty -Path $regPath -Name "ProxyEnable" -Value 0
 * 3) Set-ItemProperty -Path $regPath -Name "ProxyServer" -Value ""

//=================================================================================================== //Eclipse Baidu //http://dlsw.baidu.com/sw-search-sp/soft/fa/25046/eclipse-SDK-421.1394615537.zip //Luna //http://dlsw.baidu.com/sw-search-sp/soft/82/14505/LunaSetup6100_ml11_gl.1438857301.exe //=================================================================================================== //DaiRiSaaBaa.py //===================================================================================================

import _winreg as winreg

INTERNET_SETTINGS = winreg.OpenKey(winreg.HKEY_CURRENT_USER,   r'Software\Microsoft\Windows\CurrentVersion\Internet Settings',    0, winreg.KEY_ALL_ACCESS)

def set_key(name, value): _, reg_type = winreg.QueryValueEx(INTERNET_SETTINGS, name) winreg.SetValueEx(INTERNET_SETTINGS, name, 0, reg_type, value)

set_key('ProxyEnable', 1) set_key('ProxyOverride', u'*.local; ') # Bypass the proxy for localhost set_key('ProxyServer', u'spxy.bpi.fr:3128') //set_key('ProxyServer', u'10.1.2.30:3128')

-- After the script runs the browsers will still have the old proxy stored in-memory, so you need to restart them so they can re-read the new proxy settings from the registry. I found this to be very annoying so I converted this snippet to Python. import ctypes

INTERNET_OPTION_REFRESH = 37 INTERNET_OPTION_SETTINGS_CHANGED = 39

internet_set_option = ctypes.windll.Wininet.InternetSetOptionW

internet_set_option(0, self.INTERNET_OPTION_REFRESH, 0, 0) internet_set_option(0, self.INTERNET_OPTION_SETTINGS_CHANGED, 0, 0) This refreshes the Windows settings so all you have to do is hit F5 in your browser in order to it grab the new proxy settings.

=
==============================================================================================================

=
=========== KATAKANA_SURU

=
========== import javax.swing.* ; import java.util.*; import java.awt.Toolkit; //クリップボード import java.awt.datatransfer.Clipboard;////クリップボード import java.awt.datatransfer.StringSelection;////クリップボード

public class KATAKANA_SURU { String[][] カナヽハイレツ = { {"a","ア","ｱ","あ"},{"i","イ","ｲ","い"},{"u","ウ","ｳ","う"},{"e","エ","ｴ","え"},{"o","オ","ｵ","お"}, {"ka","カ","ｶ","か"},{"ki","キ","ｷ","き"},{"ku","ク","ｸ","く"},{"ke","ケ","ｹ","け"},{"ko","コ","ｺ","こ"}, {"ga","ガ","ｶﾞ","が"},{"gi","ギ","ｷﾞ","ぎ"},{"gu","グ","ｸﾞ","ぐ"},{"ge","ゲ","ｹﾞ","げ"},{"go","ゴ","ｺﾞ","ご"}, {"sa","サ","ｻ","さ"},{"shi","シ","ｼ","し"},{"su","ス","ｽ","す"},{"se","セ","ｾ","せ"},{"so","ソ","ｿ","そ"}, {"za","ザ","ｻﾞ","ざ"},{"ji","ジ","ｼﾞ","じ"},{"zu","ズ","ｽﾞ","ず"},{"ze","ゼ","ｾﾞ","ぜ"},{"zo","ゾ","ｿﾞ","ぞ"}, {"ta","タ","ﾀ","た"},{"chi","チ","ﾁ","ち"},{"tsu","ツ","ﾂ","つ"},{"te","テ","ﾃ","て"},{"to","ト","ﾄ","と"}, {"da","ダ","ﾀﾞ","だ"},{"dzi","ヂ","ﾁﾞ","ぢ"},{"dzu","ヅ","ﾂﾞ","づ"},{"de","デ","ﾃﾞ","で"},{"do","ド","ﾄﾞ","ど"}, {"na","ナ","ﾅ","な"},{"ni","ニ","ﾆ","に"},{"nu","ヌ","ﾇ","ぬ"},{"ne","ネ","ﾈ","ね"},{"no","ノ","ﾉ","の"}, {"ha","ハ","ﾊ","は"},{"hi","ヒ","ﾋ","ひ"},{"fu","フ","ﾌ","ふ"},{"he","ヘ","ﾍ","へ"},{"ho","ホ","ﾎ","ほ"}, {"ba","バ","ﾊﾞ","ば"},{"bi","ビ","ﾋﾞ","び"},{"bu","ブ","ﾌﾞ","ぶ"},{"be","ベ","ﾍﾞ","べ"},{"bo","ボ","ﾎﾞ","ぼ"}, {"pa","パ","ﾊﾟ","ぱ"},{"pi","ピ","ﾋﾟ","ぴ"},{"pu","プ","ﾌﾟ","ぷ"},{"pe","ペ","ﾍﾟ","ぺ"},{"po","ポ","ﾎﾟ","ぽ"}, {"ma","マ","ﾏ","ま"},{"mi","ミ","ﾐ","み"},{"mu","ム","ﾑ","む"},{"me","メ","ﾒ","め"},{"mo","モ","ﾓ","も"}, {"ya","ヤ","ﾔ","や"},{"yu","ユ","ﾕ","ゆ"},{"yo","ヨ","ﾖ","よ"}, {"ra","ラ","ﾗ","ら"},{"ri","リ","ﾘ","り"},{"ru","ル","ﾙ","る"},{"re","レ","ﾚ","れ"},{"ro","ロ","ﾛ","ろ"}, {"wa","ワ","ﾜ","わ"},{"wi","ヰ"," ","ゐ"},{"wu","ㄊ","ﾑﾟﾞ"," "},{"we","ヱ"," ","ゑ"},{"wo","ヲ","ｦ","を"}, {"n","ヽ","ﾝﾟ","ゝ"},{"nn","ン","ﾝ","ん"},{"nnn","ヾ","ﾝﾞ","ゞ"}, {"_a","ァ","ｧ","ぁ"},{"_i","ィ","ｨ","ぃ"},{"_u","ゥ","ｩ","ぅ"},{"_e","ェ","ｪ","ぇ"},{"_o","ォ","ｫ","ぉ"}, {"_ya","ャ","ｬ","ゃ"},{"_yu","ュ","ｭ","ゅ"},{"_yo","ョ","ｮ","ょ"}, {"_tsu","ッ","ｯ","っ"}, {"koto","ヿ"," "," "},{"yori"," "," ","ゟ"},{"_vi","ヸ"," "," "},{"vi","ヴィ"," "," "}, {"va","ヴァ"," "," "},{"_va","ヷ"," "," "}, {"vo","ヴォ"," "," "},{"_vo","ヺ"," "," "},{"_wa","ヮ"," ","ゎ"},{"_ka","ヵ"," ","ゕ"},{"_ke","ヶ"," ","ゖ"},{"_ge"," "," ","ゖ゙"}, {"vu","ヴ"," "," "}, {"kya","キャ","ｷｬ","きゃ"},{"kyu","キュ","ｷｭ","きゅ"},{"kyo","キョ","ｷｮ","きょ"}, {"sha","シャ","ｼｬ","しゃ"},{"shu","シュ","ｼｭ","しゅ"},{"sho","ショ","ｼｮ","しょ"}, {"cha","チャ","ﾁｬ","ちゃ"},{"chu","チュ","ﾁｭ","ちゅ"},{"cho","チョ","ﾁｮ","ちょ"}, {"nya","ニャ","ﾆｬ","にゃ"},{"nyu","ニュ","ﾆｭ","にゅ"},{"nyo","ニョ","ﾆｮ","にょ"}, {"hya","ヒャ","ﾋｬ","ひゃ"},{"hyu","ヒュ","ﾋｭ","ひゅ"},{"hyo","ヒョ","ﾋｮ","ひょ"}, {"mya","ミャ","ﾐｬ","みゃ"},{"myu","ミュ","ﾐｭ","みゅ"},{"myo","ミョ","ﾐｮ","みょ"}, {"rya","リャ","ﾘｬ","りゃ"},{"ryu","リュ","ﾘｭ","りゅ"},{"ryo","リョ","ﾘｮ","りょ"}, {"gya","ギャ","ｷﾞｬ","ざゃ"},{"gyu","ギュ","ｷﾞｭ","ざゅ"},{"gyo","ギョ","ｷﾞｮ","ざょ"}, {"ja","ジャ","ｼﾞｬ","じゃ"},{"ju","ジュ","ｼﾞｭ","じゅ"},{"jo","ジョ","ｼﾞｮ","じょ"}, {"dja","ヂャ","ﾁﾞｬ","ぢゃ"},{"dju","ヂュ","ﾁﾞｭ","ぢゅ"},{"djo","ヂョ","ﾁﾞｮ","ぢょ"}, {"bya","ビャ","ﾋﾞｬ","びゃ"},{"byu","ビュ","ﾋﾞｭ","びゅ"},{"byo","ビョ","ﾋﾞｮ","びょ"}, {"pya","ピャ","ﾋﾟｬ","ぴゃ"},{"pyu","ピュ","ﾋﾟｭ","ぴゅ"},{"pyo","ピョ","ﾋﾟｮ","ぴょ"}, {"fa","ファ","ﾌｧ","ふぁ"},{"fi","フィ","ﾌｨ","ふぃ"},{"fe","フェ","ﾌｪ","ふぇ"},{"fo","フォ","ﾌｫ","ふぉ"}, {"di","ディ","ﾃﾞｨ","でぃ"},{"du","デゥ","ﾃﾞｩ","でぅ"},{"ti","ティ","ﾃｨ","てぃ"},{"tu","テゥ","ﾃｩ","てぅ"} ,{"--","ー"," "," "} };

public static void main(String[] args) {

KATAKANA_SURU セイド = new KATAKANA_SURU; int カナハイレツヽナガサ_長サ = セイド.カナヽハイレツ.length;

Random ランダム = new Random; int ツウワヽ通話 = ランダム.nextInt(カナハイレツヽナガサ_長サ);

HashMap  ローマジヽ片仮名ヽハッシュマップ = new HashMap  ; HashMap  ローマジヽひらがなヽハッシュマップ = new HashMap  ; HashMap  ひらがなヽ片仮名ヽハッシュマップ = new HashMap  ; //ハンカクカタカナヽ半角カタカナ HashMap  ローマジヽ半角カタカナヽハンカクヽハッシュマップ = new HashMap  ;

for (int i = 0; i<セイド.カナヽハイレツ.length; i++){ ローマジヽ片仮名ヽハッシュマップ.put(セイド.カナヽハイレツ[i][0],セイド.カナヽハイレツ[i][1]); ローマジヽひらがなヽハッシュマップ.put(セイド.カナヽハイレツ[i][0],セイド.カナヽハイレツ[i][3]); ひらがなヽ片仮名ヽハッシュマップ.put(セイド.カナヽハイレツ[i][3],セイド.カナヽハイレツ[i][1]); ローマジヽ半角カタカナヽハンカクヽハッシュマップ.put(セイド.カナヽハイレツ[i][0],セイド.カナヽハイレツ[i][2]); }		//String カタカナ = 片仮名ハッシュマップ.get("ka"); String カタカナヽアウトライン = "" ; while (true){

String ロマージインライン = "" ; while(true) { //System.out.println("キーボードヽインプット: "); //Scanner キーボードヽインプット = new Scanner(System.in);

//ロマージインライン = JOptionPane.showInputDialog(null,"ロマージ : ");

//	ロマージインライン = JOptionPane.showInputDialog("ロマージ : ",カタカナヽアウトライン); JOptionPane オプション枠 = new JOptionPane; オプション枠.setInitialValue(カタカナヽアウトライン); ロマージインライン=オプション枠.showInputDialog("ロマージヽカタカナ : ",カタカナヽアウトライン);

//>オプション枠.setName(name)

カタカナヽアウトライン = "" ;

if (ロマージインライン == null ) System.out.println("ロマージ インプット ジャアリマセン"); else { System.out.println("ロマージ インプット : " + ロマージインライン );} break;

}

StringTokenizer 符レツ = new StringTokenizer (ロマージインライン, " "); int 総計 = 符レツ.countTokens; for (int ナ=0; ナ<総計; ナ++) { String ツイテフ = 符レツ.nextToken; String ケッカ = ローマジヽ片仮名ヽハッシュマップ.get(ツイテフ); //if (ケッカ != null) { カタカナヽアウトライン = カタカナヽアウトライン + ケッカ ; } カタカナヽアウトライン = カタカナヽアウトライン + ケッカ ;

}		System.out.println("符レツ 総計: " + 総計); System.out.println("カタカナヽアウトライン : " + カタカナヽアウトライン );

//クリップボード Toolkit ツールキット = Toolkit.getDefaultToolkit; Clipboard クリップボード = ツールキット.getSystemClipboard; StringSelection セレクトヽモジレツ = new StringSelection(カタカナヽアウトライン); クリップボード.setContents(セレクトヽモジレツ, null);

}

} // while end }

=
=== HIRAGANA_KATAKANA

=
======= import javax.swing.* ; import java.util.*; import java.awt.Font; import java.awt.Toolkit; //クリップボード import java.awt.datatransfer.Clipboard;////クリップボード import java.awt.datatransfer.StringSelection;////クリップボード

public class HIRAGANA_KATAKANA { String[][] カナヽハイレツ = { {"a","ア","ｱ","あ"},{"i","イ","ｲ","い"},{"u","ウ","ｳ","う"},{"e","エ","ｴ","え"},{"o","オ","ｵ","お"}, {"ka","カ","ｶ","か"},{"ki","キ","ｷ","き"},{"ku","ク","ｸ","く"},{"ke","ケ","ｹ","け"},{"ko","コ","ｺ","こ"}, {"ga","ガ","ｶﾞ","が"},{"gi","ギ","ｷﾞ","ぎ"},{"gu","グ","ｸﾞ","ぐ"},{"ge","ゲ","ｹﾞ","げ"},{"go","ゴ","ｺﾞ","ご"}, {"sa","サ","ｻ","さ"},{"shi","シ","ｼ","し"},{"su","ス","ｽ","す"},{"se","セ","ｾ","せ"},{"so","ソ","ｿ","そ"}, {"za","ザ","ｻﾞ","ざ"},{"ji","ジ","ｼﾞ","じ"},{"zu","ズ","ｽﾞ","ず"},{"ze","ゼ","ｾﾞ","ぜ"},{"zo","ゾ","ｿﾞ","ぞ"}, {"ta","タ","ﾀ","た"},{"chi","チ","ﾁ","ち"},{"tsu","ツ","ﾂ","つ"},{"te","テ","ﾃ","て"},{"to","ト","ﾄ","と"}, {"da","ダ","ﾀﾞ","だ"},{"dzi","ヂ","ﾁﾞ","ぢ"},{"dzu","ヅ","ﾂﾞ","づ"},{"de","デ","ﾃﾞ","で"},{"do","ド","ﾄﾞ","ど"}, {"na","ナ","ﾅ","な"},{"ni","ニ","ﾆ","に"},{"nu","ヌ","ﾇ","ぬ"},{"ne","ネ","ﾈ","ね"},{"no","ノ","ﾉ","の"}, {"ha","ハ","ﾊ","は"},{"hi","ヒ","ﾋ","ひ"},{"fu","フ","ﾌ","ふ"},{"he","ヘ","ﾍ","へ"},{"ho","ホ","ﾎ","ほ"}, {"ba","バ","ﾊﾞ","ば"},{"bi","ビ","ﾋﾞ","び"},{"bu","ブ","ﾌﾞ","ぶ"},{"be","ベ","ﾍﾞ","べ"},{"bo","ボ","ﾎﾞ","ぼ"}, {"pa","パ","ﾊﾟ","ぱ"},{"pi","ピ","ﾋﾟ","ぴ"},{"pu","プ","ﾌﾟ","ぷ"},{"pe","ペ","ﾍﾟ","ぺ"},{"po","ポ","ﾎﾟ","ぽ"}, {"ma","マ","ﾏ","ま"},{"mi","ミ","ﾐ","み"},{"mu","ム","ﾑ","む"},{"me","メ","ﾒ","め"},{"mo","モ","ﾓ","も"}, {"ya","ヤ","ﾔ","や"},{"yu","ユ","ﾕ","ゆ"},{"yo","ヨ","ﾖ","よ"}, {"ra","ラ","ﾗ","ら"},{"ri","リ","ﾘ","り"},{"ru","ル","ﾙ","る"},{"re","レ","ﾚ","れ"},{"ro","ロ","ﾛ","ろ"}, {"wa","ワ","ﾜ","わ"},{"wi","ヰ"," ","ゐ"},{"wu","ㄊ","ﾑﾟﾞ"," "},{"we","ヱ"," ","ゑ"},{"wo","ヲ","ｦ","を"}, {"n","ヽ","ﾝﾟ","ゝ"},{"nn","ン","ﾝ","ん"},{"nnn","ヾ","ﾝﾞ","ゞ"}, {"_a","ァ","ｧ","ぁ"},{"_i","ィ","ｨ","ぃ"},{"_u","ゥ","ｩ","ぅ"},{"_e","ェ","ｪ","ぇ"},{"_o","ォ","ｫ","ぉ"}, {"_ya","ャ","ｬ","ゃ"},{"_yu","ュ","ｭ","ゅ"},{"_yo","ョ","ｮ","ょ"}, {"_tsu","ッ","ｯ","っ"}, {"koto","ヿ"," "," "},{"yori"," "," ","ゟ"},{"_vi","ヸ"," "," "},{"vi","ヴィ"," "," "}, {"va","ヴァ"," "," "},{"_va","ヷ"," "," "}, {"vo","ヴォ"," "," "},{"_vo","ヺ"," "," "},{"_wa","ヮ"," ","ゎ"},{"_ka","ヵ"," ","ゕ"},{"_ke","ヶ"," ","ゖ"},{"_ge"," "," ","ゖ゙"}, {"vu","ヴ"," "," "}, {"kya","キャ","ｷｬ","きゃ"},{"kyu","キュ","ｷｭ","きゅ"},{"kyo","キョ","ｷｮ","きょ"}, {"sha","シャ","ｼｬ","しゃ"},{"shu","シュ","ｼｭ","しゅ"},{"sho","ショ","ｼｮ","しょ"}, {"cha","チャ","ﾁｬ","ちゃ"},{"chu","チュ","ﾁｭ","ちゅ"},{"cho","チョ","ﾁｮ","ちょ"}, {"nya","ニャ","ﾆｬ","にゃ"},{"nyu","ニュ","ﾆｭ","にゅ"},{"nyo","ニョ","ﾆｮ","にょ"}, {"hya","ヒャ","ﾋｬ","ひゃ"},{"hyu","ヒュ","ﾋｭ","ひゅ"},{"hyo","ヒョ","ﾋｮ","ひょ"}, {"mya","ミャ","ﾐｬ","みゃ"},{"myu","ミュ","ﾐｭ","みゅ"},{"myo","ミョ","ﾐｮ","みょ"}, {"rya","リャ","ﾘｬ","りゃ"},{"ryu","リュ","ﾘｭ","りゅ"},{"ryo","リョ","ﾘｮ","りょ"}, {"gya","ギャ","ｷﾞｬ","ざゃ"},{"gyu","ギュ","ｷﾞｭ","ざゅ"},{"gyo","ギョ","ｷﾞｮ","ざょ"}, {"ja","ジャ","ｼﾞｬ","じゃ"},{"ju","ジュ","ｼﾞｭ","じゅ"},{"jo","ジョ","ｼﾞｮ","じょ"}, {"dja","ヂャ","ﾁﾞｬ","ぢゃ"},{"dju","ヂュ","ﾁﾞｭ","ぢゅ"},{"djo","ヂョ","ﾁﾞｮ","ぢょ"}, {"bya","ビャ","ﾋﾞｬ","びゃ"},{"byu","ビュ","ﾋﾞｭ","びゅ"},{"byo","ビョ","ﾋﾞｮ","びょ"}, {"pya","ピャ","ﾋﾟｬ","ぴゃ"},{"pyu","ピュ","ﾋﾟｭ","ぴゅ"},{"pyo","ピョ","ﾋﾟｮ","ぴょ"}, {"fa","ファ","ﾌｧ","ふぁ"},{"fi","フィ","ﾌｨ","ふぃ"},{"fe","フェ","ﾌｪ","ふぇ"},{"fo","フォ","ﾌｫ","ふぉ"}, {"di","ディ","ﾃﾞｨ","でぃ"},{"du","デゥ","ﾃﾞｩ","でぅ"},{"ti","ティ","ﾃｨ","てぃ"},{"tu","テゥ","ﾃｩ","てぅ"}

};

//String ひらがなヽカタカナ;

static public String ひらがなヽカタカナヽスル(String ひらがなヽモジレツ){ String カタカナヽモジレツ =""; String 文字; String モジ; char もじ; HIRAGANA_KATAKANA セイド = new HIRAGANA_KATAKANA; int カナハイレツヽナガサ_長サ = セイド.カナヽハイレツ.length; HashMap  ひらがなヽ片仮名ヽハッシュマップ = new HashMap  ; for (int i = 0; i<セイド.カナヽハイレツ.length; i++){ ひらがなヽ片仮名ヽハッシュマップ.put(セイド.カナヽハイレツ[i][3],セイド.カナヽハイレツ[i][1]); }

for (int i=0;i<ひらがなヽモジレツ.length;i++) { もじ=ひらがなヽモジレツ.charAt(i); 文字 = "" + もじ;

long モジコード = (long) もじ; if (モジコード >= 12353) if(モジコード <=12447){

モジ = ひらがなヽ片仮名ヽハッシュマップ.get(文字);

カタカナヽモジレツ = カタカナヽモジレツ + モジ;} if(モジコード < 12353){カタカナヽモジレツ = カタカナヽモジレツ + もじ;} if(モジコード > 12447){カタカナヽモジレツ = カタカナヽモジレツ + もじ;}

}

return カタカナヽモジレツ; }

public static void main(String[] args) {

String カタカナヽアウトライン = "" ; while (true){ String ひらがなインライン = "" ; カタカナヽアウトライン = "" ; JOptionPane オプション枠 = new JOptionPane; while(true) {

//オプション枠.setInitialValue(カタカナヽアウトライン);

ひらがなインライン=オプション枠.showInputDialog("ひらがなヽカタカナ : ");

カタカナヽアウトライン=ひらがなヽカタカナヽスル(ひらがなインライン); //オプション枠.setFont(new Font ( "MS Gothic",Font.PLAIN,45)); //オプション枠.setSize(300, 500);

if (ひらがなインライン == null ) System.out.println("ロマージ インプット ジャアリマセン"); else { System.out.println("ひらがなインライン : " + ひらがなインライン );} break;

}

System.out.println("カタカナヽアウトライン : " + カタカナヽアウトライン );

Toolkit ツールキット = Toolkit.getDefaultToolkit; Clipboard クリップボード = ツールキット.getSystemClipboard; StringSelection セレクトヽモジレツ = new StringSelection(カタカナヽアウトライン); クリップボード.setContents(セレクトヽモジレツ, null);

オプション枠.showMessageDialog(null, カタカナヽアウトライン);

}

} // while end }

=
===

=
=========== KAMI_RAIN_2

=
===========

=
=============== CHECK ALL BELOW

=
=========== import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.awt.image.*; //ボタン import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.GradientPaint; import java.awt.Graphics ; import java.awt.Graphics2D;

class キャンバス extends Canvas { public String カナガ = "カナ"; public キャンバス {} public void paint(Graphics ガ) { //ガ. ガ.setColor(Color.yellow); // バック ガ.fillRect(0, 0, 180, 180); // バック ガ.setFont(new Font ( "MS Gothic",Font.PLAIN,81)); ガ.setColor(Color.red ); ガ.drawString(カナガ, 0 , 90 ); } }

class ボタン extends JButton { private String ナヾ名; public ボタン(String レツヾ列){ super(レツヾ列); this.ナヾ名=レツヾ列; } public void paintComponents(Graphics グ) { Graphics2D グ2ディ = (Graphics2D) グ; GradientPaint ペイント = new GradientPaint(0, 0, Color.BLUE ,0, 20, Color.CYAN, true); グ2ディ.setPaint(ペイント); グ2ディ.fillRect(0, 0, this.getWidth, this.getHeight); グ2ディ.setColor(Color.WHITE); グ2ディ.drawString(this.ナヾ名, this.getWidth/2 -(this.getWidth/2/4), (this.getHeight/2)+5); } }

public class SEIDO { String[][] カナヽハイレツ = { {"a","ア","ｱ","あ"},{"i","イ","ｲ","い"},{"u","ウ","ｳ","う"},{"e","エ","ｴ","え"},{"o","オ","ｵ","お"}, {"ka","カ","ｶ","か"},{"ki","キ","ｷ","き"},{"ku","ク","ｸ","く"},{"ke","ケ","ｹ","け"},{"ko","コ","ｺ","こ"}, {"ga","ガ","ｶﾞ","が"},{"gi","ギ","ｷﾞ","ぎ"},{"gu","グ","ｸﾞ","ぐ"},{"ge","ゲ","ｹﾞ","げ"},{"go","ゴ","ｺﾞ","ご"}, {"sa","サ","ｻ","さ"},{"shi","シ","ｼ","し"},{"su","ス","ｽ","す"},{"se","セ","ｾ","せ"},{"so","ソ","ｿ","そ"}, {"za","ザ","ｻﾞ","ざ"},{"ji","ジ","ｼﾞ","じ"},{"zu","ズ","ｽﾞ","ず"},{"ze","ゼ","ｾﾞ","ぜ"},{"zo","ゾ","ｿﾞ","ぞ"}, {"ta","タ","ﾀ","た"},{"chi","チ","ﾁ","ち"},{"tsu","ツ","ﾂ","つ"},{"te","テ","ﾃ","て"},{"to","ト","ﾄ","と"}, {"da","ダ","ﾀﾞ","だ"},{"dzi","ヂ","ﾁﾞ","ぢ"},{"dzu","ヅ","ﾂﾞ","づ"},{"de","デ","ﾃﾞ","で"},{"do","ド","ﾄﾞ","ど"}, {"na","ナ","ﾅ","な"},{"ni","ニ","ﾆ","に"},{"nu","ヌ","ﾇ","ぬ"},{"ne","ネ","ﾈ","ね"},{"no","ノ","ﾉ","の"}, {"ha","ハ","ﾊ","は"},{"hi","ヒ","ﾋ","ひ"},{"fu","フ","ﾌ","ふ"},{"he","ヘ","ﾍ","へ"},{"ho","ホ","ﾎ","ほ"}, {"ba","バ","ﾊﾞ","ば"},{"bi","ビ","ﾋﾞ","び"},{"bu","ブ","ﾌﾞ","ぶ"},{"be","ベ","ﾍﾞ","べ"},{"bo","ボ","ﾎﾞ","ぼ"}, {"pa","パ","ﾊﾟ","ぱ"},{"pi","ピ","ﾋﾟ","ぴ"},{"pu","プ","ﾌﾟ","ぷ"},{"pe","ペ","ﾍﾟ","ぺ"},{"po","ポ","ﾎﾟ","ぽ"}, {"ma","マ","ﾏ","ま"},{"mi","ミ","ﾐ","み"},{"mu","ム","ﾑ","む"},{"me","メ","ﾒ","め"},{"mo","モ","ﾓ","も"}, {"ya","ヤ","ﾔ","や"},{"yu","ユ","ﾕ","ゆ"},{"yo","ヨ","ﾖ","よ"}, {"ra","ラ","ﾗ","ら"},{"ri","リ","ﾘ","り"},{"ru","ル","ﾙ","る"},{"re","レ","ﾚ","れ"},{"ro","ロ","ﾛ","ろ"}, {"wa","ワ","ﾜ","わ"},{"wi","ヰ"," ","ゐ"},{"wu","ㄊ","ﾑﾟﾞ"," "},{"we","ヱ"," ","ゑ"},{"wo","ヲ","ｦ","を"}, {"n","ヽ","ﾝﾟ","ゝ"},{"nn","ン","ﾝ","ん"},{"nnn","ヾ","ﾝﾞ","ゞ"}, {"_a","ァ","ｧ","ぁ"},{"_i","ィ","ｨ","ぃ"},{"_u","ゥ","ｩ","ぅ"},{"_e","ェ","ｪ","ぇ"},{"_o","ォ","ｫ","ぉ"}, {"_ya","ャ","ｬ","ゃ"},{"_yu","ュ","ｭ","ゅ"},{"_yo","ョ","ｮ","ょ"}, {"_tsu","ッ","ｯ","っ"}, {"koto","ヿ"," "," "},{"yori"," "," ","ゟ"},{"_vi","ヸ"," "," "},{"vi","ヴィ"," "," "}, {"va","ヴァ"," "," "},{"_va","ヷ"," "," "}, {"vo","ヴォ"," "," "},{"_vo","ヺ"," "," "},{"_wa","ヮ"," ","ゎ"}, {"_ka","ヵ"," ","ゕ"},{"_ke","ヶ"," ","ゖ"},{"_ge"," "," ","ゖ゙"}, {"vu","ヴ"," "," "}, {"kya","キャ","ｷｬ","きゃ"},{"kyu","キュ","ｷｭ","きゅ"},{"kyo","キョ","ｷｮ","きょ"}, {"sha","シャ","ｼｬ","しゃ"},{"shu","シュ","ｼｭ","しゅ"},{"sho","ショ","ｼｮ","しょ"}, {"cha","チャ","ﾁｬ","ちゃ"},{"chu","チュ","ﾁｭ","ちゅ"},{"cho","チョ","ﾁｮ","ちょ"}, {"nya","ニャ","ﾆｬ","にゃ"},{"nyu","ニュ","ﾆｭ","にゅ"},{"nyo","ニョ","ﾆｮ","にょ"}, {"hya","ヒャ","ﾋｬ","ひゃ"},{"hyu","ヒュ","ﾋｭ","ひゅ"},{"hyo","ヒョ","ﾋｮ","ひょ"}, {"mya","ミャ","ﾐｬ","みゃ"},{"myu","ミュ","ﾐｭ","みゅ"},{"myo","ミョ","ﾐｮ","みょ"}, {"rya","リャ","ﾘｬ","りゃ"},{"ryu","リュ","ﾘｭ","りゅ"},{"ryo","リョ","ﾘｮ","りょ"}, {"gya","ギャ","ｷﾞｬ","ざゃ"},{"gyu","ギュ","ｷﾞｭ","ざゅ"},{"gyo","ギョ","ｷﾞｮ","ざょ"}, {"ja","ジャ","ｼﾞｬ","じゃ"},{"ju","ジュ","ｼﾞｭ","じゅ"},{"jo","ジョ","ｼﾞｮ","じょ"}, {"dja","ヂャ","ﾁﾞｬ","ぢゃ"},{"dju","ヂュ","ﾁﾞｭ","ぢゅ"},{"djo","ヂョ","ﾁﾞｮ","ぢょ"}, {"bya","ビャ","ﾋﾞｬ","びゃ"},{"byu","ビュ","ﾋﾞｭ","びゅ"},{"byo","ビョ","ﾋﾞｮ","びょ"}, {"pya","ピャ","ﾋﾟｬ","ぴゃ"},{"pyu","ピュ","ﾋﾟｭ","ぴゅ"},{"pyo","ピョ","ﾋﾟｮ","ぴょ"}, {"fa","ファ","ﾌｧ","ふぁ"},{"fi","フィ","ﾌｨ","ふぃ"},{"fe","フェ","ﾌｪ","ふぇ"},{"fo","フォ","ﾌｫ","ふぉ"}, {"di","ディ","ﾃﾞｨ","でぃ"},{"du","デゥ","ﾃﾞｩ","でぅ"},{"ti","ティ","ﾃｨ","てぃ"},{"tu","テゥ","ﾃｩ","てぅ"}, {"--","ー"," "," "} };

public static void main(String[] args) { SEIDO セイド = new SEIDO; ボタン ボ = new ボタン("ボ"); int カナハイレツヽナガサ_長サ = セイド.カナヽハイレツ.length; Random ランダム = new Random; int ツウワヽ通話 = ランダム.nextInt(81); HashMap  ローマジヽ片仮名ヽハッシュマップ = new HashMap  ; HashMap  ローマジヽひらがなヽハッシュマップ = new HashMap  ; HashMap  ひらがなヽ片仮名ヽハッシュマップ = new HashMap  ; //ハンカクカタカナヽ半角カタカナ HashMap <String, String> ローマジヽ半角カタカナヽハンカクヽハッシュマップ = new HashMap <String , String> ; for (int i = 0; i<セイド.カナヽハイレツ.length; i++){ ローマジヽ片仮名ヽハッシュマップ.put(セイド.カナヽハイレツ[i][0],セイド.カナヽハイレツ[i][1]); ローマジヽひらがなヽハッシュマップ.put(セイド.カナヽハイレツ[i][0],セイド.カナヽハイレツ[i][3]); ひらがなヽ片仮名ヽハッシュマップ.put(セイド.カナヽハイレツ[i][3],セイド.カナヽハイレツ[i][1]); ローマジヽ半角カタカナヽハンカクヽハッシュマップ.put(セイド.カナヽハイレツ[i][0],セイド.カナヽハイレツ[i][2]); } キャンバス キャンバスワーク = new キャンバス ; JFrame マド = new JFrame; マド.setBounds(10, 10, 180, 180); マド.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); マド.getContentPane.add( キャンバスワーク ); マド.setVisible(true); if (ツウワヽ通話 % 2 == 0) {int インテジャ = ランダム.nextInt(カナハイレツヽナガサ_長サ); System.out.println(セイド.カナヽハイレツ[インテジャ][1]); キャンバスワーク .カナガ = セイド.カナヽハイレツ[インテジャ][1]; }	else if (ツウワヽ通話 % 3 == 0) {int インテジャ = ランダム.nextInt(カナハイレツヽナガサ_長サ); System.out.println(セイド.カナヽハイレツ[インテジャ][2]); キャンバスワーク .カナガ = セイド.カナヽハイレツ[インテジャ][2]; } 	else {System.exit(0);} } }

=
==

button削除

import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.awt.geom.*; public class sample{ JButton button; static JFrame frame =new JFrame("bbbbb"); public static void main(String s[]){ frame.setSize(300,300); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); sample a=new sample; } public sample{ button =new JButton("aaaaa"); frame.setLayout(new BorderLayout); frame.add(button,BorderLayout.CENTER); button.addActionListener(new ActionListener{   public void actionPerformed(ActionEvent ae){    frame.remove(button);frame.validate;    }}); frame.validate; } }

ボタンを押してボタンを消すことはできるんですが、ボタンにつけた名前の方がフレームに残ってしまうのですが何か良い解決法があったら教えてください.

=
===========

＞不良社員様

先日のお返しをさせていただけたようで嬉しいです. 間違いなく私の方が勉強させていただく量が多いですが…(･ω･｀;)

これ↓じゃだめ？

import java.awt.Dimension; import java.awt.Insets; import javax.swing.JButton; import javax.swing.JFrame;

public class FrameTest extends JFrame{

private static final long serialVersionUID = 1L;

public static void main(String[] args){ FrameTest frame = new FrameTest; frame.setBounds(0, 0, 400, 400); JButton button = new JButton("ボタン"); frame.getContentPane.setLayout(null); button.setMargin(new Insets(5, 5, 5, 5)); button.setLocation(50, 50); //最適なサイズだけどレイアウトマネージャさんいないから見てくれないかも button.setPreferredSize(new Dimension(100,50)); //サイズ指定 button.setSize(100, 50); frame.getContentPane.add(button); frame.setVisible(true); } }

=
======

Bold text・"ボタン１"を表示 ・クリックで消去 まではできるのですが、"ボタン２"が表示されません.

import java.applet.*; import java.awt.*; import java.awt.event.*;

public class Bobo2 extends Applet implements ActionListener{ Button bt1,bt2;

public void init{ bt1 =new Button("ボタン１"); bt1.addActionListener(this); add(bt1); bt2 =new Button("ボタン２"); }

public void actionPerformed(ActionEvent e){ remove(bt1); add(bt2); } }

不良社員さんアドバイスありがとうございます.

=
==============================

Javaに関する様々な情報をご紹介します.

Java基本 Servlet・JSP オープンソース FAQ 掲示板 ニュース

Javaの道 掲示板 掲示板（JTextFieldに透かし文字を入れるには？）

評価 0

JTextFieldに透かし文字を入れるには？

JTextFieldに透かし文字を入れたいと思い、ネット検索でサンプルコードを見つけてコードを組み込んでみたのですが、現状ではJTextFieldに「大会名を入力してください」という文字は表示されるのですが透かし文字ではないですし、JTextField内にカーソルを置いてみても無反応な状態です. 基礎的なことで申し訳ありませんが、どうか教えて下さい. よろしくお願いします.

以下はコードです. public class RallyInfomationP extends JPanel { private JLabel jLabel1; private JTextField jTextField0 = new JTextField("大会名を入力してください"); public RallyInfomationP { initComponents; }

private void initComponents { setBorder(BorderFactory.createTitledBorder(new LineBorder(new Color(0,128,0), 2, true), "大会情報", TitledBorder.LEFT, TitledBorder.TOP, new Font("Dialog",               Font.BOLD, 16), new Color(0,128,0))); setLayout(new GroupLayout); add(getJTextField0, new Constraints(new Leading(60, 158, 12, 12), new Leading(5, 30, 12, 12))); add(getJLabel1, new Constraints(new Leading(7, 12, 12), new Leading(7, 12, 12)));

setSize(232, 198); }   //大会名のテキストフィールド private JTextField getJTextField0 { if (jTextField0 == null) { jTextField0 = new JTextField; jTextField0.setFont(new Font("Dialog", Font.PLAIN, 16)); jTextField0.setText(""); jTextField0.setForeground(Color.BLACK); //以下のコードがリスナー jTextField0.addFocusListener(new PlaceholderFocusListener(jTextField0)); }       return jTextField0; }

//大会名のラベル private JLabel getJLabel1 { if (jLabel1 == null) { jLabel1 = new JLabel; jLabel1.setFont(new Font("Dialog", Font.BOLD, 18)); jLabel1.setText("大会名"); }       return jLabel1; }

}

//---2012.09.21---透かし文字を入れるためのリスナー class PlaceholderFocusListener implements FocusListener { private static final Color INACTIVE = UIManager.getColor("TextField.inactiveForeground"); private final String hintMessage; public PlaceholderFocusListener(JTextComponent tf) { hintMessage = tf.getText; tf.setForeground(INACTIVE); }   @Override public void focusGained(FocusEvent e) { JTextComponent tf = (JTextComponent)e.getSource; if(hintMessage.equals(tf.getText) && INACTIVE.equals(tf.getForeground)) { tf.setForeground(UIManager.getColor("TextField.foreground")); tf.setText(""); }   }    @Override public void focusLost(FocusEvent e) { JTextComponent tf = (JTextComponent)e.getSource; if("".equals(tf.getText.trim)) { tf.setForeground(INACTIVE); tf.setText(hintMessage); }   } }

ｗｅｅａｒ 2012-09-22 12:03:54

6 回答

2200 閲覧

6件の回答 評価 0

丸投げせずに、まずは自力でデバッグする. 何を言ってるのか分からない、または言ってることは判るが 何をすればいいのか分からないというなら、 Swingはいったん脇へ置いて基礎から勉強し直す.

$ 2012-09-22 12:31:31評価 0

$さん、回答ありがとうございます. ブレークポイントを設置してデバッグしてみましたが原因が掴めません.

また、$さんにはいつも「基礎から勉強し直す」よう指摘されていますが基礎本を読んでいないわけではなく、常に机の脇に置き必要に応じて読み直したりもしていて独力で出来るよう努力しています.

習得が牛歩のごとく遅いのは認めますが、周囲に教えてもらえる方がいない環境での独学なのでこれが精一杯です.

今回の件は「PlaceholderFocusListener」をどこに記述するかが問題なような気がするんですが、どこをどう対処したらよいのかわからないんです.

ですから基礎のどこをやり直したら上記問題が解決するのかを教えて下さい.

ｗｅｅａｒ 2012-09-22 21:40:40評価 0

書かれたコードの１行１行がどういう意味か 理解していますか？という意味だと思います.

デバッガを使った開発というのは、 本来自分が意図した条件分岐や変数の中身などが 期待通りに動作しているかを確認するために使うのです.

ざっと見た感じ、コードの //以下のコードがリスナー jTextField0.addFocusListener(new　PlaceholderFocusListener(jTextField0));

はインスタンス変数「jTextField0」を宣言時に初期化しているため 実行時に通らなそうですが、ここにブレークポイントを仕掛けるとどうなりますか？

「このメソッドの呼び出しが発生すれば、こう動くはず」という考えがしっかりしていれば デバッガは有効なツールとなりますので、がんばってください.

匿名 2012-09-24 13:36:47評価 0

匿名さん、回答ありがとうございます.

その後以下の行にブレークポイントを置いてデバッグを行ったんですが、 jTextField0.addFocusListener(new　PlaceholderFocusListener(jTextField0));

「ソースが見つかりません. 」と出てその下に「ソース・ルックアップの編集」ボタンが出現します.

ネット検索で調べてみるとTomcat関係ばかりで解決方法を見つけることが出来ませんでした.

どう対処したら良いのでしょうか？ お知らせください.

ｗｅｅａｒ 2012-09-25 11:45:17評価 0

どうも、先日の匿名です. Eclipseのトラブルは環境や設定等々、色々な原因があるので 正直回答しようがありません. 試すこととしては、

・プロジェクトを右クリックして「リフレッシュ」してみる ・ソースフォルダ設定が正しいかどうか確認する ・実行クラスパス上に同一パッケージ同一クラスが複数存在しないか確認する ・Javaビルドパス設定に不要なプロジェクトが無いか確認する

とかでしょうか. あとは、 $さんへの回答で「デバッグを試してみた」旨が書かれてるので、 そのブレークポイントからステップ実行させてみるとか

匿名 2012-09-25 12:08:46評価 0

遅くなりましたが解決しました.

以下のPlaceholderFocusListenerをクラス内クラスとし、

private static final Color INACTIVE = UIManager.getColor("TextField.inactiveForeground");を

private Color INACTIVE = Color.LIGHT_GRAY;

と変更することで解決しました.

回答して下さった皆さん、ありがとうございました.

以下が改変したコードです. public class PlaceholderFocusListener implements FocusListener{ private Color INACTIVE = Color.LIGHT_GRAY;

private final String hintMessage; public PlaceholderFocusListener(JTextComponent tf) { hintMessage = tf.getText; tf.setForeground(INACTIVE); }   @Override public void focusGained(FocusEvent e) { JTextComponent tf = (JTextComponent)e.getSource; if(hintMessage.equals(tf.getText) && INACTIVE.equals(tf.getForeground)) { tf.setForeground(UIManager.getColor("TextField.foreground")); tf.setText(""); }   }    @Override public void focusLost(FocusEvent e) { JTextComponent tf = (JTextComponent)e.getSource; if("".equals(tf.getText.trim)) { tf.setForeground(INACTIVE); tf.setText(hintMessage); }   } }

ｗｅｅａｒ 2012-09-25 21:30:51 質問から6ヶ月以上経過しているので、回答を書き込むことはできません.

質問一覧にもどる

Java基本 Servlet・JSP オープンソース FAQ 掲示板 ニュース

©2008-2015 Javaの道

=
=============

public class TESUTO { JLabel RABERU = new JLabel("OMIGOTO!");

JFrame UINDOU = new JFrame("IS IT TITLE?"); UINDOU.setSize(300,300); UINDOU.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); UINDOU.setVisible(true); UINDOU.setLocationRelativeTo(null); UINDOU;.toFront(true);

}

=
====================================================== import java.awt.Graphics; import java.awt.Image; import java.io.File; import javax.imageio.ImageIO; import javax.swing.JPanel;

public class PANERU extends JPanel { public void paintComponent(Graphics GU){ try { Image IMEJI = ImageIO.read(new File("imeji.jpg")); GU.drawImage(IMEJI,0,0,this); // GU.drawImage(IMEJI,0,0,this.getWidth,this.getHeight,this); }       catch(IOException ERAA) { ERAA.printStackTrace; }   }

}

=
========================================================

import java.text.SimpleDateFormat; import java.util.*; import java.awt.*; import java.awt.event.*;

import javax.imageio.ImageIO; import javax.swing.*;

import java.awt.image.*; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; //import java.io.BufferedReader; //import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException;

//http://www.mkyong.com/java/how-to-read-utf-8-encoded-data-from-a-file-java/

class キャンバス  extends Canvas {

public キャンバス  { }

public void paint(Graphics ガ) {

ガ.setColor(Color.yellow); ガ.fillRect(0, 0, 1800, 500); ガ.setColor(Color.red);

if (KAMI_RAIN.カタカナトカンジ){ ガ.setFont(new Font ( "SERIF",Font.PLAIN,60)); ガ.drawString(KAMI_RAIN.カミヽラインヽカタカナ+"ヾ"+KAMI_RAIN.カミヽラインヽカンジ, 0 , 60  ); ガ.setFont(new Font ( "SERIF",Font.PLAIN,30)); ガ.drawString(KAMI_RAIN.カミヽラインヽローマジ, 0 , 120  ); }		else { ガ.setFont(new Font ( "SERIF",Font.PLAIN,60)); ガ.drawString(KAMI_RAIN.カミヽラインヽカタカナ, 0, 60 ); ガ.setFont(new Font ( "SERIF",Font.PLAIN,30)); ガ.drawString(KAMI_RAIN.カミヽラインヽローマジ, 0 , 120  );} } }

public class KAMI_RAIN { static String モジレツ = ""; static ArrayList モジレツヽリスト = new ArrayList ; static String ロマージインライン ; static String ヒョウジヽライン; static String パス = ""; static String ニチヾ日, ジヾ時 = "" ; static String コメントヽファイル = パス + ジヾ時 ; static String コメントヽファイルヽテスト = パス + ニチヾ日 +".txt"; static String ラインヽアウト ; static String ニチヽ日, ジヽ時 ; static String カミヽライン = ""; static String カミヽラインヽカンジ = ""; static String カミヽラインヽカタカナ = ""; static String カミヽラインヽローマジ = ""; static boolean カタカナトカンジ = false;

static String[][] カナヽハイレツ = { {"a","ア","ｱ","あ"},{"i","イ","ｲ","い"},{"u","ウ","ｳ","う"},{"e","エ","ｴ","え"},{"o","オ","ｵ","お"}, {"ka","カ","ｶ","か"},{"ki","キ","ｷ","き"},{"ku","ク","ｸ","く"},{"ke","ケ","ｹ","け"},{"ko","コ","ｺ","こ"}, {"ga","ガ","ｶﾞ","が"},{"gi","ギ","ｷﾞ","ぎ"},{"gu","グ","ｸﾞ","ぐ"},{"ge","ゲ","ｹﾞ","げ"},{"go","ゴ","ｺﾞ","ご"}, {"sa","サ","ｻ","さ"},{"shi","シ","ｼ","し"},{"su","ス","ｽ","す"},{"se","セ","ｾ","せ"},{"so","ソ","ｿ","そ"}, {"za","ザ","ｻﾞ","ざ"},{"ji","ジ","ｼﾞ","じ"},{"zu","ズ","ｽﾞ","ず"},{"ze","ゼ","ｾﾞ","ぜ"},{"zo","ゾ","ｿﾞ","ぞ"}, {"ta","タ","ﾀ","た"},{"chi","チ","ﾁ","ち"},{"tsu","ツ","ﾂ","つ"},{"te","テ","ﾃ","て"},{"to","ト","ﾄ","と"}, {"da","ダ","ﾀﾞ","だ"},{"dzi","ヂ","ﾁﾞ","ぢ"},{"dzu","ヅ","ﾂﾞ","づ"},{"de","デ","ﾃﾞ","で"},{"do","ド","ﾄﾞ","ど"}, {"na","ナ","ﾅ","な"},{"ni","ニ","ﾆ","に"},{"nu","ヌ","ﾇ","ぬ"},{"ne","ネ","ﾈ","ね"},{"no","ノ","ﾉ","の"}, {"ha","ハ","ﾊ","は"},{"hi","ヒ","ﾋ","ひ"},{"fu","フ","ﾌ","ふ"},{"he","ヘ","ﾍ","へ"},{"ho","ホ","ﾎ","ほ"}, {"ba","バ","ﾊﾞ","ば"},{"bi","ビ","ﾋﾞ","び"},{"bu","ブ","ﾌﾞ","ぶ"},{"be","ベ","ﾍﾞ","べ"},{"bo","ボ","ﾎﾞ","ぼ"}, {"pa","パ","ﾊﾟ","ぱ"},{"pi","ピ","ﾋﾟ","ぴ"},{"pu","プ","ﾌﾟ","ぷ"},{"pe","ペ","ﾍﾟ","ぺ"},{"po","ポ","ﾎﾟ","ぽ"}, {"ma","マ","ﾏ","ま"},{"mi","ミ","ﾐ","み"},{"mu","ム","ﾑ","む"},{"me","メ","ﾒ","め"},{"mo","モ","ﾓ","も"}, {"ya","ヤ","ﾔ","や"},{"yu","ユ","ﾕ","ゆ"},{"yo","ヨ","ﾖ","よ"}, {"ra","ラ","ﾗ","ら"},{"ri","リ","ﾘ","り"},{"ru","ル","ﾙ","る"},{"re","レ","ﾚ","れ"},{"ro","ロ","ﾛ","ろ"}, {"wa","ワ","ﾜ","わ"},{"wi","ヰ"," ","ゐ"},{"wu","ㄊ","ﾑﾟﾞ"," "},{"we","ヱ"," ","ゑ"},{"wo","ヲ","ｦ","を"}, {"n","ヽ","ﾝﾟ","ゝ"},{"nn","ン","ﾝ","ん"},{"nnn","ヾ","ﾝﾞ","ゞ"}, {"_a","ァ","ｧ","ぁ"},{"_i","ィ","ｨ","ぃ"},{"_u","ゥ","ｩ","ぅ"},{"_e","ェ","ｪ","ぇ"},{"_o","ォ","ｫ","ぉ"}, {"_ya","ャ","ｬ","ゃ"},{"_yu","ュ","ｭ","ゅ"},{"_yo","ョ","ｮ","ょ"}, {"_tsu","ッ","ｯ","っ"}, {"koto","ヿ"," "," "},{"yori"," "," ","ゟ"},{"_vi","ヸ"," "," "},{"vi","ヴィ"," "," "}, {"va","ヴァ"," "," "},{"_va","ヷ"," "," "}, {"vo","ヴォ"," "," "},{"_vo","ヺ"," "," "},{"_wa","ヮ"," ","ゎ"},{"_ka","ヵ"," ","ゕ"},{"_ke","ヶ"," ","ゖ"},{"_ge"," "," ","ゖ゙"}, {"vu","ヴ"," "," "}, {"kya","キャ","ｷｬ","きゃ"},{"kyu","キュ","ｷｭ","きゅ"},{"kyo","キョ","ｷｮ","きょ"}, {"sha","シャ","ｼｬ","しゃ"},{"shu","シュ","ｼｭ","しゅ"},{"sho","ショ","ｼｮ","しょ"}, {"cha","チャ","ﾁｬ","ちゃ"},{"chu","チュ","ﾁｭ","ちゅ"},{"cho","チョ","ﾁｮ","ちょ"}, {"nya","ニャ","ﾆｬ","にゃ"},{"nyu","ニュ","ﾆｭ","にゅ"},{"nyo","ニョ","ﾆｮ","にょ"}, {"hya","ヒャ","ﾋｬ","ひゃ"},{"hyu","ヒュ","ﾋｭ","ひゅ"},{"hyo","ヒョ","ﾋｮ","ひょ"}, {"mya","ミャ","ﾐｬ","みゃ"},{"myu","ミュ","ﾐｭ","みゅ"},{"myo","ミョ","ﾐｮ","みょ"}, {"rya","リャ","ﾘｬ","りゃ"},{"ryu","リュ","ﾘｭ","りゅ"},{"ryo","リョ","ﾘｮ","りょ"}, {"gya","ギャ","ｷﾞｬ","ざゃ"},{"gyu","ギュ","ｷﾞｭ","ざゅ"},{"gyo","ギョ","ｷﾞｮ","ざょ"}, {"ja","ジャ","ｼﾞｬ","じゃ"},{"ju","ジュ","ｼﾞｭ","じゅ"},{"jo","ジョ","ｼﾞｮ","じょ"}, {"dja","ヂャ","ﾁﾞｬ","ぢゃ"},{"dju","ヂュ","ﾁﾞｭ","ぢゅ"},{"djo","ヂョ","ﾁﾞｮ","ぢょ"}, {"bya","ビャ","ﾋﾞｬ","びゃ"},{"byu","ビュ","ﾋﾞｭ","びゅ"},{"byo","ビョ","ﾋﾞｮ","びょ"}, {"pya","ピャ","ﾋﾟｬ","ぴゃ"},{"pyu","ピュ","ﾋﾟｭ","ぴゅ"},{"pyo","ピョ","ﾋﾟｮ","ぴょ"}, {"fa","ファ","ﾌｧ","ふぁ"},{"fi","フィ","ﾌｨ","ふぃ"},{"fe","フェ","ﾌｪ","ふぇ"},{"fo","フォ","ﾌｫ","ふぉ"}, {"di","ディ","ﾃﾞｨ","でぃ"},{"du","デゥ","ﾃﾞｩ","でぅ"},{"ti","ティ","ﾃｨ","てぃ"},{"tu","テゥ","ﾃｩ","てぅ"}, {"--","ー"," "," "}

};

static public void モジレツヽリストヽスル{ final BufferedImage イメジ = new BufferedImage(180, 180, 1); Graphics ガ = イメジ.getGraphics; if(カミヽラインヽカンジ == ""){ヒョウジヽライン = カミヽラインヽカタカナ + カミヽラインヽローマジ;} else{ヒョウジヽライン = カミヽラインヽカタカナ + "ヾ" + カミヽラインヽカンジ + カミヽラインヽローマジ ;}

ガ.setFont(new Font (Font.SANS_SERIF,Font.PLAIN,45)); FontMetrics フォント配置量 = ガ.getFontMetrics; Character モジ ; String モジレツヽブンガ = "", テスト = "";

int 最後ヽイイ = 0; String 最後ヽサブストリング; for (int イイ=0;イイ< ヒョウジヽライン.length;イイ++){ モジ = ヒョウジヽライン.charAt(イイ); テスト = モジレツヽブンガ + モジ;

if (フォント配置量.stringWidth(テスト) < 185){ モジレツヽブンガ = テスト;

}			else {モジレツヽリスト.add(モジレツヽブンガ); String 最後の部分文字列; 最後の部分文字列 = ヒョウジヽライン.substring(イイ); if (フォント配置量.stringWidth(最後の部分文字列) < 185){モジレツヽリスト.add(最後の部分文字列 ); break ;} モジレツヽブンガ = "" + モジ ; }

}

}	static public void ニチヾ日スル{ Date 新しい日付 = new Date; //(1)Dateオブジェクトを生成 SimpleDateFormat 日付表示形式テスト = new SimpleDateFormat("yy'Y_'MM'M_'dd'D'"); ニチヾ日 = 日付表示形式テスト.format(新しい日付); }	static public void ジヾ時スル{ Date 新しい日付 = new Date; //(1)Dateオブジェクトを生成 SimpleDateFormat 日付表示形式 = new SimpleDateFormat("hh'h'mm'm'ss's'"); ジヾ時 = 日付表示形式.format(新しい日付); }	static public void パスヽスル{ ニチヾ日スル; ジヾ時スル; String ディレクトリ ="/TENPURETO"; File ファイル1 = new File(ディレクトリ);

if (ファイル1.exists){ パス = ディレクトリ + "/" + ニチヾ日 +"/"; File ファイル2 = new File(パス ); ファイル2.mkdirs; }		else { パス="./" + ニチヾ日 +"/"; File ファイル2 = new File(パス); ファイル2.mkdirs; }

}

static public String カミヽラインスル{ String ファイルヽニホンゴ ="/NIHONGO/edict2u" ;

File ファイル = new File(ファイルヽニホンゴ); if (!ファイル.exists){ファイルヽニホンゴ = "./edict2u";}

String カミヽライン = ""; Random ランダム = new Random; int インテジャ = ランダム.nextInt(173334);

try { BufferedReader 辞書ファイル = new BufferedReader(				new InputStreamReader( new FileInputStream(ファイルヽニホンゴ),"UTF8"));

カミヽライン = 辞書ファイル.readLine;

for (int ナ=0; ナ < インテジャ ; ナ++){ カミヽライン = 辞書ファイル.readLine; }

カミヽライン = 辞書ファイル.readLine; 辞書ファイル.close; } catch (IOException エラー) { System.out.println("ファイルヽヨムヽエラー");} カミヽライン= カミヽライン.replaceAll("/EntL.*", ""); カミヽライン= カミヽライン.replaceAll(";", "ヿ"); カミヽライン=KAMI_RAIN.ひらがなヽカタカナヽスル(カミヽライン); System.out.println(カミヽライン); return カミヽライン; }

static public String ひらがなヽカタカナヽスル(String ひらがなヽモジレツ){ String カタカナヽモジレツ =""; String 文字; String モジ; char もじ; KAMI_RAIN セイド = new KAMI_RAIN; int カナハイレツヽナガサ_長サ = セイド.カナヽハイレツ.length; HashMap <String, String> ひらがなヽ片仮名ヽハッシュマップ = new HashMap <String , String> ; for (int i = 0; i<セイド.カナヽハイレツ.length; i++){ ひらがなヽ片仮名ヽハッシュマップ.put(セイド.カナヽハイレツ[i][3],セイド.カナヽハイレツ[i][1]); }

for (int i=0;i<ひらがなヽモジレツ.length;i++) { もじ=ひらがなヽモジレツ.charAt(i); 文字 = "" + もじ;

long モジコード = (long) もじ; if (モジコード >= 12353) if(モジコード <=12447){

モジ = ひらがなヽ片仮名ヽハッシュマップ.get(文字);

カタカナヽモジレツ = カタカナヽモジレツ + モジ;} if(モジコード < 12353){カタカナヽモジレツ = カタカナヽモジレツ + もじ;} if(モジコード > 12447){カタカナヽモジレツ = カタカナヽモジレツ + もじ;}

}

return カタカナヽモジレツ; }

static void カミヽラインヽブンカツヽスル(String カミヽライン){ String[] モジレツ_1={} ,モジレツ_2={} ; if (カミヽライン.contains("[")){ カタカナトカンジ= true; String 分裂_1 = "\\["; String 分裂_2 = "\\]"; モジレツ_1 = カミヽライン.split(分裂_1); //カミヽラインヽカンジ,カミヽラインヽカタカナ,カミヽラインヽローマジ; カミヽラインヽカンジ = モジレツ_1[0].trim; System.out.println("カンジ : " +カミヽラインヽカンジ ); モジレツ_2 = モジレツ_1[1].split(分裂_2); カミヽラインヽカタカナ = モジレツ_2[0].trim; System.out.println("カタカナ  : " +カミヽラインヽカタカナ ); カミヽラインヽローマジ = モジレツ_2[1].trim; System.out.println("ローマジ   : " +カミヽラインヽローマジ ); }		else { String 分裂 = " /"; モジレツ_1 = カミヽライン.split(分裂); カミヽラインヽカタカナ = モジレツ_1[0].trim; System.out.println("カタカナ  : " +カミヽラインヽカタカナ ); カミヽラインヽローマジ = モジレツ_1[1].trim; System.out.println("ローマジ   : " +カミヽラインヽローマジ );

}

}	static public void ㄊヽデスヽスル(String ライン){ char イ = ライン.charAt(0); char イイ = ライン.charAt(1); char イイイ = ライン.charAt(2); long イヽモジコード = (long) イ; long イイヽモジコード = (long) イイ; long イイイヽモジコード = (long) イイイ;

if (イヽモジコード >= 19968) if (イイヽモジコード >= 19968) if (イイイヽモジコード >= 19968){ System.exit(0); }	}	static void サムネールヽスル{ try { int イメージヽニ = 180, イメージヽハ = 180; BufferedImage イメジヽバッファード = new BufferedImage(イメージヽニ, イメージヽハ, BufferedImage.TYPE_INT_RGB); Graphics2D グラフィックス = イメジヽバッファード.createGraphics; Font フォント = new Font (Font.SANS_SERIF,Font.PLAIN,45); グラフィックス.setFont(フォント); String メッセージ = ラインヽアウト;

グラフィックス.setColor(Color.yellow); グラフィックス.fillRect(0, 0, イメージヽニ, イメージヽハ); グラフィックス.setPaint(Color.BLUE);

//

String エガクヽモジレツ = ""; String イメージヽファイル = ""; int インデックス = 0; int ナヽカイ = 0; int ナヽカイヽモジュロ = モジレツヽリスト.size%6; if (ナヽカイヽモジュロ > 0){ ナヽカイ = (モジレツヽリスト.size/4)+1;} else {ナヽカイ = モジレツヽリスト.size/4 ;} for (int ナ= 0;ナ<ナヽカイ;ナ++) { int サムネールヽハ = 40; try { for (int イ= 0;イ<4;イ++) {

エガクヽモジレツ = (String) モジレツヽリスト.get(0);

モジレツヽリスト.remove(0); //System.out.println("This will draw : " + エガクヽモジレツ);

グラフィックス.drawString(エガクヽモジレツ, 0 ,サムネールヽハ ); サムネールヽハ += 45;

}		     } catch (Exception エラー){};

if (ナ<10){イメージヽファイル = パス +ジヾ時 +"_"+"00"+ナ+".JPG";} if (ナ>9) if(ナ<100){イメージヽファイル = パス +ジヾ時 +"_"+"0"+ナ+".JPG";} if (ナ>99){ イメージヽファイル = パス +ジヾ時 +"_"+ナ+".JPG";}

ImageIO.write(イメジヽバッファード,"jpg", new File(イメージヽファイル)); グラフィックス.setColor(Color.yellow); グラフィックス.fillRect(0, 0, イメージヽニ, イメージヽハ); グラフィックス.setPaint(Color.BLUE);

}

} catch (IOException エラー) { エラー.printStackTrace; }

}

static public void コメントヽスル{ final String コメントヽファイル ="/TENPURETO/"+ニチヾ日 +"/"+ニチヾ日 +".txt";

try { File ファイルヽイン = new File(コメントヽファイル); if (ファイルヽイン.exists){ BufferedReader イン = new BufferedReader(						new InputStreamReader( new FileInputStream(ファイルヽイン), "UTF8"));

String モジレ ;

while ((モジレ = イン.readLine) != null) { モジレツ = モジレツ + モジレ;

}

イン.close; }			}		   catch (UnsupportedEncodingException e)		    { System.out.println(e.getMessage); }		   catch (IOException e)		    { System.out.println(e.getMessage); }		   catch (Exception e)		    { System.out.println(e.getMessage); }

ロマージインライン = JOptionPane.showInputDialog("コメント : ");

try{

Writer 出力 = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(コメントヽファイル), "UTF8"));

出力.append(モジレツ + ヒョウジヽライン +"//"+ロマージインライン + "///").append('\n'); 出力.flush; 出力.close;

} catch(IOException エラー){}

System.out.println(ロマージインライン ); }	public static void main(String[] args) { カミヽライン=カミヽラインスル; ㄊヽデスヽスル(カミヽライン); カミヽラインヽブンカツヽスル(カミヽライン); パスヽスル; モジレツヽリストヽスル; サムネールヽスル;

キャンバス  キャンバスワーク  = new  キャンバス ;

JFrame マド = new JFrame; マド.setBounds(10, 10, 1800, 200); マド.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); マド.getContentPane.add( キャンバスワーク ); マド.setVisible(true);

コメントヽスル; }

}

=
======================================================