jp.hishidama.swing.util
クラス ComponentUtil

java.lang.Object
  上位を拡張 jp.hishidama.swing.util.ComponentUtil

public class ComponentUtil
extends Object

Componentユーティリティー.

使用例

導入されたバージョン:
2007.02.25
作成者:
ひしだま

コンストラクタの概要
ComponentUtil()
           
 
メソッドの概要
static Dimension calcComponentSizeFromText(JComponent comp)
          コンポーネントサイズ計算.
static Dimension calcComponentSizeFromText(JComponent comp, String text)
          コンポーネントサイズ計算.
static Dimension getStringSize(Component comp, String text)
          文字列サイズ取得.
static void resizeComponentFromText(JComponent comp)
          コンポーネントサイズ変更.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

ComponentUtil

public ComponentUtil()
メソッドの詳細

resizeComponentFromText

public static void resizeComponentFromText(JComponent comp)
コンポーネントサイズ変更.

コンポーネント内に格納されている文字列(getText()で取得)を内包できる大きさになるよう コンポーネントのサイズを変更する。

パラメータ:
comp - コンポーネント
関連項目:
calcComponentSizeFromText(JComponent)

calcComponentSizeFromText

public static Dimension calcComponentSizeFromText(JComponent comp)
コンポーネントサイズ計算.

コンポーネント内に格納されている文字列(getText()で取得)を内包できるコンポーネントの大きさを返す。

パラメータ:
comp - コンポーネント
戻り値:
サイズ
例外:
RuntimeException - getText()が存在しない場合等
関連項目:
calcComponentSizeFromText(JComponent, String)

calcComponentSizeFromText

public static Dimension calcComponentSizeFromText(JComponent comp,
                                                  String text)
コンポーネントサイズ計算.

文字列を内包できるコンポーネントの大きさを返す。

パラメータ:
comp - コンポーネント
text - 文字列
戻り値:
サイズ
関連項目:
getStringSize(Component, String)

getStringSize

public static Dimension getStringSize(Component comp,
                                      String text)
文字列サイズ取得.

コンポーネント内のフォントを使用した 文字列のサイズを返す。

パラメータ:
comp - コンポーネント
text - 文字列
戻り値:
サイズ