제목에서 알 수 있듯이 최대화 및 최소화를 감지하기 위해 rcp 사용자 인터페이스에 리스너를 추가하려고합니다. 사실, 그건 내 진짜 목적은 아니지만 내 문제를 해결하는 방법이라고 생각합니다. 나는 가운데에 몇 가지 도형이있는 뷰를 가지고 있고 창 크기를 조정하더라도 드로잉을 정확히 중앙에 유지합니다.프로그래밍 방식으로 창 최대화/최소화 감지 ??? Eclipse RCP
public void createPartControl(final Composite parent) {
display = parent.getDisplay();
white= display.getSystemColor(SWT.COLOR_WHITE);
parent.setLayout(new FillLayout(SWT.VERTICAL));
final ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
sc.setMinHeight(100);
sc.setMinWidth(100);
sc.setSize(565, 305);
final Composite child = new Composite(sc,SWT.NONE);
child.setLayout(new FillLayout());
// Set child as the scrolled content of the ScrolledComposite
sc.setContent(child);
child.setBackground(white);
gc = new GC(child);
parent.addListener (SWT.Resize, new Listener() {
public void handleEvent (Event e) {
x = child.getBounds().width/2;
y = child.getBounds().height/2;
child.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent event) {
dessin(gc); // draw my shapes
}
});
}
모든 나는 내가 (이 코너에) 그리기를 풀어이 경우 창을 최대화하고이를 최소화하는 경우를 제외하고 잘 어울리는 이렇게하려면, 나는 다음과 같은 수신기를 사용했다. 아무쪼록 바랍니다. 나는 올바른 생각을하고 있니?
예제에서 중요한 코드가 누락 된 것 같습니다. 하지만 ... 크기 조정 이벤트가 부모에게 표시되면 자식을 크기 조정할 필요가 없습니다. –
오, 네 말이 맞아. 부모가 아닌 자식에게 청취자를 추가해야 해. 고마워. – jean24