• title: JDK 7 author: aterai pubdate: 2012-06-29 description: Java SE 7 で追加されたSwing関係のクラスドキュメントを翻訳。

概要

Java SE 7 APIの日本語ドキュメントがない時期に作成したSwing関係のAPIの翻訳メモです。

  • 現在はJava SE 8の日本語ドキュメント(9は機械翻訳版?)も存在するので、すでに不要

クラス

JLayer

  • JLayer is a universal decorator for Swing components which enables you to implement various advanced painting effects as well as receive notifications of all AWTEvents generated within its borders.
  • JLayerは、Swingコンポーネントのための普遍的なデコレータであり、様々な高度なペイント効果を実装するだけでなく、その境界内に生成されたすべてのAWTEventsの通知を受け取ることができます。
  • JLayer delegates the handling of painting and input events to a LayerUI object, which performs the actual decoration.
  • JLayerは描画と入力イベントの処理をLayerUIオブジェクトに移譲し、そしてそれが実際の装飾を実行します。
  • The custom painting implemented in the LayerUI and events notification work for the JLayer itself and all its subcomponents.
  • LayerUIで実装されるカスタム描画とイベント通知は、JLayer自体とそのすべての下位コンポーネントのために働きます。
  • This combination enables you to enrich existing components by adding new advanced functionality such as temporary locking of a hierarchy, data tips for compound components, enhanced mouse scrolling etc and so on.
  • この組み合わせは、新しい先進的な機能、例えば階層の一時ロックや、複合コンポーネント用のデータヒント、強化されたマウスのスクロールなどを、既存のコンポーネントに追加して豊かにすることができます。
  • JLayer is a good solution if you only need to do custom painting over compound component or catch input events from its subcomponents.
  • 複合コンポーネント上にカスタム描画を行ったり、そのサブコンポーネントからの入力イベントをキャッチする必要があるだけなら、JLayerは良いソリューションです。
  • Note: JLayer doesn't support the following methods:
  • 注: JLayerは、以下のメソッドをサポートしません:
  • using any of of them will cause UnsupportedOperationException to be thrown, to add a component to JLayer use setView(Component) or setGlassPane(JPanel).
    • typo: any of of them
  • それらを使用すると、UnsupportedOperationExceptionが発生します。JLayerにコンポーネントを追加する場合は setView(Component) か setGlassPane(JPanel) を使用します。

LayerUI

  • The base class for all JLayer's UI delegates.
  • すべてのJLayerのUI委譲の基本クラスです。
  • paint(java.awt.Graphics, javax.swing.JComponent) method performs the painting of the JLayer and eventDispatched(AWTEvent, JLayer) method is notified about any AWTEvents which have been generated by a JLayer or any of its subcomponents.
  • paint(java.awt.Graphics, javax.swing.JComponent)メソッドは、JLayerの描画を実行し、eventDispatched(AWTEvent, JLayer)メソッドは、JLayer、またはそのサブコンポーネントによって生成された任意のAWTEventsの通知を受け取ります。
  • The LayerUI differs from the UI delegates of the other components, because it is LookAndFeel independent and is not updated by default when the system LookAndFeel is changed.
  • LayerUIは、他のコンポーネントのUI委譲とは異なり、LookAndFeelから独立であり、システムのLook&Feelが変更されてもデフォルトでは更新されません。
  • The subclasses of LayerUI can either be stateless and shareable by multiple JLayers or not shareable.
  • LayerUIのサブクラスをステートレスにして複数JLayersで共有することも可能ですが、共有しなくても構いません。

SecondaryLoop

  • A helper interface to run the nested event loop.
  • 入れ子になったイベントループを実行するヘルパーインタフェースです。
  • Objects that implement this interface are created with the EventQueue.createSecondaryLoop() method.
  • このインタフェースを実装するオブジェクトは、EventQueue.createSecondaryLoop()メソッドを使用して作成されます。
  • The interface provides two methods, enter() and exit(), which can be used to start and stop the event loop.
  • このインタフェースは、enter() と exit() の2つのメソッドを提供し、イベントループを起動、停止するために使用することができます。
  • When the enter() method is called, the current thread is blocked until the loop is terminated by the exit() method.
  • enter() メソッドが呼び出されると、ループが exit() メソッドによって終了されるまで現在のスレッドはブロックされます。
  • Also, a new event loop is started on the event dispatch thread, which may or may not be the current thread.
  • また、新しいイベントループがイベントディスパッチスレッド上で開始されます(それがカレントスレッドかどうかは不明)。
  • The loop can be terminated on any thread by calling its exit() method.
  • ループは、exit() メソッドを呼び出すことによって、任意のスレッド上から終了することができます。
  • After the loop is terminated, the SecondaryLoop object can be reused to run a new nested event loop.
  • ループが終了した後、SecondaryLoop オブジェクトは新しい入れ子になったイベントループを実行するために再利用することが可能です。
  • A typical use case of applying this interface is AWT and Swing modal dialogs.
  • このインタフェースの典型的な使用例は、AWTとSwingのモーダルダイアログです。
  • When a modal dialog is shown on the event dispatch thread, it enters a new secondary loop.
  • モーダルダイアログがイベントディスパッチスレッド上で表示されたら、それは新しい二次ループに入ります。
  • Later, when the dialog is hidden or disposed, it exits the loop, and the thread continues its execution.
  • その後、ダイアログが非表示または破棄されると、ループを終了し、スレッドは実行を継続します。
  • The following example illustrates a simple use case of secondary loops:
  • 以下の例は、第二のループの単純な使用例を示しています:

StrokeBorder

  • A class which implements a border of an arbitrary stroke.
  • 任意のストロークのボーダーを実装するクラスです。

メソッド

SwingUtilities.getUnwrappedView(JViewport)

  • SwingUtilities.getUnwrappedView(JViewport)
    • the first JViewport's descendant which is not an instance of JLayer. If such a descendant can not be found, null is returned.
  • SwingUtilities.getUnwrappedView(JViewport)
    • JLayer のインスタンスではない、JViewport の最初の子孫。そのような子孫が見つかった場合は、null を返します。
  • 修正案
    • JLayer のインスタンスではない、JViewport の最初の子孫。そのような子孫が見つからない場合は、null を返します。
  • メモ
    • 8でも誤翻訳されたままになっている

コメント