ページの先頭行へ戻る
Interstage Studio J Business Kit GUIライブラリ ユーザーズガイド
FUJITSU Software

D.1 補助文字を使用不可にする場合

JBKV5.1L10以降のGUIライブラリで、JBKV5.0L10と同じように補助文字を入力できなくするには、アプリケーションで以下のように実装してください。

  1. JFInputLimitationを生成します。

  2. JFInputLimitation#setEnableUnicodeType(Character.UnicodeBlock... enableUnicodeType)で補助文字以外の文字を入力可能にします。

  3. 入力可能文字種に含まれていない文字を入力不可能文字に指定します。

  4. 制御文字を入力不可能文字に指定します。

  5. 文字入力部品にJFInputLimitationを指定します。

実装例

JFFieldString field = new JFFieldString();

JFInputLimitation limit = new JFInputLimitation();

//補助文字以外の文字を全て入力可能に設定する
//サロゲートコード、補助文字以外の文字種を全て列挙します
limit.setEnableUnicodeType(
    UnicodeBlock.ALPHABETIC_PRESENTATION_FORMS,
    UnicodeBlock.ARABIC,
    UnicodeBlock.ARABIC_PRESENTATION_FORMS_A,
    UnicodeBlock.ARABIC_PRESENTATION_FORMS_B,
    UnicodeBlock.ARMENIAN,
    UnicodeBlock.ARROWS,
    UnicodeBlock.BASIC_LATIN,
    UnicodeBlock.BENGALI,
    UnicodeBlock.BLOCK_ELEMENTS,
    UnicodeBlock.BOPOMOFO,
    UnicodeBlock.BOPOMOFO_EXTENDED,
    UnicodeBlock.BOX_DRAWING,
    UnicodeBlock.BRAILLE_PATTERNS,
    UnicodeBlock.BUHID,
    UnicodeBlock.CHEROKEE,
    UnicodeBlock.CJK_COMPATIBILITY,
    UnicodeBlock.CJK_COMPATIBILITY_FORMS,
    UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS,
    UnicodeBlock.CJK_RADICALS_SUPPLEMENT,
    UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION,
    UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS,
    UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A,
    UnicodeBlock.COMBINING_DIACRITICAL_MARKS,
    UnicodeBlock.COMBINING_HALF_MARKS,
    UnicodeBlock.COMBINING_MARKS_FOR_SYMBOLS,
    UnicodeBlock.CONTROL_PICTURES,
    UnicodeBlock.CURRENCY_SYMBOLS,
    UnicodeBlock.CYRILLIC,
    UnicodeBlock.CYRILLIC_SUPPLEMENTARY,
    UnicodeBlock.DEVANAGARI,
    UnicodeBlock.DINGBATS,
    UnicodeBlock.ENCLOSED_ALPHANUMERICS,
    UnicodeBlock.ENCLOSED_CJK_LETTERS_AND_MONTHS,
    UnicodeBlock.ETHIOPIC,
    UnicodeBlock.GENERAL_PUNCTUATION,
    UnicodeBlock.GEOMETRIC_SHAPES,
    UnicodeBlock.GEORGIAN,
    UnicodeBlock.GREEK,
    UnicodeBlock.GREEK_EXTENDED,
    UnicodeBlock.GUJARATI,
    UnicodeBlock.GURMUKHI,
    UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS,
    UnicodeBlock.HANGUL_COMPATIBILITY_JAMO,
    UnicodeBlock.HANGUL_JAMO,
    UnicodeBlock.HANGUL_SYLLABLES,
    UnicodeBlock.HANUNOO,
    UnicodeBlock.HEBREW,
    UnicodeBlock.HIRAGANA,
    UnicodeBlock.IDEOGRAPHIC_DESCRIPTION_CHARACTERS,
    UnicodeBlock.IPA_EXTENSIONS,
    UnicodeBlock.KANBUN,
    UnicodeBlock.KANGXI_RADICALS,
    UnicodeBlock.KANNADA,
    UnicodeBlock.KATAKANA,
    UnicodeBlock.KATAKANA_PHONETIC_EXTENSIONS,
    UnicodeBlock.KHMER,
    UnicodeBlock.KHMER_SYMBOLS,
    UnicodeBlock.LAO,
    UnicodeBlock.LATIN_1_SUPPLEMENT,
    UnicodeBlock.LATIN_EXTENDED_A,
    UnicodeBlock.LATIN_EXTENDED_ADDITIONAL,
    UnicodeBlock.LATIN_EXTENDED_B,
    UnicodeBlock.LETTERLIKE_SYMBOLS,
    UnicodeBlock.LIMBU,
    UnicodeBlock.MALAYALAM,
    UnicodeBlock.MATHEMATICAL_OPERATORS,
    UnicodeBlock.MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A,
    UnicodeBlock.MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B,
    UnicodeBlock.MISCELLANEOUS_SYMBOLS,
    UnicodeBlock.MISCELLANEOUS_SYMBOLS_AND_ARROWS,
    UnicodeBlock.MISCELLANEOUS_TECHNICAL,
    UnicodeBlock.MONGOLIAN,
    UnicodeBlock.MYANMAR,
    UnicodeBlock.NUMBER_FORMS,
    UnicodeBlock.OGHAM,
    UnicodeBlock.OPTICAL_CHARACTER_RECOGNITION,
    UnicodeBlock.ORIYA,
    UnicodeBlock.PHONETIC_EXTENSIONS,
    UnicodeBlock.PRIVATE_USE_AREA,
    UnicodeBlock.RUNIC,
    UnicodeBlock.SINHALA,
    UnicodeBlock.SMALL_FORM_VARIANTS,
    UnicodeBlock.SPACING_MODIFIER_LETTERS,
    UnicodeBlock.SPECIALS,
    UnicodeBlock.SUPERSCRIPTS_AND_SUBSCRIPTS,
    UnicodeBlock.SUPPLEMENTAL_ARROWS_A,
    UnicodeBlock.SUPPLEMENTAL_ARROWS_B,
    UnicodeBlock.SUPPLEMENTAL_MATHEMATICAL_OPERATORS,
    UnicodeBlock.SYRIAC,
    UnicodeBlock.TAGALOG,
    UnicodeBlock.TAGBANWA,
    UnicodeBlock.TAI_LE,
    UnicodeBlock.TAMIL,
    UnicodeBlock.TELUGU,
    UnicodeBlock.THAANA,
    UnicodeBlock.THAI,
    UnicodeBlock.TIBETAN,
    UnicodeBlock.UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS,
    UnicodeBlock.VARIATION_SELECTORS,
    UnicodeBlock.YI_RADICALS,
    UnicodeBlock.YI_SYLLABLES,
    UnicodeBlock.YIJING_HEXAGRAM_SYMBOLS
);

//以下の文字種はサロゲートコードのため指定しません。
//UnicodeBlock.HIGH_PRIVATE_USE_SURROGATES,
//UnicodeBlock.HIGH_SURROGATES,
//UnicodeBlock.LOW_SURROGATES,

//以下の文字種はJIS2004の4バイトの補助文字であるため指定しません。
//UnicodeBlock.AEGEAN_NUMBERS,
//UnicodeBlock.BYZANTINE_MUSICAL_SYMBOLS,
//UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT, 
//UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B, 
//UnicodeBlock.CYPRIOT_SYLLABARY,     
//UnicodeBlock.DESERET,
//UnicodeBlock.GOTHIC,    
//UnicodeBlock.LINEAR_B_IDEOGRAMS,
//UnicodeBlock.LINEAR_B_SYLLABARY,
//UnicodeBlock.MATHEMATICAL_ALPHANUMERIC_SYMBOLS,
//UnicodeBlock.MUSICAL_SYMBOLS,    
//UnicodeBlock.OLD_ITALIC,    
//UnicodeBlock.OSMANYA,
//UnicodeBlock.SHAVIAN,    
//UnicodeBlock.SUPPLEMENTARY_PRIVATE_USE_AREA_A,
//UnicodeBlock.SUPPLEMENTARY_PRIVATE_USE_AREA_B,
//UnicodeBlock.TAGS,    
//UnicodeBlock.TAI_XUAN_JING_SYMBOLS,
//UnicodeBlock.UGARITIC,    
//UnicodeBlock.VARIATION_SELECTORS_SUPPLEMENT,


//入力可能文字種に含まれていない文字を入力不可にする。
//(0x0~0xffのUnicodeコード値の範囲に含まれる以下の文字種)
//・java.lang.Character.OTHER_SYMBOL
//・java.lang.Character.FORMAT
//・java.lang.Character.DIRECTIONALITY_SEGMENT_SEPARATOR
char[] disableChars = {'\u00a6','\u00a7','\u00a9','\u00ad','\u00ae',
                       '\u00b0','\u00b2','\u00b3','\u00b6','\u00b9',
                        '\u00bc','\u00bd','\u00be'};

limit.setDisableChars(disableChars);


//制御文字を入力不可にする
for(char i=0x0000; i<=0x001f; i++){
  limit.addDisableChar(i);
}
for(char i=0x007F; i<=0x009F; i++){
  limit.addDisableChar(i);
}
//JFInputLimitationを指定
field.setInputLimitation(limit);