So, here's the way to hook into the display/event dispatch logic: First, you need to be catching AWT window events, then on WINDOW_OPENED and WINDOW_CLOSED you need to hook your Display object into the Pivot ApplicationContext "displays" list: @Override public void processWindowEvent(WindowEvent event) {
// Call the superclass implementation. super.processWindowEvent(event); switch (event.getID()) { case WindowEvent.WINDOW_OPENED: ApplicationContext.getDisplays().add(displayObject); ... break; // The WINDOW_CLOSED event. case WindowEvent.WINDOW_CLOSED: ApplicationContext.getDisplays().remove(displayObject); break; } } I realize it may be more complicated than this, and I'm sure I don't understand completely what you're doing. But, this is the crucial piece that we added to Pivot (access to the "Display" list) that is needed to make events / repaint work correctly. HTH, ~Roger Whitcomb -----Original Message----- From: Roger and Beth Whitcomb [mailto:rogerandb...@rbwhitcomb.com] Sent: Thursday, May 29, 2014 9:31 AM To: user@pivot.apache.org Subject: Re: Swing and Pivot Integration using JPanel Hi Michel, There is one more thing needed -- there is a list of DisplayHost objects that is maintained for purposes of dispatching events. We added a method/hook to be able to add your new object to this list. I don't have the code right in front of me -- but I will dig it out and let you know. ~Roger Whitcomb On 5/27/14 10:42 AM, Michel Eisenmann wrote: > Hi, > > I'm integrating Pivot in my Swing application successfully except for > the transition/animation part. > > The way I've been doing things is the following: > > - I've created my own ApplicationContext to ensure that the Pivot > Timer was properly created. > > public class LocalApplicationContext extends ApplicationContext { > static public LocalApplicationContext singleton = null; > > public LocalApplicationContext() { > createTimer(); > } > > static public LocalApplicationContext GetOrCreate() { > if (singleton != null) return singleton; > singleton = new LocalApplicationContext(); > return singleton; > } > > > - Then I use this singleton everytime I need to create a JPanel that > contains some Pivot widgets: > > public static NewPlanAreaBXML InitializePanel(JPanel panel, > SchemaCollector coll) { > LocalApplicationContext.GetOrCreate(); > BXMLSerializer bxmlSerializer = new BXMLSerializer(); > ApplicationContext.DisplayHost displayHost = new > ApplicationContext.DisplayHost(); > try { > panel.setLayout(new BorderLayout()); > // the BXML that will be inserted in the JPanel > NewPlanAreaBXML window = (NewPlanAreaBXML) > bxmlSerializer.readObject(NewPlanAreaBXML.class > .getResource(getXmlFile())); > // > window.open(displayHost.getDisplay()); > window.setCollector(coll); > panel.add(displayHost); > panel.setPreferredSize(new Dimension(getDefaultWidth(), > getDefaultHeight())); > return window; > } catch (IOException e) { > e.printStackTrace(); > } catch (SerializationException e) { > e.printStackTrace(); > } > return null; > } > > This is working pretty well for most of what I need. Except for > animations/transitions that seem to be triggered *ONLY* if I move the mouse. > > For example, I've built an accordion based on the tutorial example and > when I click on the next button, the actual change happens only when I > move my mouse. If I don't move my mouse, nothing happens. > > It looks like some event loop related issue but... well. Ideas are welcome. > > Thanks in advance > Michel > > > > > > -- > View this message in context: > http://apache-pivot-users.399431.n3.nabble.com/Swing-and-Pivot-Integra > tion-using-JPanel-tp4022931.html Sent from the Apache Pivot - Users > mailing list archive at Nabble.com. > >