pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michel Eisenmann <michel.eisenm...@fr.ibm.com>
Subject Re: When combining Swing & Pivot, is there an alternative to JInternalFrames?
Date Tue, 27 May 2014 17:33:11 GMT
Hi

Not sure if this is too late for you, but here is what I've done:

1- created my own application context to create the timer

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;
  }
}


2- then I'm able to create JPanels that contain pivot widgets in the
following way. I create a JPanel instance and initialize it using the
following code....

 public static PlanAreaBXML InitializePanel(JPanel panel, SchemaCollector
coll) {
    LocalApplicationContext.GetOrCreate();
    BXMLSerializer bxmlSerializer = new BXMLSerializer();
    ApplicationContext.DisplayHost displayHost = new
ApplicationContext.DisplayHost();
    try {
      panel.setLayout(new BorderLayout());
      PlanAreaBXML window = (PlanAreaBXML)
bxmlSerializer.readObject(PlanAreaBXML.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;
  }

Of course the PlanAreaBXML is one of my classes. You must replace this with
what you are descrbing in the BXML file.

With this, things work ok except the transitions that are not happening
until I move my mouse (will open another thread on this..).

Hope this helps
Michel





--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/When-combining-Swing-Pivot-is-there-an-alternative-to-JInternalFrames-tp4022817p4022930.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Mime
View raw message