2014-11-20 1 views
1

저는 JFace/SWT에서 GUI 프로그래밍을 처음 시작했습니다. 정상적인 SWT 창 (http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.wb.ercp.doc.user%2Fhtml%2Fwizards%2FeRCP%2Fapplication_window.html)으로 작업하기 전에 오늘 JFace Application Window를 처음 시도했습니다.JFace 응용 프로그램 창의 최소 크기

는 지금은 ..이 윈도우의 최소 크기를 설정할 SWT 그것은

shell.setMinimumSize(100,100) 

로하지만 내 org.eclipse.jface.window.ApplicationWindow 그러한 방법이 없다 ..

을에서 근무

내가

this.createShell().setMinimumSize(100, 100); 

을 시도했습니다 (내 구현은 "공용 클래스 MAINVIEW은 ApplicationWindow를 {확장")

하지만 작동하지 않습니다.

this.getShell() 

을 반환합니다.

그런데 JFace에 대한 훌륭한 문서를 찾기 위해 지금은 특히 Application Window를 찾고 있습니다. 그러나 나는 정말 훌륭하고 광범위한 것을 발견하지 못했습니다.

SWT의 문서, 특히 JFace는 매우 분주합니다. 너무 좋은 기능이 있기 때문에 너무 나쁩니다.

귀하의 경험은 무엇입니까?

답변

2

오버라이드 configureShell 방법을 거기에 최소 크기를 설정 : 다음 코드에 createContents에게 방법을 참조하십시오

@Override 
protected void configureShell(Shell newShell) 
{ 
    super.configureShell(newShell); 

    newShell.setMinimumSize(100, 100); 
} 
0

createShell 메서드의 설명서에서 알 수 있듯이 새로운 셸을 만듭니다. 당신은 창의 기존 쉘을 사용해야합니다.

응용 프로그램의 부모 합성에서 가져올 수 있습니다.

package helloproject; 

import org.eclipse.jface.window.ApplicationWindow; 
import org.eclipse.swt.SWT; 
import org.eclipse.swt.widgets.Composite; 
import org.eclipse.swt.widgets.Control; 
import org.eclipse.swt.widgets.Display; 
import org.eclipse.swt.widgets.Label; 

public class HelloWorld extends ApplicationWindow { 

    public HelloWorld() { 
     super(null); 
    } 

    /** 
    * Runs the application 
    */ 
    public void run() { 
     setBlockOnOpen(true); 
     open(); 
     Display.getCurrent().dispose(); 
    } 

    protected Control createContents(Composite parent) { 
     // Create a Hello, World label 
     Label label = new Label(parent, SWT.CENTER); 
     label.setText("Hello, World"); 

     // Set the minimum size 
     parent.getShell().setMinimumSize(200, 200); 

     return label; 
    } 

    public static void main(String[] args) { 
     new HelloWorld().run(); 
    } 
}