JavaTM Platform
Standard Ed. 6

javax.swing
클래스 LayoutStyle

java.lang.Object 
  상위를 확장 javax.swing.LayoutStyle


public abstract class LayoutStyle
extends Object

LayoutStyle 는, 컴퍼넌트의 배치에 관한 정보를 제공합니다. 이 클래스는, 주로 비주얼 툴과 레이아웃 매니저로 사용됩니다. 대부분의 경우, 개발자가 이 클래스를 사용할 필요는 없습니다.

일반적으로,LayoutStyle 의 설정이나 작성은 실시하지 않습니다. 대신에, static 메소드 getInstance 를 사용해 현재의 인스턴스를 가져옵니다.

도입된 버젼:
1.6

상자의 클래스의 개요
static class LayoutStyle.ComponentPlacement
          ComponentPlacement 는, 2 개의 컴퍼넌트를 서로 관련지어 배치하는 경우에 사용할 수 있는 방법의 열거입니다.
 
생성자 의 개요
LayoutStyle ()
          새로운 LayoutStyle 를 작성합니다.
 
메소드의 개요
abstract  int getContainerGap (JComponent  component, int position, Container  parent)
          컴퍼넌트로부터 그 부모의 지정된 구석까지의 스페이스의 양을 돌려줍니다.
static LayoutStyle getInstance ()
          LayoutStyle 의 공유 인스턴스를 돌려줍니다.
abstract  int getPreferredGap (JComponent  component1, JComponent  component2, LayoutStyle.ComponentPlacement  type, int position, Container  parent)
          2 개의 컴퍼넌트간의 스페이스의 양을 돌려줍니다.
static void setInstance (LayoutStyle  style)
          LayoutStyle 의 공유 인스턴스를 설정합니다.
 
클래스 java.lang. Object 로부터 상속된 메소드
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
 

생성자 의 상세

LayoutStyle

public LayoutStyle()
새로운 LayoutStyle 를 작성합니다. 일반적으로,LayoutStyle 는 작성하지 않습니다. 대신에,getInstance 메소드를 사용해 현재의 LayoutStyle 를 가져옵니다.

메소드의 상세

setInstance

public static void setInstance(LayoutStyle  style)
LayoutStyle 의 공유 인스턴스를 설정합니다. null 를 지정하면(자), 현재의 LookAndFeelLayoutStyle 가 사용됩니다.

파라미터:
style - LayoutStyle 또는 null
관련 항목:
getInstance()

getInstance

public static LayoutStyle  getInstance()
LayoutStyle 의 공유 인스턴스를 돌려줍니다. setInstance 로 인스턴스가 지정되어 있지 않은 경우는, 현재의 LookAndFeelLayoutStyle 가 돌려주어집니다.

반환값:
LayoutStyle 의 공유 인스턴스
관련 항목:
LookAndFeel.getLayoutStyle()

getPreferredGap

public abstract int getPreferredGap(JComponent  component1,
                                    JComponent  component2,
                                    LayoutStyle.ComponentPlacement  type,
                                    int position,
                                    Container  parent)
2 개의 컴퍼넌트간의 스페이스의 양을 돌려줍니다. 반환값은,component1 를 기준으로 한 component2 의 배치 거리를 나타냅니다. 예를 들어, 다음의 코드는,component2component1 의 윗쪽에 배치할 때의 component2component1 의 사이의 거리를 돌려줍니다.
   int gap = getPreferredGap(component1, component2,
                             ComponentPlacement.RELATED,
                             SwingConstants.NORTH, parent);
 
type 파라미터는, 2 개의 컴퍼넌트의 관계를 나타냅니다. 2 개의 컴퍼넌트가 같은 부모를 가져, 논리적으로 관련성이 있는 자주(잘) 닮은 항목을 표시하고 있는 경우,RELATED 를 사용합니다. 2 개의 컴퍼넌트의 부모가 같아도, 논리적으로 관련성이 없는 항목을 표시하고 있는 경우는,UNRELATED 를 사용합니다. RELATED 타입과 UNRELATED 타입의 Look & Feel 의 차이를 구별할 수 없는 경우도 있습니다.

반환값에서는,component2 또는 component1 의 현재의 사이즈와 위치가 고려되지 않습니다. 반환값으로, 컴퍼넌트의 다양한 프로퍼티이 고려되는 일이 있습니다. 예를 들어, 스페이스는, font size나 컴퍼넌트의 적절한 사이즈에 따라서 다를 가능성이 있습니다.

파라미터:
component1 - component2 를 배치할 때 기준으로 한다 JComponent
component2 - 배치되는 JComponent
position - component1 를 기준으로 했다 component2 의 배치 위치. SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST, 또는 SwingConstants.WEST
type - 2 개의 컴퍼넌트의 배치 방법
parent - component2 의 부모. 실제의 부모와는 다를 가능성이 있다. 또,null 의 가능성도 있다
반환값:
2 개의 컴퍼넌트간의 스페이스의 양
예외:
NullPointerException - component1, component2, 또는 typenull
IllegalArgumentException - position 가 다음의 머지않아도 아닌 경우. SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST, 또는 SwingConstants.WEST
도입된 버젼:
1.6
관련 항목:
LookAndFeel.getLayoutStyle()

getContainerGap

public abstract int getContainerGap(JComponent  component,
                                    int position,
                                    Container  parent)
컴퍼넌트로부터 그 부모의 지정된 구석까지의 스페이스의 양을 돌려줍니다.

파라미터:
component - 배치되는 JComponent
position - 부모를 기준으로 한 component 의 배치 위치. SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST, 또는 SwingConstants.WEST
parent - component 의 부모. 실제의 부모와는 다를 가능성이 있다. 또,null 의 가능성도 있다
반환값:
컴퍼넌트로부터 지정의 구석까지의 스페이스의 양
예외:
IllegalArgumentException - position 가 다음의 머지않아도 아닌 경우. SwingConstants.NORTH, SwingConstants.SOUTH, SwingConstants.EAST, 또는 SwingConstants.WEST

JavaTM Platform
Standard Ed. 6

버그의 보고와 기능의 요청
한층 더 자세한 API 레퍼런스 및 개발자 문서에 대해서는,Java SE 개발자용 문서를 참조해 주세요. 개발자전용의 상세한 해설, 개념의 개요, 용어의 정의, 버그의 회피책, 및 코드 실례가 포함되어 있습니다.

Copyright 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy 도 참조해 주세요.