반응형
investorTree.addListener(SWT.Collapse, new Listener(){ @Override public void handleEvent(Event e) { expandAndResize(false, (TreeItem) e.item); } }); investorTree.addListener(SWT.Expand, new Listener() { @Override public void handleEvent(Event event) { expandAndResize(false, (TreeItem) event.item); } }); private static void expandAndResize(Boolean expand_, TreeItem item_) { System.out.println( (expand_?"Expanding":"Collapsing") + "item={" + item_ + "}"); item_.setExpanded(expand_); System.out.println(" Resizing columns"); resizeTree(item_.getParent()); } private static void resizeTree(Tree tree_) { for (TreeColumn tc: tree_.getColumns()) resizeTreeColumn(tc); } private static void resizeTreeColumn(TreeColumn treeColumn_) { treeColumn_.pack(); }
반응형
'IT > JAVA & Eclipse' 카테고리의 다른 글
[Design Pattern] 콜백(Callback) 패턴 (0) | 2017.09.27 |
---|---|
[Design Pattern] Balking 패턴 (0) | 2017.09.22 |
Eclipse 아이콘들 쉽게 재활용하기 (0) | 2017.09.08 |
윈도우에서 경로를 toURI()로 호출할 경우 exception 발생 (0) | 2015.10.07 |
Eclipse Preference에 값 저장하기 (0) | 2015.09.17 |