2017-10-04 10 views
0

SWT 쉘을 열어 여러 개의 모니터에 걸쳐 있어야합니다.SWT가 여러 모니터를 연결하는 쉘 크기를 설정했습니다.

그래서 shell.setLocation(x, y) 셸을 열려면 지정된 위치에 shell.setSize(width, height) 치수를 설정하십시오.

하나의 모니터 (예 : 두 모니터의 경우 3840)보다 큰 너비를 사용하는 경우 어떻게 든 셸이 정확하게 하나의 모니터 (1920 년)에 맞도록 조정됩니다.

Windows 및 Linux에서 발생합니다.

최소 예 : 나를

public class ShellSample { 
    public static void main(final String[] args) { 
     final Display display = new Display(); 
     final Shell shell = new Shell(display, SWT.NO_TRIM); 
     final Window win = new ApplicationWindow(shell) { 
      @Override 
      protected void configureShell(final Shell shell) { 
       shell.setLocation(0, 0); 
       shell.setSize(3840, 100); 
      } 
     }; 
     win.open(); 
     while (!shell.isDisposed()) { 
      if (!display.readAndDispatch()) { 
       display.sleep(); 
      } 
     } 
     shell.dispose(); 
     display.dispose(); 
    } 
} 
+1

이 문제를 보여줍니다 [MCVE] (https://stackoverflow.com/help/mcve)를 게시하시기 바랍니다 ... constrainShellSize 메소드를 오버라이드 (override)하는 것이었다. – Baz

+1

@Baz 감사합니다 - MCVE 코딩은 문제가 SWT와 전혀 관련이 없다는 것을 보여주었습니다. E4 애플리케이션을 코딩하면 아마 흑 마술이 일어날 것입니다 ... – leftbit

답변

0

바보.

실제로 SWT 셸의 크기를 조정하지 않고 JFace 창 크기를 조정하고있었습니다.

그래서 해결책은