JavaTM 2 Platform
Std. Ed. v1.3

java.awt
クラス GraphicsDevice

java.lang.Object
  |
  +--java.awt.GraphicsDevice

public abstract class GraphicsDevice
extends Object

GraphicsDevice クラスは、特定のグラフィックス環境で利用可能なグラフィックスデバイスを記述します。こうしたデバイスには、画面デバイスとプリンタデバイスがあります。GraphicsEnvironment のインスタンスに、多数の画面とプリンタがある場合があります。各グラフィックスデバイスは、それに関連した 1 つ以上の GraphicsConfiguration オブジェクトを持ちます。これらのオブジェクトは、GraphicsDevice を使用できるさまざまな構成を指定します。

マルチスクリーン環境では、GraphicsConfiguration オブジェクトを使って複数の画面にコンポーネントを描画できます。次のコードサンプルは、GraphicsEnvironment の各画面デバイスで、GraphicsConfiguration ごとに JFrame オブジェクトを生成する方法を示したものです。

   GraphicsEnvironment ge = GraphicsEnvironment.
   getLocalGraphicsEnvironment();
   GraphicsDevice[] gs = ge.getScreenDevices();
   for (int j = 0; j < gs.length; j++) { 
      GraphicsDevice gd = gs[j];
      GraphicsConfiguration[] gc =
 	gd.getConfigurations();
      for (int i=0; i < gc.length; i++) {
         JFrame f = new
         JFrame(gs[j].getDefaultConfiguration());
         Canvas c = new Canvas(gc[i]); 
         Rectangle gcBounds = gc[i].getBounds();
         int xoffs = gcBounds.x;
         int yoffs = gcBounds.y;
	   f.getContentPane().add(c);
	   f.setLocation((i*50)+xoffs, (i*60)+yoffs);
         f.show();
      }
   }

関連項目:
GraphicsEnvironment, GraphicsConfiguration

フィールドの概要
static int TYPE_IMAGE_BUFFER
          デバイスはイメージバッファです。
static int TYPE_PRINTER
          デバイスはプリンタです。
static int TYPE_RASTER_SCREEN
          デバイスはラスタ画面です。
 
コンストラクタの概要
protected GraphicsDevice()
          インスタンスを直接生成できない抽象クラスです。
 
メソッドの概要
 GraphicsConfiguration getBestConfiguration(GraphicsConfigTemplate gct)
          GraphicsConfigTemplate で定義されている基準を渡すことのできる最適な構成を返します。
abstract  GraphicsConfiguration[] getConfigurations()
          この GraphicsDevice に関連したすべての GraphicsConfiguration オブジェクトを返します。
abstract  GraphicsConfiguration getDefaultConfiguration()
          この GraphicsDevice に関連したデフォルトの GraphicsConfiguration を返します。
abstract  String getIDstring()
          この GraphicsDevice に関連した ID 文字列を返します。
abstract  int getType()
          この GraphicsDevice のタイプを返します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

TYPE_RASTER_SCREEN

public static final int TYPE_RASTER_SCREEN
デバイスはラスタ画面です。

TYPE_PRINTER

public static final int TYPE_PRINTER
デバイスはプリンタです。

TYPE_IMAGE_BUFFER

public static final int TYPE_IMAGE_BUFFER
デバイスはイメージバッファです。このバッファはデバイスまたはシステムメモリに格納されますが、ユーザが物理的に表示することはできません。
コンストラクタの詳細

GraphicsDevice

protected GraphicsDevice()
インスタンスを直接生成できない抽象クラスです。インスタンスは、適切なファクトリメソッドやクエリーメソッドから取得できます。
関連項目:
GraphicsEnvironment.getScreenDevices(), GraphicsEnvironment.getDefaultScreenDevice(), GraphicsConfiguration.getDevice()
メソッドの詳細

getType

public abstract int getType()
この GraphicsDevice のタイプを返します。
戻り値:
この GraphicsDevice のタイプ。TYPE_RASTER_SCREEN、TYPE_PRINTER、または TYPE_IMAGE_BUFFER
関連項目:
TYPE_RASTER_SCREEN, TYPE_PRINTER, TYPE_IMAGE_BUFFER

getIDstring

public abstract String getIDstring()
この GraphicsDevice に関連した ID 文字列を返します。
戻り値:
この GraphicsDevice の ID を表す String

getConfigurations

public abstract GraphicsConfiguration[] getConfigurations()
この GraphicsDevice に関連したすべての GraphicsConfiguration オブジェクトを返します。
戻り値:
この GraphicsDevice に関連している GraphicsConfiguration オブジェクトの配列

getDefaultConfiguration

public abstract GraphicsConfiguration getDefaultConfiguration()
この GraphicsDevice に関連したデフォルトの GraphicsConfiguration を返します。
戻り値:
この GraphicsDevice のデフォルトの GraphicsConfiguration

getBestConfiguration

public GraphicsConfiguration getBestConfiguration(GraphicsConfigTemplate gct)
GraphicsConfigTemplate で定義されている基準を渡すことのできる最適な構成を返します。
パラメータ:
gct - 有効な GraphicsConfiguration を取得するために使用される GraphicsConfigTemplate オブジェクト
戻り値:
指定された GraphicsConfigTemplate で定義されている基準を渡すことのできる GraphicsConfiguration
関連項目:
GraphicsConfigTemplate

JavaTM 2 Platform
Std. Ed. v1.3

バグや機能要求の報告
さらに詳しい API リファレンスおよび開発者ドキュメントについては、 Java 2 SDK SE Developer Documentation を参照してください。このドキュメントには、概念、用語の定義、回避策、 実用的なコード例など、開発者を対象にした詳細な解説が掲載されています。

Java、Java 2D、JDBC は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.