001/* 002 * Created on 14.12.2009 003 * 004*/ 005// package org.jdesktop.swingxset; 006package ca.bc.webarts.widgets.treetable; 007 008import java.awt.im.InputContext; 009 010import org.jdesktop.swingx.JXFrame; 011import org.jdesktop.swingx.event.AbstractInputEventDispatcher; 012import org.jdesktop.swingx.event.DispatchingInputContext; 013import org.jdesktop.swingx.event.InputEventDispatcher; 014 015/** 016 * JXFrame with support for custom InputEventDispatcher which will receive 017 * all Input- and FocusEvents for all components in the container hierarchy below 018 * the frame. <p> 019 * 020 * @see InputEventDispatcher 021 * @see AbstractInputEventDispatcher 022 */ 023public class JXDemoFrame extends JXFrame 024{ 025 026 public JXDemoFrame() 027 { 028 super(); 029 } 030 031 // ---------------- hook for InputEventDispatcher 032 033 private DispatchingInputContext dispatchingContext; 034 035 // <snip> Input-/FocusEvent notification 036 // access event dispatcher 037 public InputEventDispatcher getInputEventDispatcher() 038 { 039 return getDispatchingInputContext().getInputEventDispatcher(); 040 } 041 042 public void setInputEventDispatcher( InputEventDispatcher dispatcher ) 043 { 044 getDispatchingInputContext().setInputEventDispatcher( dispatcher ); 045 } 046 // </snip> 047 048 @Override 049 public InputContext getInputContext() 050 { 051 return getDispatchingInputContext().getInputContext( super.getInputContext() ); 052 } 053 054 /** 055 * @return the dispatchingContext 056 */ 057 private DispatchingInputContext getDispatchingInputContext() 058 { 059 if ( dispatchingContext == null ) 060 { 061 dispatchingContext = new DispatchingInputContext(); 062 } 063 return dispatchingContext; 064 } 065 066} 067