public class L extends Object
swingの画面構成と属性付加を視認性の高いプログラムで
行うためのメソッド群です。
別途set系の呼び出しをスレッドセーフ
にするメソッドおよび定型作業を簡素化するメソッドを持つクラス
hiSwingも用意されています。
画面構造をプログラム構造で表します。
例えば
 
という構造の画面は次のプログラムで構築/表示できます。
import otsu.hiSwing.*; import javax.swing.*; import java.awt.event.*; public class Test implements ActionListener{ JFrame frame; JTextField tf; JProgressBar pb; JTextArea ta; int count; @Override // ActionListener public void actionPerformed(ActionEvent e_){ ta.append("ACTION:"+e_.getActionCommand()+" "+tf.getText()+"\n"); pb.setValue((++count%11)*10); // 0~100 } public static void main(final String[] args_){ SwingUtilities.invokeLater(()-<{start(args_);}); } static void start(String[] args_){ Test _this = new Test(); _this.frame = new JFrame(); L.set(this_.frame,"title:hiSwing基本試験","pack","visible","quit:終了しますか?", L.vPanel( //要素を縦に並べるパネル L.hPanel(L.size(400,22), // 要素を横に並べるパネル L.button("ボタン-1",L.size(100,20),_this), // ボタン(_thisはActionListenerとしてのTest) L.gap(10), // 固定長の隙間 _this.tf=L.textField(L.size(150,20)), // テキスト入力域 L.gap(), // 伸縮する隙間 L.button("ボタン-2"),_this), // ボタン(_thisはActionListenerとしてのTest) L.hPanel( // 要素を横に並べるパネル "進捗 : ", // 固定文字列 _this.pb=L.progressBar(L.size(250,23))), // 進捗バー L.scrollPanel(L.size(400,150), // スクロール領域 _this.ta=L.textArea(L.bgColor(0xFFFFEE)))));// 複数行のテキスト領域 } }
冒頭の4行
   public static void main(final String[] args_){
      SwingUtilities.invokeLater(()-<{start(args_);});
      }
   static void start(String[] args_){...
は安心のための定型文です。 Swingのスレッドポリシーまたは Swing's Threading Policy 参照
ボタンには通常ActionListenerが与えられ、例えばボタンイベントを拾う ActionListenerインスタンスがmyListenerなら、
    L.button("ボタン-1",L.size(100,20),myListener)
といった形となります。(ここでは_testがActionListenerです)
 L.button(),L.textField()などはそれぞれJButton,JTextField等のswing部品を戻しますので、後で使うなら
 それぞれの型の変数に代入することができます。
ここではボタンイベントを拾い、イベントのコマンド名とJTextFieldの値をJTextAreaに追加しています。
進捗を10ずつ進めています。
構造引数に置く画面要素はswing部品(JComponent)ですので、 Lクラスで用意されていない部品(JComponent)も構造の中でnewで与えることができます。
用意されているメソッドは全てstaticで、画面構造生成関数用と
JFrameの属性セット関数、2つに大きく分かれます。
値設定用のユーティリティメソッドがhiSwingクラスに
用意されています。
用意されていない要素や属性に関しては利用者が直接swingの機能を使って
書くことができます。
| 用途 | 区分 | 関数/型 | 
| 画面構造生成 | パネル L.tabPanel()以外はJPanelになる。L.tabPanel()はJTabbedPaneになる | L.panel() 要素を並べるL.vPanel() 要素を垂直に並べるL.hPanel() 要素を水平に並べるL.groupPanel() 要素を縦横揃えてに並べるL.cardPanel() 要素をカード重ねにするL.gridPanel() 要素を同サイズのマス目に並べるL.freePanel() 配置を自由に変えられる--- L.tabPanel() 要素をタブページ重ねにするL.scrollPanel() 要素をスクロール可能とする | 
| メニュー | L.menuBar() メニューバーL.menu() メニューL.menuItem() メニュー要素L.popupMenu() ポップアップメニュー | |
| 属性設定 | L.set(JComponent,...) 要素に属性を与える | |
| 属性 多くの属性は専用の関数で生成されるが 直接利用者が生成する属性もある。 | L.size() 要素のサイズL.bgColor() バックグラウンド色L.fgColor() 描画色L.color() Color(バックグラウンド色)L.monospace() 等幅フォントL.chooseFileR() 読込用ファイル選択L.chooseFileW() 書出用ファイル選択L.chooseDir() ディレクトリ選択L.drop() ドラッグ&ドロップ処理L.closing() 終了処理L.command() ActionEventのコマンド名L.type() コンテキストタイプL.name() cardPanel,tabPanel用の名前:要素セットL.column() カラム数L.row() 行数L.select() comboBoxの初期選択indexL.location() 親パネル内への配置位置L.max() 最大値L.min() 最小値L.logicalSize() 論理サイズ--- L.borderパネルのボーダーL.bgバックグラウンド色L.fg描画色L.opaque不透明属性--- ActionListenerイベント通知先AdjustmentListenerイベント通知先ComponentListenerイベント通知先ContainerListenerイベント通知先FocusListenerイベント通知先InputMethodListenerイベント通知先ItemListenerイベント通知先KeyListenerイベント通知先MouseListenerイベント通知先MouseMotionListenerイベント通知先MouseWheelListenerイベント通知先ListSelectionListenerイベント通知先ButtonGroupラジオボタンのグループ(hiButtonGroup推奨)BorderパネルのボーダーDimension要素のサイズColorバックグラウンド色FontフォントStringset関数では無視,構造式内では要素Booleanボタンの選択状態--- L.op() 引数式のみ実行、属性設定は行わないRunnable属性設定は行わず、run()のみ実行 | |
| 要素生成/属性設定 定義簡素化のため | L.button() JButtonL.radioButton() JRadioButtonL.checkBox() JCheckBoxL.comboBox() JComboBoxL.gap() 要素間に空白を入れるL.label() JLabelL.textField() JTextFieldL.textArea() JTextAreaL.textPane() JTextPaneL.editorPane() JEditorPaneL.htmlPane() JEditorPaneL.progressBar() JProgressBarL.separator() JSeparator--- L.listPanel() hiListPanelL.graphicPanel() hiGraphicPanel | |
| JFrame設定 | 要素/属性設定 | L.set(JFrame,...) JFrame設定 | 
| 要素/属性 | JMenuBarこのFrameにセットするメニューバーJComponentこのFrameのcontentPaneにセットする要素ActionListener開始イベントの通知先StringこのFrameにセットする属性"title:タイトル" タイトル "visible" 表示 "pack" 内部要素でサイズを定める "quit:メッセージ" 終了ボタン処理 | |
| 値設定など hiSwingクラス | 値設定 マルチスレッド動作で要求をinvokeする | hiSwing.setText() 文字列を設定するhiSwing.setValue() 整数値を与えるhiSwing.showCard() cardPanelの指定カードを表示するhiSwing.append() JTextAreaに文字列を追加するhiSwing.setMaximum() 進捗バーの最大値を設定するhiSwing.setMinimum() 進捗バーの最小値を設定するhiSwing.setType() コンテキストタイプを設定するhiSwing.setLineSpacing() 行間を設定するhiSwing.setLineSpacing() CSSを設定するhiSwing.setSize() サイズを設定するhiSwing.setBackground() バックグラウンド色を設定するhiSwing.setForeground() 描画色を設定するhiSwing.setColor() バックグラウンド色、描画色を設定するhiSwing.setSelectionBackground() 選択色を設定するhiSwing.setListData() リストをセットhiSwing.setItems() コンボボックスに項目をセットするhiSwing.setSelected() コンボボックスの指定項目を選択するhiSwing.setSelected() ボタンを選択状態にするhiSwing.clear() グラフィック消去hiSwing.repaint() グラフィック表示--- hiSwing.sync() 値設定完了を待つ | 
| ダイアログ他 | hiSwing.message() メッセージダイアログを出すhiSwing.confirm() 確認ダイアログを出すhiSwing.chooseFileR() 読込みファイル選択ダイアログを出すhiSwing.chooseFileW() 書出しファイル選択ダイアログを出すhiSwing.chooseDir() フォルダ選択ダイアログを出すhiSwing.confirm() 色名からColorを得る | 
バラバラの項目説明では把握しづらいため、幾つかの項目を統合した プログラムで機能説明します。
| 修飾子とタイプ | クラスと説明 | 
|---|---|
| static class  | L.align整列. | 
| static class  | L.bgバックグラウンド色属性 | 
| static class  | L.borderパネルのボーダー属性 | 
| static class  | L.ColorSet背景、前景、選択の各色. | 
| static interface  | L.DoIt | 
| static class  | L.editable編集可能フラグ | 
| static class  | L.fg描画色属性. | 
| static class  | L.image_sizegraphicPanelのイメージサイズ属性. | 
| static class  | L.lineWraptextAreaのLineWrap(行の折り返し)属性 | 
| static class  | L.opaque不透明属性. | 
| static class  | L.panelColor下位パネルの色の統一 | 
| static class  | L.sizeFix要素の縦横のfix属性 | 
| 修飾子とタイプ | フィールドと説明 | 
|---|---|
| static Font | default_font | 
| static boolean | do_not_use_invokeLater_for_JTextComponentJTextComponentの場合invokeLaterを使用しない | 
| static boolean | do_nothing_at_cast_error指定要素の型が適切でない場合何もしない. | 
| static boolean | do_nothing_at_null指定要素が無い場合何もしない. | 
| static L.sizeFix | fixB高さ幅とも固定にする | 
| static L.sizeFix | fixH高さを固定にする | 
| static L.sizeFix | fixL幅を固定にする | 
| static double | size_ratio | 
| 修飾子とタイプ | メソッドと説明 | 
|---|---|
| static otsu.hiSwing.L.hiBgColor | bg(Color col_)L.set()で用いるバックグラウンド色属性をColorから作成する. | 
| static otsu.hiSwing.L.hiBgColor | bg(int rgb_)L.set()で用いるバックグラウンド色属性をintにパックされたRGBから作成する. | 
| static otsu.hiSwing.L.hiBgColor | bg(String name_)L.set()で用いるバックグラウンド色属性を色名または色値文字列から作成する. | 
| static otsu.hiSwing.L.hiBgColor | bgColor(Color col_)L.set()で用いるバックグラウンド色属性をColorから作成する. | 
| static otsu.hiSwing.L.hiBgColor | bgColor(int rgb_)L.set()で用いるバックグラウンド色属性をintにパックされたRGBから作成する. | 
| static otsu.hiSwing.L.hiBgColor | bgColor(String name_)L.set()で用いるバックグラウンド色属性を色名または色値文字列から作成する. | 
| static L.ColorSet | bgFg(String bgAndFg_)背景と前景の色. | 
| static L.ColorSet | bgFg(String[] colors_)背景と前景と選択時の色. | 
| static L.ColorSet | bgFg(String background_,
    String foreground_)背景と前景の色. | 
| static L.ColorSet | bgFg(String background_,
    String foreground_,
    String selected_)背景と前景と選択時の色. | 
| static L.ColorSet | bgFgColor(String bgAndFg_)背景と前景の色. | 
| static L.ColorSet | bgFgColor(String[] colors_)背景と前景と選択時の色. | 
| static L.ColorSet | bgFgColor(String background_,
         String foreground_)背景と前景の色. | 
| static L.ColorSet | bgFgColor(String background_,
         String foreground_,
         String selected_)背景と前景と選択時の色. | 
| static JButton | button(String name_,
      Object... attrs_)属性付きボタン生成. | 
| static JPanel | cardPanel(Object... elements_)CardLayoutに要素を並べる. | 
| static JCheckBox | checkBox(String name_,
        Object... attrs_)属性付きチェックボックス生成. | 
| static otsu.hiSwing.hiSFileChooser | chooseDir(Frame frame_,
         ActionListener listener_,
         JComponent target_,
         String... selection_)フォルダchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseDir(Frame frame_,
         ActionListener listener_,
         String... selection_)フォルダchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseDir(Frame frame_,
         JComponent target_,
         ActionListener listener_,
         String... selection_)フォルダchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseDir(Frame frame_,
         JComponent target_,
         String... selection_)フォルダchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseFileR(Frame frame_,
           ActionListener listener_,
           JComponent target_,
           String... selection_)読み込み用ファイルchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseFileR(Frame frame_,
           ActionListener listener_,
           String... selection_)読み込み用ファイルchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseFileR(Frame frame_,
           JComponent target_,
           ActionListener listener_,
           String... selection_)読み込み用ファイルchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseFileR(Frame frame_,
           JComponent target_,
           String... selection_)読み込み用ファイルchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseFileW(Frame frame_,
           ActionListener listener_,
           JComponent target_,
           String... selection_)書き込み用ファイルchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseFileW(Frame frame_,
           ActionListener listener_,
           String... selection_)書き出し用ファイルchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseFileW(Frame frame_,
           JComponent target_,
           ActionListener listener_,
           String... selection_)書き出し用ファイルchooser属性. | 
| static otsu.hiSwing.hiSFileChooser | chooseFileW(Frame frame_,
           JComponent target_,
           String... selection_)書き出し用ファイルchooser属性. | 
| static WindowListener | closing(Frame frame_,
       ActionListener actionListener_)ウィンドウ閉鎖時のイベント通知先を設定する. | 
| static WindowListener | closing(Frame frame_,
       String msg_)ウィンドウが閉じられる時の処理属性作成. | 
| static Color | color(int ARGB_)色属性(バックグラウンド色となる)を与える | 
| static Color | color(String colorName_)色属性(バックグラウンド色となる)を与える | 
| static otsu.hiSwing.L.L_column | column(int val_)カラム数を与える. | 
| static JComboBox | comboBox(Object... attrs_)ComboBox生成. | 
| static otsu.hiSwing.L.L_command | command(String text_)ActionCommand文字列を設定する. | 
| static otsu.hiSwing.L.L_listener | command(String command_,
       ActionListener listener_)発生するActionEventのcommandを発生後に付け替える. | 
| static hiSDropTargetAdapter | drop()ドラッグ&ドロップ処理属性(ファイル名設定). | 
| static hiSDropTargetAdapter | drop(ActionListener actionListener_)ドラッグ&ドロップ処理属性(ファイル名通知). | 
| static hiSDropTargetAdapter | drop(ActionListener actionListener_,
    JComponent target_)ドラッグ&ドロップ処理属性(指定要素にファイル名設定). | 
| static hiSDropTargetAdapter | drop(JComponent target_)ドラッグ&ドロップ処理属性(指定要素にファイル名設定). | 
| static hiSDropTargetAdapter | drop(JComponent target_,
    ActionListener actionListener_)ドラッグ&ドロップ処理属性(指定要素にファイル名設定). | 
| static JEditorPane | editorPane(Object... attrs_)属性付きEditorPane生成. | 
| static otsu.hiSwing.L.hiFgColor | fg(Color col_)L.set()で用いる描画色属性をColorから作成する. | 
| static otsu.hiSwing.L.hiFgColor | fg(int rgb_)L.set()で用いる描画色属性を色名または色値文字列から作成する. | 
| static otsu.hiSwing.L.hiFgColor | fg(String name_)L.set()で用いる描画色属性を色名または色値文字列から作成する. | 
| static otsu.hiSwing.L.hiFgColor | fgColor(Color col_)L.set()で用いる描画色属性をColorから作成する. | 
| static otsu.hiSwing.L.hiFgColor | fgColor(int rgb_)L.set()で用いる描画色属性をintにパックされたRGBから作成する. | 
| static otsu.hiSwing.L.hiFgColor | fgColor(String name_)L.set()で用いる描画色属性を色名または色値文字列から作成する. | 
| static JPanel | freePanel(Object... objects_)要素を並べる(自由配置:要サイズ). | 
| static otsu.hiSwing.L.L_gap | gap()自動増減サイズ間隙(Glue)生成. | 
| static otsu.hiSwing.L.L_gap | gap(int size_)固定サイズ間隙生成. | 
| static Component | gap(int width_,
   int height_)固定サイズ間隙生成. | 
| static hiGraphicPanel | graphicPanel(Object... objects_)hiGraphicPanelを属性付きで生成する. | 
| static JPanel | gridPanel(Object... objects_)要素を同じサイズのマス目に並べる. | 
| static JPanel | groupPanel(Object... objects_)縦横に要素を整列させるpanel. | 
| static JPanel | hPanel(Object... elements_)要素を横に並べる. | 
| static JEditorPane | htmlPane(Object... attrs_)HTML用EditorPane生成. | 
| static JLabel | label(Object... attrs_)属性付きLabel生成. | 
| static hiListPanel | listPanel(Object... attrs_)属性付きlistPanel生成. | 
| static otsu.hiSwing.L.L_location | location(int x_,
        int y_)freePanelでの配置位置. | 
| static otsu.hiSwing.L.L_location | location(L.align align_)freePanelでの配置位置. | 
| static otsu.hiSwing.L.L_location | location(Point point_)freePanelでの配置位置. | 
| static otsu.hiSwing.L.L_logicalSize | logicalSize(int width_,
           int height_)論理サイズ属性. | 
| static Border | margin(int thickness_)パネル用の指定厚のマージン用Borderを作成する。 | 
| static Border | margin(int top_,
      int left_,
      int bottom_,
      int right_)パネル用の指定厚のマージン用Borderを作成する。 | 
| static otsu.hiSwing.L.L_max | max(int max_)最大値(ProgressBar用) | 
| static JMenu | menu(String name_,
    Object... elements_)メニューを作る. | 
| static JMenuBar | menuBar(Object... elements_)メニューバーを作る. | 
| static JMenuItem | menuItem(String name_,
        Object... elements_)メニュー要素を作る. | 
| static otsu.hiSwing.L.L_min | min(int min_)最小値(ProgressBar用) | 
| static Font | monospace(int size_)等幅フォントを得る. | 
| static otsu.hiSwing.L.ElmWithId | name(String name_,
    Component obj_)名前付きComponent(cardPanel,tabPanel用). | 
| static otsu.hiSwing.L.L_doNothing | op(Object... obj)引数式で動作実行. | 
| static JPanel | panel(Object... elements_)要素を並べる(デフォルト). | 
| static JPopupMenu | popupMenu(String name_,
         Object... elements_)ポップアップメニューを作る. | 
| static void | printTree(PrintWriter pw_,
         Component component_) | 
| static JProgressBar | progressBar(Object... attrs_)属性付きProgressbar生成. | 
| static JRadioButton | radioButton(String name_,
           Object... attrs_)属性付きラジオボタン生成. | 
| static otsu.hiSwing.L.L_row | row(int val_)行数を与える. | 
| static otsu.hiSwing.L.hiSbgColor | sbgColor(Color col_)L.set()で用いる選択バックグラウンド色属性をColorから作成する. | 
| static otsu.hiSwing.L.hiSbgColor | sbgColor(int rgb_)L.set()で用いる選択バックグラウンド色属性を作成する. | 
| static otsu.hiSwing.L.hiSbgColor | sbgColor(String name_)L.set()で用いる選択バックグラウンド色属性を色名または色値文字列から作成する. | 
| static JScrollPane | scrollPanel(Object... objects_)属性付きでスクロール域を付加する. | 
| static otsu.hiSwing.L.L_select | select(int idx_)要素選択(comboBox用). | 
| static JSeparator | separator()JSeparetorを得る. | 
| static JSeparator | separator(Object... attrs_)JSeparetorを得る. | 
| static JComponent | set(JComponent elm_,
   Object... attrs_)要素にサイズ、リスナーなどの情報を設定する. | 
| static void | set(JFrame frame_,
   Object... objs_)JFrameに要素と属性をセットする. | 
| static void | setDefaultFont(Font font_)デフォルトフォントをセットする. | 
| static void | setSizeRatio(double size_ratio_)指定サイズ値にかける比率を設定する。 | 
| static void | setSizeRatio(double size_ratio_,
            double otherBase_)指定サイズ値にかける比率を設定する. | 
| static otsu.hiSwing.L.L_size | size(double width_,
    double height_)要素のサイズ属性. | 
| static otsu.hiSwing.L.L_size | size(double width_,
    int height_)要素のサイズ属性. | 
| static otsu.hiSwing.L.L_size | size(int width_,
    double height_)要素のサイズ属性. | 
| static Dimension | size(int width_,
    int height_)要素のサイズ属性. | 
| static JTabbedPane | tabPanel(Object... elements_)tab重ねの領域. | 
| static JTextArea | textArea(Object... attrs_)属性付きTextArea生成. | 
| static JTextField | textField(Object... attrs_)属性付きTextField生成. | 
| static JTextPane | textPane(Object... attrs_)属性付きTextPane生成. | 
| static otsu.hiSwing.L.L_type | type(String type_)コンテキストタイプ属性. | 
| static JPanel | vPanel(Object... elements_)要素を縦に並べる. | 
public static Font default_font
public static double size_ratio
public static L.sizeFix fixH
public static L.sizeFix fixL
public static L.sizeFix fixB
public static boolean do_not_use_invokeLater_for_JTextComponent
public static boolean do_nothing_at_null
public static boolean do_nothing_at_cast_error
public static void setSizeRatio(double size_ratio_,
                                double otherBase_)
size_ratio_ - 倍率otherBase_ - 追加比率public static void setSizeRatio(double size_ratio_)
 ボタンやパネルなどのリストなどのサイズも変わります。
 フォントやスクロールバーなどのサイズも変わります。フォントやスクロールバーのサイズは12ptに倍率をかけたものとなります。
 
size_ratio_ - 倍率public static void setDefaultFont(Font font_)
UIManager.put(key,value)を使いフォントをセットします。
次のフォントがセットされます。
font_ - セットするフォントpublic static void printTree(PrintWriter pw_, Component component_)
public static JPanel groupPanel(Object... objects_)
GroupLayoutを用い、要素を縦横に並べるメソッドです。
要素を縦横に並べます。
カラム数を指定する場合L.column(int)を用います。
行数を指定する場合はL.row(int)を用います。
行数、カラム数両方を指定してもかまいません。
L.gridPanel()と異なり各列のサイズは
列ごとに異なります。
objects_ - 要素およびこのパネルにセットする情報public static otsu.hiSwing.L.L_row row(int val_)
val_ - 行数public static otsu.hiSwing.L.L_column column(int val_)
val_ - カラム数public static Font monospace(int size_)
次の操作と同等です。
newFont(Font.MONOSPACED,Font.PLAIN, size_);
swingでは論理フォント名は標準では次の5つが用意されています。
スタイルとして次のものが用意されています。
これらの内、本メソッドはFont.MONOSPACED,Font.PLAINのFontを
生成します。
その他のフォントに関しては直接Fontをnewしてください。
フォント例を示します。
 
 
 
 
 
このフォント例を表示するプログラムを示します。
[an error occurred while processing this directive]
import otsu.hiSwing.*;
import javax.swing.*;
import java.awt.*;
public class Test {
   static String text="AN MWiIl10Oo      |\n   a n m^~.,:;   +\n      あソン空一鸞\\";
   public static void main(final String[] args_){
      SwingUtilities.invokeLater(()-<{start(args_);});
      }
   static void start(String[] args_){
      JFrame    frame=new JFrame();
      L.set(frame,
         "title:Font試験","pack","visible","quit:終了しますか?",
         L.vPanel(
            L.hPanel(
               "Font名,Fontスタイル,サイズ",
               L.gap(),
               L.button("終了",L.closing(frame,"終了しますか?"))
               ),
            L.hPanel(
               "次の文字列を表示しています",
               L.textField("AN.MWiIl10Oo''''''|\\n'''a'n_m^~.,:;'''+\\n''''''あソン空一鸞\\",
                           L.monospace(12))
               ),
            L.hPanel("ただし、引用符は半角空白、下線は全角空白です。"
                    +"3行は等幅表示では同じ長さになるはずです。",L.gap()),
            L.hPanel("Wの後は i(アイ)、I(アイ)、l(エル)、1(いち)、"
                    +"0(ゼロ)、O(オー)、o(オー) となっています",L.gap()),
            L.tabPanel(
               L.name("PLAIN,12",
                  L.groupPanel(L.column(2),
                     "Font.DIALOG, Font.PLAIN, 12 ",
                     L.textArea(text,new Font(Font.DIALOG, Font.PLAIN, 12),L.border.etched),
                     "Font.DIALOG_INPUT, Font.PLAIN, 12 ",
                     L.textArea(text,new Font(Font.DIALOG_INPUT, Font.PLAIN, 12),L.border.etched),
                     "Font.MONOSPACED, Font.PLAIN, 12 ",
                     L.textArea(text,new Font(Font.MONOSPACED, Font.PLAIN, 12),L.border.etched),
                     "Font.SANS_SERIF, Font.PLAIN, 12 ",
                     L.textArea(text,new Font(Font.SANS_SERIF, Font.PLAIN, 12),L.border.etched),
                     "Font.SERIF, Font.PLAIN, 12 ",
                     L.textArea(text,new Font(Font.SERIF, Font.PLAIN, 12),L.border.etched)
                     )
                  ),
               L.name("BOLD,12",
                  L.groupPanel(L.column(2),
                     "Font.DIALOG, Font.BOLD, 12 ",
                     L.textArea(text,new Font(Font.DIALOG, Font.BOLD, 12),L.border.etched),
                     "Font.DIALOG_INPUT, Font.BOLD, 12 ",
                     L.textArea(text,new Font(Font.DIALOG_INPUT, Font.BOLD, 12),L.border.etched),
                     "Font.MONOSPACED, Font.BOLD, 12 ",
                     L.textArea(text,new Font(Font.MONOSPACED, Font.BOLD, 12),L.border.etched),
                     "Font.SANS_SERIF, Font.BOLD, 12 ",
                     L.textArea(text,new Font(Font.SANS_SERIF, Font.BOLD, 12),L.border.etched),
                     "Font.SERIF, Font.BOLD, 12 ",
                     L.textArea(text,new Font(Font.SERIF, Font.BOLD, 12),L.border.etched)
                     )
                  ),
               L.name("ITALIC,12",
                  L.groupPanel(L.column(2),
                     "Font.DIALOG, Font.ITALIC, 12 ",
                     L.textArea(text,new Font(Font.DIALOG, Font.ITALIC, 12),L.border.etched),
                     "Font.DIALOG_INPUT, Font.ITALIC, 12 ",
                     L.textArea(text,new Font(Font.DIALOG_INPUT, Font.ITALIC, 12),L.border.etched),
                     "Font.MONOSPACED, Font.ITALIC, 12 ",
                     L.textArea(text,new Font(Font.MONOSPACED, Font.ITALIC, 12),L.border.etched),
                     "Font.SANS_SERIF, Font.ITALIC, 12 ",
                     L.textArea(text,new Font(Font.SANS_SERIF, Font.ITALIC, 12),L.border.etched),
                     "Font.SERIF, Font.ITALIC, 12 ",
                     L.textArea(text,new Font(Font.SERIF, Font.ITALIC, 12),L.border.etched)
                     )
                  ),
               L.name("PLAIN,16",
                  L.vPanel(
                     "Font.DIALOG, Font.PLAIN, 16 ",
                     L.textArea(text,new Font(Font.DIALOG, Font.PLAIN, 16),L.border.etched),
                     "Font.MONOSPACED, Font.PLAIN, 16 ",
                     L.textArea(text,new Font(Font.MONOSPACED, Font.PLAIN, 16),L.border.etched),
                     "Font.SERIF, Font.PLAIN, 16 ",
                     L.textArea(text,new Font(Font.SERIF, Font.PLAIN, 16),L.border.etched)
                     )
                  ),
               L.name("BOLD,16",
                  L.vPanel(
                     "Font.DIALOG, Font.BOLD, 16 ",
                     L.textArea(text,new Font(Font.DIALOG, Font.BOLD, 16),L.border.etched),
                     "Font.MONOSPACED, Font.BOLD, 16 ",
                     L.textArea(text,new Font(Font.MONOSPACED, Font.BOLD, 16),L.border.etched),
                     "Font.SERIF, Font.BOLD, 16 ",
                     L.textArea(text,new Font(Font.SERIF, Font.BOLD, 16),L.border.etched)
                     )
                  ),
               L.name("monospace,10-18-24",
                  L.vPanel(
                     "Font.MONOSPACED, Font.PLAIN, 10 ",
                     L.textArea(text,new Font(Font.MONOSPACED, Font.PLAIN, 10),L.border.etched),
                     "Font.MONOSPACED, Font.PLAIN, 18 ",
                     L.textArea(text,new Font(Font.MONOSPACED, Font.PLAIN, 18),L.border.etched),
                     "Font.MONOSPACED, Font.PLAIN, 24 ",
                     L.textArea(text,new Font(Font.MONOSPACED, Font.PLAIN, 24),L.border.etched)
                     )
                  )
               )
            )
         );
      }
   }
size_ - フォントサイズpublic static JPanel gridPanel(Object... objects_)
要素を縦横に並べます。
カラム数を指定する場合L.column(int)を用います。
行数を指定する場合はL.row(int)を用います。
行数、カラム数両方を指定してもかまいません。
L.groupPanel()と異なり全マスが同じ大きさに
なります。
引数にはArrayListも使えますので、例えば次のコードで
   L.gridPanel(L.column(3),buttons(12,myListener))
   ///
   static ArrayList<Object> buttons(int n_,ActionListener listener_){
      ArrayList<Object> _ret=new ArrayList<Object>();
      for(int _i=0;_i<n_;++_i){
         _ret.add(L.button(hiU.itoa(_i+1)),listener_);
         }
      return _ret;
      }
次の様な構造を得ることもできます。
 
objects_ - 要素およびこのパネルにセットする情報public static Border margin(int thickness_)
L.hPanel(L.margin(5),....);
thickness_ - 厚さpublic static Border margin(int top_, int left_, int bottom_, int right_)
L.hPanel(L.margin(5,10,5,10),....);
top_ - 上マージンleft_ - 左マージンbottom_ - 下マージンright_ - 右マージンpublic static JPanel hPanel(Object... elements_)
要素を横方向に並べたJPanelを生成します。
X_AXISのBoxLayoutを持ちます。
引数には並べるComponentと、このパネルに設定する
サイズ(Dimension)や描画色(L.fgColor(色)で取得)、
バックグラウンド色(L.bgColor(色)で取得)を置くことができます。
elements_ - 要素または属性public static JPanel vPanel(Object... elements_)
要素を縦方向に並べたJPanelを生成します。
Y_AXISのBoxLayoutを持ちます。
引数には並べるComponentと、このパネルに設定する
サイズ(Dimension)や描画色(L.fgColor(色)で取得)、
バックグラウンド色(L.bgColor(色)で取得)を置くことができます。
引数にはArrayList<Object>を置くこともできます。展開されて解釈されます。
elements_ - 要素またはパネルの属性public static JPanel panel(Object... elements_)
要素を並べたJPanelを生成します。
引数には並べるComponentと、このパネルに設定する
サイズ(Dimension)や描画色(L.fgColor(色)で取得)、
バックグラウンド色(L.bgColor(色)で取得)を置くことができます。
引数にはArrayList<Object>を置くこともできます。展開されて解釈されます。
elements_ - 要素またはパネルの属性public static JPanel freePanel(Object... objects_)
要素を自由な位置に並べます。各要素のサイズは予め定められて いる必要があります。
要素の配置位置は各要素のL.location()属性として
与えます。
L.freePanel(L.size(400,200),
   L.button("指定無し"  ,myListener,size),// TOP,LEFTとなる
   L.button("LEFT"      ,L.location(L.align.left)  ,myListener,size),//無指定相当
   L.button("TOP"       ,L.location(L.align.top)   ,myListener,size),//無指定相当
   L.button("CENTER"    ,L.location(L.align.center),myListener,size),
   L.button("RIGHT"     ,L.location(L.align.right) ,myListener,size),
   L.button("MIDDLE"    ,L.location(L.align.middle),myListener,size),
   L.button("BOTTOM"    ,L.location(L.align.bottom),myListener,size),
   L.button("MIDDLE,CENTER",L.location(L.align.middle),L.location(L.align.center)
            ,myListener,size),
   L.button("MIDDLE,RIGHT",L.location(L.align.middle),L.location(L.align.right)
            ,myListener,size),
   L.button("BOTTOM,CENTER",L.location(L.align.bottom),L.location(L.align.center)
            ,myListener,size),
   L.button("BOTTOM,RIGHT",L.location(L.align.bottom),L.location(L.align.right)
            ,myListener,size),
   L.button("190,50"   ,L.location(190,50),myListener,size),
   L.button("40,130"   ,size,L.location(40,130),myListener),
   L.button("350,60" ,v(40,60),myListener,L.color("red")),// サイズつけ忘れ
   L.hPanel(L.size(180,40),L.border.etched_raized,L.location(210,120),
      " 210,120 ",L.button("btn-1",myListener),L.button("btn-2",myListener)
      )
   )
 
この例ではx,yによる位置指定と
align指定による位置指定を行っています。
要素として、ボタン以外にパネルもセットしています。
サイズの不定な要素は、仮のサイズ(5×5)が与えられ、配置されます。
objects_ - 並べる要素public static JPanel cardPanel(Object... elements_)
CardLayoutを持つJPanelを生成し、要素を設定します。
要素には通常のJComponentの他L.name()をによる名前付き要素を
指定することもできます。
カードの表示は位置をずらしていく形と名前を指定する形で行えます。
 ・hiSwing.showCard(cardPanel,名前); // 名前指定で表示
位置指定表示は次の様に行います。
 ・hiSwing.showCard(cardPanel,hiSwing.position.first); // 先頭
 ・hiSwing.showCard(cardPanel,hiSwing.position.last) ; // 最後
 ・hiSwing.showCard(cardPanel,hiSwing.position.next) ; // 次
 ・hiSwing.showCard(cardPanel,hiSwing.position.prev) ; // 前
最後の次は先頭となります。
構築された最初の位置は先頭になっています。
名前付きの場合L.showCard()で
名前を指定してカードの表示を行わせることができます。
なお名前を振らない場合内部的に"##番号##"の名が与えられますので、これと
衝突する名前は付けないでください。
   //==== 名前を付ける例
   String[]      cardId={"card1","card2"};
   JEditorPane[] card  =new JEditorPane[2];
   //...
   JPanel card=L.cardPanel(L.size(500,130),
       L.name(cardId[0],L.set(card[0]=new JEditorPane(),L.type("text/html"))),
       L.name(cardId[1],L.set(card[1]=new JEditorPane(),L.type("text/html")))
       )
   //
   count=++count%2;
   hiSwing.setText(card[count],HTML文字列);
   hiSwing.setLineSpacing(card[count],-3.0f);
   hiSwing.showCard(cardPanel,cardId[count]);
   //==== 名前を付けない例
   JEditorPane[] card  =new JEditorPane[2];
   //...
   JPanel cardPanel=L.cardPanel(L.size(500,130),
       L.set(card[0]=new JEditorPane(),L.type("text/html")),
       L.set(card[1]=new JEditorPane(),L.type("text/html"))
       )
   //
   count=++count%2;
   hiSwing.setText(card[count],HTML文字列);
   hiSwing.setLineSpacing(card[count],-3.0f);
   hiSwing.showCard(cardPanel,hiSwing.position.next);
elements_ - 要素またはパネルの属性public static JTabbedPane tabPanel(Object... elements_)
JTabbedPaneを生成します。
タブの要素はL.name(名前、要素)で
与えます。
   L.tabPanel(
      L.name("tab-1",
        L.vPanel(
           L.button("button-x"),L.button("button-y")
           )
        ),
      L.name("tab-2",
        L.panel(
           L.button("button-1"),L.button("button-2"),
           L.button("button-3"),L.button("button-4"),
           L.button("button-5")
           )
        ),
      L.name("tab-3",L.graphicPanel())
      )
 
名前を振らない場合内部的に"##番号##"の名が与えられますので、これと
衝突する名前は付けないでください。
elements_ - 名前付き要素またはパネルの属性public static otsu.hiSwing.L.ElmWithId name(String name_, Component obj_)
L.cardPanel(...),
L.tabPanel(...)
にid付きの要素を並べるためのものです。
   String[]      cardId={"card1","card2"};
   JEditorPane[] card  =new JEditorPane[2];
   //...
   JPanel cardPanel=L.cardPanel(L.size(500,130),
       L.name(cardId[0],L.set(card[0]=new JEditorPane(),L.type("text/html"))),
       L.name(cardId[1],L.set(card[1]=new JEditorPane(),L.type("text/html")))
       )
   //
   count=++count%2;
   hiSwing.setText(card[count],HTML文字列);
   hiSwing.setLineSpacing(card[count],-3.0f);
   hiSwing.showCard(cardPanel,cardId[count]);
name_ - カード名あるいはタブ名obj_ - 要素public static JScrollPane scrollPanel(Object... objects_)
要素(通常1個)入れたスクロールパネル(JScrollPane)を作成します。
複数の要素が与えられた場合、縦並べのパネル(JPanel)が一段挟まります。
objects_ - スクロール域に入れる要素とスクロール域の属性JScrollPane)public static otsu.hiSwing.L.L_listener command(String command_, ActionListener listener_)
ActionEventの発生源には手を入れず、発生したeventを
変更して中継します。
これに対しL.command(String)は発生源
の情報を書き換えるものです。
command_ - コマンドlistener_ - リスナーpublic static JMenuBar menuBar(Object... elements_)
メニューバーを作ります。Frameの要素として設定します。
メニューバーの要素として複数のメニュー 
L.menu(名前,...)
を置きます
  ActionListener myListener=new MyActionListener();
  JFrame         frame     =new JFrame();
  //
  L.set(frame,"title:テスト",...
     L.menuBar(
        L.menu("menu-1",...),
        L.menu("menu-2",...),
        ...
        ),
     L.vPanel(...) // 主画面構成
     );
elements_ - 要素(通常メニューまたはメニューバー)並びpublic static JMenu menu(String name_, Object... elements_)
メニューバーL.menuBar(...)または
上位メニューの要素となります。
メニューの要素としてL.menuItem(String,...)
またはメニューを置くことができます。
  ActionListener myListener=new MyActionListener();
  JFrame         frame     =new JFrame();
  //
  L.set(frame,"title:テスト",...
     L.menuBar(
        L.menu("menu-1",
           L.menuItem("menu-1-1",myListener),
           L.menuItem("menu-1-2",myListener),
           L.menuItem("終了",L.closing(frame,"終了しますか?"))
           ),
        L.menu("menu-2",
           L.menuIntem("menu-2-1",myListener),
           L.menu("menu-2-2",
              L.menuItem("menu-2-2-1",myListener),
              L.menuItem("menu-2-2-1",myListener)
              ),
           L.menuItem("menu-2-3",myListener)
           )
        ),
     L.vPanel(...) // 主画面構成
     );
name_ - 名前elements_ - 要素(通常MenuまたはMenuItem)の並びpublic static JPopupMenu popupMenu(String name_, Object... elements_)
他の要素と異なり、ポップアップメニューは主Frameには入れず、マウスの右クリックなどで表示させます。
import otsu.hiSwing.*;
import javax.swing.*;
import java.awt.event.*;
class Test {
   // ポップアップメニューでメニューが選択された時の処理
   class MenuActionListener implements ActionListener {
       @Override // ActionListener
      public void actionPerformed(ActionEvent e_){
         ta.append("ACTION:"+e_.getActionCommand()+"\n");
         }
      }
   // 右クリックでポップアップさせる処理
   class MyMouseListener extends MouseAdapter {
       @Override // MouseListener/MouseAdapter
      public void mousePressed(MouseEvent e) {
         if( e.getButton()==3 ){// 右ボタン
            popup.show(e.getComponent(), e.getX(), e.getY());
            }
         }
      }
   MenuActionListener menuActionListener=new MenuActionListener();
   MyMouseListener    myMouseListener   =new MyMouseListener();
   JPopupMenu         popup;// ポップアップメニュー
   JTextArea          ta;   // 右クリックイベントを拾うテキストエリア
   JFrame             frame;// メインのフレーム
   public static void main(final String[] args_){
      SwingUtilities.invokeLater(()-<{start(args_);});
      }
   static void start(String[] args_){
      Test _this = new Test();
      _this.popup= L.popupMenu("ポップアップ",
         L.menuItem("メニュー1",_this.menuActionListener),
         L.menuItem("メニュー2",_this.menuActionListener),
         L.menuItem("メニュー3",_this.menuActionListener)
         );
      _this.frame= new JFrame();
      L.set(_this.frame,"title:popup試験","pack","visible","quit:終了しますか?",
         _this.ta=L.textArea(L.size(400,150),_this.myMouseListener));
      }
   
name_ - 名前elements_ - 要素public static JMenuItem menuItem(String name_, Object... elements_)
メニューの要素となります。
機能はJButtonとほぼ同等です。通常はここにActionListenerを設定します。
ActionEventのactionCommandに表示名が与えられます。
  class MyActionListener implement ActionListener {
     @Override // ActionListener
     public void actionPerformed(ActionEvent e_){
        String _cmd=e_.getActionCommand(); // "menu-1-1"や"menu-1-2"が得られる
        //...
        }
     }
  /////
  ActionListener myListener=new MyActionListener();
  JFrame         frame     =new JFrame();
  //
  L.set(frame,"title:テスト",...
     L.menuBar(
        L.menu("menu-1",
           L.menuItem("menu-1-1",myListener),
           L.menuItem("menu-1-2",myListener),
           L.menuItem("終了",L.closing(frame,"終了しますか?"))
           ),
        L.menu("menu-2",...)
        ),
     L.vPanel(...) // 主画面構成
     );
name_ - 名前elements_ - 要素public static JComponent set(JComponent elm_, Object... attrs_)
Jcomponent要素にサイズ、色、リスナーなどの属性を設定します。
例えば次の例はJProgressBarにサイズと最大値をセットしています。
//あとでアクセスするためのJProgresBarr pb;があるとして L.set(pb=new JProgressBar(),L.size(200,20),L.max(50))
簡便化のために用意されているメソッドであり、必ずしも このメソッドで設定する必要はありません。記述は複雑化 しますが、要素を変数として置き、変数に直接アクセスしても 構いません。
セット可能な属性は次のものです。
| 属性の型/メソッド | 対象となる要素の型 | 説明 | 
| L.size()Dimension | サイズ | |
| L.bgColor()L.bgColor | バックグラウンド色 | |
| L.fgColor()L.fg | フォアグラウンド色 | |
| L.sbgColor() | hiListPanel | 選択項目を示す色 | 
| ButtonGroup | AbstractButton主に JRadioButton | ラジオボタンのグループ | 
| ActionListenerAdjustmentListenerComponentListenerContainerListenerFocusListenerInputMethodListenerItemListenerKeyListenerMouseListenerMouseMotionListenerMouseWheelListenerListSelectionListener | AbstractButtonJTextFieldJFileChooserJComboBox他 | イベントリスナー add可能な要素であればaddします。 hiSwing内で特別な扱いを行うのはActionListenerのみです | 
| L.drop() | 自分にセット可能なのは ・JTextField ・JTextArea 他のtext域へのセット、イベント通知のみの場合はどの要素でも可 | ファイルのドラッグでファイルパスを設定する | 
| L.closing()で取得したWindowListener | AbstactButton他ActionListerと共通 | 確認の上、終了または無処理 | 
| Boolean | JToggleButtonJCheckBoxやJRadioButton | 選択状態 記述上は単純にtrueまたはfalse | 
| L.type() | JEditorPane | コンテキストタイプ "text/html"など | 
| L.location() | freePanel()の内容 | freeパネル内の配置位置 | 
| L.select() | JComboBox | コンボボックスの初期選択index | 
| L.command() | AbstractButton他ActionListenernの項と同じ | ActionEventのactionCommand文字列を設定する | 
| L.chooseFileR()L.chooseFileW()L.chooseDir() | AbstractButton他ActionListenernの項と同じ | ActionEventのactionCommand文字列を設定する | 
| L.borderBorder | ボーダーを設定する | |
| List | 展開しセットされる属性 | |
| Runnable | 属性設定時に設定する代わりに実行する | |
| L.align | JPanelJLabelJTextFieldAbstractButton | 自身の内容整列属性 | 
| L.editable | JTextComponentJComboBoxJTree | 編集可能属性(通常noにするために使う) | 
| L.opaque | 不透明属性(yesなら不透明、noなら透明) | |
| L.max() | JProgressBar | 最大値 | 
| L.min() | JProgressBar | 最小値 | 
| L.monospace()Font | フォント | |
| L.logicalSize()Font | graphicPanelの初期論理サイズ(イメージサイズ) | |
| L.op() | 何もしない | |
| L.ColorSet() | バックグラウンド色、フォアグラウンド色 | 
elm_ - 属性をセットしたい要素attrs_ - 属性public static otsu.hiSwing.L.L_logicalSize logicalSize(int width_,
                                                       int height_)
graphicPanelの初期論理サイズ(イメージサイズ)を指定します。
width_ - 幅height_ - 高さpublic static WindowListener closing(Frame frame_, String msg_)
デフォルトの閉じるボタン[x]で確認ダイアログを出し、 終了する/しないを選択させる属性と、ボタンを押したときに 同様に終了する/しないを選択させる属性を設定するために 使います。
   // _frameが基本JFrameだとして
   // [x]に確認終了属性をつける
   _frame.setDefaultCloseOperation(Frame.DO_NOTHING_ON_CLOSE);
   _frame.addWindowListener(L.closing(_frame,"終了しますか?")); 
   // ボタンに終了属性をつける
   JComponent elm=L.set(new JButton("終了"),new Dimension(100,20)
                       ,L.closing(_frame,"終了しますか?"))
frame_ - 基本のFramemsg_ - 確認メッセージpublic static WindowListener closing(Frame frame_, ActionListener actionListener_)
frame_ - FrameactionListener_ - 通知先public static hiSDropTargetAdapter drop()
 要素にファイルパス名を設定します。
複数ファイルがドロップされる場合、設定されるのは代表ファイル1個です。
要素にActionListenerが設定されている場合、
それらのactionPerformed()を呼びます。
この時、ActionEventはhiActionEventです。
ActionEvent.getActionCommand()では設定された
パス名が返ります。
複数ファイルの場合
hiActionEvent.getStrings(ActionEvent) 
でString[]として取得することができます。
public static hiSDropTargetAdapter drop(ActionListener actionListener_)
指定のリスナーにイベントの通知を行います。
この時、ActionEventはhiActionEventです。
ActionEvent.getActionCommand()では
パス名が返ります。
複数ファイルがドロップされた場合の場合getActionCommand()では何れか1つのみが
得られます。全てのファイルは
hiActionEvent.getStrings(ActionEvent) 
でString[]として取得することができます
actionListener_ - アクションリスナpublic static hiSDropTargetAdapter drop(JComponent target_)
 指定要素にファイル名を設定します。
複数ファイルがドロップされる場合、設定されるのは代表ファイル1個です。
hiActionEventです。ActionEvent.getActionCommand()では設定された
パス名が返ります。hiActionEvent.getStrings(ActionEvent) 
でString[]として取得することができます。EventObject.getSource()で得られるのは値が設定された
要素です。hiActionEvent.getInfo(ActionEvent)
で得られます。target_ - ターゲットpublic static hiSDropTargetAdapter drop(JComponent target_, ActionListener actionListener_)
 指定要素にファイル名を設定し、指定のリスナーを呼び出します。
複数ファイルがドロップされる場合、設定されるのは代表ファイル1個です。
要素に設定されているActionListenerは無視されます。
通知されるActionEventはhiActionEventです。ActionEvent.getActionCommand()では設定された
パス名が返ります。hiActionEvent.getStrings(ActionEvent) 
でString[]として取得することができます。EventObject.getSource()で得られるのは
イベントの発生元(通常JButton)です。hiActionEvent.getInfo(ActionEvent)
で得られます。target_ - ターゲットactionListener_ - アクションリスナpublic static hiSDropTargetAdapter drop(ActionListener actionListener_, JComponent target_)
actionListener_ - アクションリスナtarget_ - ターゲットpublic static Dimension size(int width_, int height_)
要素のサイズ属性の生成を行います。
引数は整数(例:30)と浮動小数(例:30.0,30.1)が可能です。
引数がともにintの場合、
JTextFieldは高さの最大値もその値で設定し、ボタン(AbstractButton)の場合は
幅高さとも最大値を指定値に設定します。
その他の要素には最大値を設定しません。
浮動小数の場合少数部が0の値は 最大長をその値にすることを表し、少数が1の値は最大長を指定しない ことを表します。
width_ - 幅(ピクセル数)height_ - 高さ(ピクセル数)public static otsu.hiSwing.L.L_size size(double width_,
                                         int height_)
width_ - 幅(ピクセル数)height_ - 高さ(ピクセル数)public static otsu.hiSwing.L.L_size size(double width_,
                                         double height_)
width_ - 幅(ピクセル数)height_ - 高さ(ピクセル数)public static otsu.hiSwing.L.L_size size(int width_,
                                         double height_)
width_ - 幅(ピクセル数)height_ - 高さ(ピクセル数)public static otsu.hiSwing.L.hiFgColor fgColor(int rgb_)
intにパックされたRGBまたはAlpha値を持つARGBで描画色をセットします。
値に関してはhiSwing.color(int)を参照してください。
rgb_ - 色指定データ(0xRRGGBBまたは0xAARRGGBB)public static otsu.hiSwing.L.hiFgColor fg(int rgb_)
fgColor(int)の別名です。rgb_ - 色指定データ(0xRRGGBBまたは0xAARRGGBB)public static otsu.hiSwing.L.hiFgColor fgColor(String name_)
L.set(JComponent,Object...)でJComponentに描画色を設定するためのものです。次のように
使います。
  L.set(new JButton("停止"),L.bgColor("red"),L.fgColor("white"))
値の指定法はhiSwing.color(String)を参照してください
name_ - 色名または色値文字列public static otsu.hiSwing.L.hiFgColor fg(String name_)
fgColor(String)の別名です。name_ - 色名または色値文字列public static otsu.hiSwing.L.hiFgColor fgColor(Color col_)
col_ - 元のColorpublic static otsu.hiSwing.L.hiFgColor fg(Color col_)
fgColor(int)の別名です。col_ - 元のColorpublic static otsu.hiSwing.L.hiBgColor bgColor(int rgb_)
intにパックされたRGBでバックグラウンド色をセットします。
値に関してはhiSwing.color(int)を参照してください。
rgb_ - 色指定データ(0x00RRGGBB)public static otsu.hiSwing.L.hiBgColor bg(int rgb_)
bgColor(int)の別名です。rgb_ - 色指定データ(0x00RRGGBB)public static otsu.hiSwing.L.hiBgColor bgColor(String name_)
L.set(JComponent,Object...)でJComponentにバックグラウンド色を設定するためのものです。次のように
使います。
  L.set(new JButton("停止"),L.bgColor("red"),L.fgColor("white"))
値の指定法はhiSwing.color(String)を参照してください
name_ - 色名または色値文字列public static otsu.hiSwing.L.hiBgColor bg(String name_)
bgColor(String)の別名です。name_ - 色名または色値文字列public static otsu.hiSwing.L.hiBgColor bgColor(Color col_)
col_ - 元のColorpublic static otsu.hiSwing.L.hiBgColor bg(Color col_)
bgColor(Color)の別名です。col_ - 元のColorpublic static otsu.hiSwing.L.hiSbgColor sbgColor(int rgb_)
intにパックされたRGBでバックグラウンド色をセットします。
値に関してはhiSwing.color(int)を参照してください。
rgb_ - 色指定データ(0x00RRGGBB)public static otsu.hiSwing.L.hiSbgColor sbgColor(String name_)
L.set(JComponent,Object...)でJComponentにバックグラウンド色を設定するためのものです。次のように
使います。
  L.set(new JButton("停止"),L.bgColor("red"),L.fgColor("white"))
値の指定法はhiSwing.color(String)を参照してください
name_ - 色名または色値文字列public static otsu.hiSwing.L.hiSbgColor sbgColor(Color col_)
col_ - 元のColorpublic static L.ColorSet bgFgColor(String bgAndFg_)
bgAndFg_ - バックグラウンド色とフォアグラウンド色をカンマで繋いだもの. EX) black,whitepublic static L.ColorSet bgFgColor(String background_, String foreground_)
background_ - バックグラウンド色foreground_ - フォアグラウンド色public static L.ColorSet bgFgColor(String background_, String foreground_, String selected_)
background_ - バックグラウンド色foreground_ - フォアグラウンド色selected_ - 選択色public static L.ColorSet bgFgColor(String[] colors_)
colors_ - バックグラウンド色,フォアグラウンド色,選択色public static L.ColorSet bgFg(String bgAndFg_)
bgAndFg_ - バックグラウンド色とフォアグラウンド色をカンマで繋いだもの. EX) black,whitepublic static L.ColorSet bgFg(String background_, String foreground_)
background_ - バックグラウンド色foreground_ - フォアグラウンド色public static L.ColorSet bgFg(String background_, String foreground_, String selected_)
background_ - バックグラウンド色foreground_ - フォアグラウンド色selected_ - 選択色public static L.ColorSet bgFg(String[] colors_)
colors_ - バックグラウンド色,フォアグラウンド色,選択色(選択色は省略可)public static otsu.hiSwing.L.L_doNothing op(Object... obj)
引数式の上で動作を記述します。本関数の戻り値は要素、属性としては 無視されます。
   ActionListener myListener=...;
   JButton        btn;
   //
   L.hPanel(
      btn= new JButton("ボタン"),
      L.op(btn.addActionListener(myListener),
           btn.setBackGround(new Color(0xFFFF)),
      //
      )
obj - オブジェクトpublic static otsu.hiSwing.hiSFileChooser chooseFileR(Frame frame_, JComponent target_, String... selection_)
要素でActionEventが発生した時に、JFileChooserを
生成し、実施ボタン(「開く」ボタン)が押されると、
選択されているファイルのパスをtarget_で指定される要素の
setTextで設定します。通常はtarget_はJTextField
です。
selection_は可変で
 [0] ファイルタイプ
 [1] 実施ボタンの文字列(省略時は「開く」など)
 [2] 実施ボタンの文字列(省略時は「選択したファイルを開きます」など)
です。
ファイルタイプは次の形式で指定します。
 ・パターンは|で繋ぐ
 ・表示とファイルタイプリストを分ける場合
   表示:タイプリスト
  という形で:で分ける。「表示:」は省略可
 ・ファイルタイプリストはファイルタイプを
   ファイルタイプ,ファイルタイプ,ファイルタイプ
  という形で,で区切る。;も可
 ・ファイルタイプは
   *.添え字 または 添え字
   *のみで全ファイル
例えば、次の指定では
     _test.fn=L.textField(_test,L.drop()),
     L.button("参照",L.chooseFileR(_frame,_test.fn
                     ,"*.txt,*.xml | * | 実行形式:*.class,*.jar","選択"))
次のようなファイル選択ダイアログが出ます。
 
frame_ - 主Frametarget_ - 選択されたファイルパスを設定する要素(通常JTextField)selection_ - ファイルタイプ指定、ボタン表示文字列public static otsu.hiSwing.hiSFileChooser chooseFileR(Frame frame_, ActionListener listener_, String... selection_)
イベント発生時に読み込み用ファイル選択ダイアログを出し、結果をlistener_に通知します。
frame_ - 主Framelistener_ - 通知先selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.hiSFileChooser chooseFileR(Frame frame_, JComponent target_, ActionListener listener_, String... selection_)
frame_ - 主Frametarget_ - 選択されたファイルパスを設定する要素(通常JTextField)listener_ - 通知先selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.hiSFileChooser chooseFileR(Frame frame_, ActionListener listener_, JComponent target_, String... selection_)
chooseFileR(Frame,JComponent,ActionListener,String...)の引数並びを変えたものですframe_ - 主Framelistener_ - 通知先target_ - 選択されたファイルパスを設定する要素(通常JTextField)selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.hiSFileChooser chooseFileW(Frame frame_, JComponent target_, String... selection_)
イベント発生時に書き出し用ファイル選択ダイアログを出し、結果をtarget_にセットします。
frame_ - 主Frametarget_ - 選択されたファイルパスを設定する要素(通常JTextField)selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.hiSFileChooser chooseFileW(Frame frame_, ActionListener listener_, String... selection_)
イベント発生時に書き出し用ファイル選択ダイアログを出し、結果をlistener_に通知します。
frame_ - 主Framelistener_ - 通知先selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.hiSFileChooser chooseFileW(Frame frame_, JComponent target_, ActionListener listener_, String... selection_)
frame_ - 主Frametarget_ - 選択されたファイルパスを設定する要素(通常JTextField)listener_ - 通知先selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.hiSFileChooser chooseFileW(Frame frame_, ActionListener listener_, JComponent target_, String... selection_)
chooseFileW(Frame,JComponent,ActionListener,String...)の引数並びを変えたものですframe_ - 主Framelistener_ - 通知先target_ - 選択されたファイルパスを設定する要素(通常JTextField)selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.hiSFileChooser chooseDir(Frame frame_, JComponent target_, String... selection_)
frame_ - 主Frametarget_ - 選択されたファイルパスを設定する要素(通常JTextField)selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.hiSFileChooser chooseDir(Frame frame_, ActionListener listener_, String... selection_)
イベント発生時にフォルダ選択ダイアログを出し、結果をlistener_に通知します。
frame_ - 主Framelistener_ - 通知先selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.hiSFileChooser chooseDir(Frame frame_, JComponent target_, ActionListener listener_, String... selection_)
frame_ - 主Frametarget_ - 選択されたファイルパスを設定する要素(通常JTextField)listener_ - 通知先selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.hiSFileChooser chooseDir(Frame frame_, ActionListener listener_, JComponent target_, String... selection_)
chooseDir(Frame,JComponent,ActionListener,String...)の引数並びを変えたものですframe_ - 主Framelistener_ - 通知先target_ - 選択されたファイルパスを設定する要素(通常JTextField)selection_ - chooseFileR(Frame,JComponent,String...)参照public static otsu.hiSwing.L.L_type type(String type_)
JEditPaneのコンテキストタイプを設定します。
type_ - タイプ ("text/html"など)public static otsu.hiSwing.L.L_select select(int idx_)
コンボボックスの初期選択要素位置を指定します。 0オリジンです。
idx_ - 選択位置public static otsu.hiSwing.L.L_max max(int max_)
max_ - 最大値public static otsu.hiSwing.L.L_min min(int min_)
min_ - 最小値public static otsu.hiSwing.L.L_location location(int x_,
                                                 int y_)
L.freePanel()での要素位置をx,yで与えます。
通常L.size()でサイズも与える必要があることに注意してください。
配置例はL.freePanelを参照してください。
x_ - x位置(横位置)y_ - y位置(縦位置)public static otsu.hiSwing.L.L_location location(Point point_)
L.freePanel()での要素位置をPointで与えます。
通常L.size()でサイズも与える必要があることに注意してください。
配置例はL.freePanelを参照してください。
point_ - 位置(Point.x,Point.y)public static otsu.hiSwing.L.L_location location(L.align align_)
L.freePanel()での要素位置をL.alignで与えます。
通常L.size()でサイズも与える必要があることに注意してください。
配置例はL.freePanelを参照してください。
align_ - 整列属性public static otsu.hiSwing.L.L_command command(String text_)
ボタンなどActionEventを発行する要素のActionCommandを 設定します。通常は表示文字がそのままActionCommandに なっています。
text_ - 要素に付加するtext_public static JButton button(String name_, Object... attrs_)
JButtonを生成し、属性を付加します。
    L.button("開始",L.size(50,20),L.bgColor("yellow"),myListener);
 は
    L.set(new JButton("開始"),L.size(50,20),L.bgColor("yellow"),myListener);
 と同じです。さらに分解すると
    JButton    btn = new JButton("開始");
    Dimension size= new Dimension(50,20));
    btn.setPreferredSize(size);
    btn.setMaximumSize(size);
    btn.setMargin(new Insets(0,0,0,0));
    btn.setBackground(new Color(0xffff00));
    btn.setActionListener(myListener);
 の処理となります。
name_ - ボタントップattrs_ - 属性public static JRadioButton radioButton(String name_, Object... attrs_)
JRadioButtonを生成し、属性を付加します。
グループを表すButtonGroupを属性として
セットする必要があります。
ButtonGroupの派生として選択されているボタンを取得する機能を付加した
hiButtonGroupクラスも用意されています。
属性としてtrueを与えるとそのボタンがグループの中での初期選択状態となります。
   ButtonGroup grp=new hiButtonGroup();
   //...
      L.radioButton("選択1",grp)
      L.radioButton("選択2",grp,true)
      L.radioButton("選択3",grp)
name_ - 表示attrs_ - 属性public static JCheckBox checkBox(String name_, Object... attrs_)
JCheckBoxを生成し、属性を付加します。
属性としてtrueを与えるとそのボタンがグループの中での初期選択状態となります。
name_ - 表示attrs_ - 属性public static JComboBox comboBox(Object... attrs_)
JComboBoxを生成し、属性を付加します。
JAVA1.7では属性付きコンボボックスJComboBox<String>が用意されますが
JAVA1.6ではエラーとなるため採用しません。
属性として文字列またはArrayList<String>を与えることができます。
項目となります。
L.select(int)で選択index属性(0オリジン)を与えると
初期選択状態となります。
例えば次のように項目と初期選択状態(項目2選択)を与えることができます。
   // 後でアクセスするためJComboBox cb;があるとして
   cb=L.comboBox("項目1","項目2","項目3","項目4",L.select(1))
hiSwing.setItems()を
用いて後から項目をセットすることもできます。
attrs_ - 属性public static JTextField textField(Object... attrs_)
attrs_ - 属性public static JTextArea textArea(Object... attrs_)
attrs_ - 属性public static JTextPane textPane(Object... attrs_)
TextPaneを生成します。
デフォルトでcaret.setVisible(true)が呼ばれます。
引数にfalseを指定するとcaret.setVisible(false)が呼ばれます。
attrs_ - 属性public static JLabel label(Object... attrs_)
通常、パネルの要素としては文字列を書けばラベルとなります。
ラベルを変数に代入して後で使う必要がある場合このメソッドを用います。
   // JLabel変数lbがあるとして
   hPanel(
      "ラベル-1",  // この表記でもJLabelが生成されるがJLabel変数には代入できない
      lb=L.label("ラベル-2") //JLabel変数に代入
      )
属性として文字列が複数与えられる場合、先頭の文字列が採用されます。
attrs_ - 属性public static hiListPanel listPanel(Object... attrs_)
attrs_ - 属性public static JProgressBar progressBar(Object... attrs_)
attrs_ - 属性public static JEditorPane editorPane(Object... attrs_)
attrs_ - 属性public static JEditorPane htmlPane(Object... attrs_)
setContentType("text/html")を作用させたEditorPaneを返します。
attrs_ - 属性public static Component gap(int width_, int height_)
xPanel()での要素間の固定サイズの隙間となります。
次の操作と同等です。
Box.createRigidArea(new Dimension(width_,height_));
width_ - 幅height_ - 高さpublic static otsu.hiSwing.L.L_gap gap(int size_)
xPanel()での要素間の固定サイズの隙間となります。
hPanelの場合次の操作と同等です。
Box.createRigidArea(new Dimension(size_,0));
hPanelの場合次の操作と同等です。
Box.createRigidArea(new Dimension(0,size_));
vPanelの場合次の操作と同等です。
Box.createRigidArea(new Dimension(size_,0));
その他のPanelの場合次の操作と同等です。
Box.createRigidArea(new Dimension(size_,size_));
size_ - 幅および高さpublic static otsu.hiSwing.L.L_gap gap()
xPanel()での要素間の自動増減サイズの隙間となります。
hPanelの場合次の操作と同等です。
Box.createRigidArea();
hPanelの場合次の操作と同等です。
Box.createHorizontalGlue();
vPanelの場合次の操作と同等です。
Box.createVerticalGlue();
その他のPanelの場合次の操作と同等です。
Box.createGlue();
public static Color color(String colorName_)
colorName_ - 色名hiSwing.color(String)public static Color color(int ARGB_)
ARGB_ - 色指定データ(0xRRGGBBまたは0xAARRGGBB)hiSwing.color(int)public static void set(JFrame frame_, Object... objs_)
JFrameに要素と属性をセットします。
セットできる要素はJMenuBarと各種画面要素、開始通知先です。
開始通知先はActionListenerで画面構成後、
sourceがJFrame、commandStringが"##START##"であるActionEvent
が通知されます。
要素は通常必要構成をとったJPanelです。
属性は文字列で与えます。キー:値となっている属性は:の前後に空白があってはなりません。
いずれもJFrame(あるいはそのベースクラス)のメソッド呼び出しとなります。
省略時は当該操作は実施しません。
| キー | 値 | 説明 | 
| title: | タイトル文字列 | フレームのタイトル文字列を指定します frame_. setTitle("タイトル文字列")呼び出しとなります。
  例) "title:単純ファイルビューワー" | 
| quit: | 終了確認文字列 | 画面右上の閉じるボタン[×]が押された時に終了するかどうかの確認ダイアログを出します。 frame_. setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);frame_. addWindowListener(L.closing(frame_,"終了確認文字列"));例 "quit:終了しますか?" | 
| pos: | x位置,y位置 | フレームの表示位置を指定します。 frame_. setLocation(x位置,y位置);例 "pos:200,100" | 
| size: | 幅,高さ | フレームのサイズを指定します。 frame_. setSize(幅,高さ);例 "pos:200,100" | 
| pack | 内部要素によってフレームのサイズを決定します frame_. pack();例 "pack" 内部要素の構築後に行います。 | |
| visible | フレームを表示します frame_. setVisible(true);例 "visible" 引数のどの位置に置いても、他の引数を処理した後に実施します。 | 
例えば次のようなコードで画面を出すことができます。
import otsu.hiSwing.*;
import javax.swing.*;
public class Test {
   public static void main(final String[] args_){
      SwingUtilities.invokeLater(()-<{start(args_);});
      }
   static void start(String[] args_){
      JFrame    frame=new JFrame();
      L.set(frame,"title:Frame試験","pack","visible","quit:終了しますか?",
         L.hPanel(
            "Hello hiSwing world!",
            L.gap(30),
            L.button("終了",L.closing(frame,"終了しますか?"))
            )
         );
      }
   }
 
frame_ - フレームobjs_ - 要素およびフレーム属性public static hiGraphicPanel graphicPanel(Object... objects_)
hiGraphicPanelを生成します。
hiGraphicPanelは自由配置パネルともなっていますです。
L.size()とL.location()
属性を持つ要素を並べることにより、グラフィックを背景にして要素が
並びます。
要素として文字列を置くと、ファイル名と解釈され読み込みます。
リサイズされた時の振舞はL.image_size属性により異なります。
| 属性 | 振舞 | 
| L.image_size.fit | 省略可(デフォルトです)。
縦横比を保ったまま、画面に収まるように表示を拡大/縮小します。 比率により、上下または左右に隙間が表示される場合があります。 imageおよびg2dの論理空間サイズはそのままです。 | 
| L.image_size.fix | 画面サイズとは関係なく論理空間サイズで表示します。 画像の一部が表示、あるいは回りに隙間が表示されることがあります。 | 
| L.image_size.reset | 画像を廃棄し、論理空間サイズを表示サイズに揃えます。 画像ファイルから表示させる場合はこの指定はしないでください。 | 
例えば次の図は写真を出した上にランダムに図形を重ねています。ウィンドウを 小さくすると(右の図)それに応じてイメージ、図形とも小さく表示されています。
 
プログラムは次のようになっています(詳細説明は省いてあります)
[an error occurred while processing this directive]
import otsu.hiSwing.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.util.*;
public class Test implements ActionListener{
   hiGraphicPanel    gp;
   JComboBox<String> cb_file;
   JButton           bt_draw;
   Random            random = new Random();
   @Override // ActionListener
   public void actionPerformed(ActionEvent ev_){
      try{
         if( ev_.getSource()==cb_file ){ // 画像読み込み
            gp.readImage(cb_file.getItemAt(cb_file.getSelectedIndex()));
            }
         else if( ev_.getSource()==bt_draw ){ // グラフィック上書き
            Graphics2D _g2d   =gp.hiGraphicPanel.getGraphics2D();// グラフィック取得
            int        _width =gp.hiGraphicPanel.getImageWidth();// イメージの論理幅
            int        _height=gp.hiGraphicPanel.getImageHeight();// イメージの論理幅
            for(int _n=0;_n<5;++_n){
               _g2d.setColor(new Color(random.nextInt(0xFFFFFF)));
               _g2d.fillArc(random.nextInt(_width)  ,random.nextInt(_height),
                            random.nextInt(_width/5),random.nextInt(_height/5),
                            0,360);
               }
            hiSwing.repaint(gp);
            }
         }
      catch(Exception _ex){
         _ex.printStackTrace(hiU.err);
         }
      }
   public static void main(final String[] args_){
      SwingUtilities.invokeLater(()-<{start(args_);});
      }
   static void start(String[] args_){
      String[] _files={"./bee_1.gif","./hato.jpg","./ume_5.png"};
      Test     _test =new Test();
      JFrame   _frame=new JFrame();
      L.set(_frame,"title:イメージ試験","pack","visible","quit:終了しますか?",
         L.vPanel(
            L.hPanel(L.size(400,22), 
               _test.cb_file=L.comboBox(_files,L.size(200.0,20),_test), L.gap(5),
               _test.bt_draw=L.button("描画",_test),L.gap(),
               L.button("終了",L.closing(_frame,"終了しますか"))
               ),
            _test.gp=L.graphicPanel(_files[0],L.size(400,300),L.bgColor("black"))
            )
         );
      }
   }
objects_ - 要素public static JSeparator separator(Object... attrs_)
attrs_ - 属性public static JSeparator separator()