When combining Swing & Pivot, is there an alternative to JInternalFrames?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

When combining Swing & Pivot, is there an alternative to JInternalFrames?

vinylherz
I ask because I'd like to use something like JPanels instead of JInternalFrames, and a simple Frame instead of DesktopPane

I got it barely working, there is no redraw and components do not show up ...
if you resize the frame, just the swing compoents will be drawn


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: When combining Swing & Pivot, is there an alternative to JInternalFrames?

Roger Whitcomb-2
It's a little bit complicated, but you would definitely need to hook your component into the ApplicationContext's "display" list (using the ApplicationContext.getDisplays().add(...) method).  Not sure how/where you have made changes or want to change to using JPanel.  So, maybe you could elaborate a little bit on what you've done/changed.

Thanks,
~Roger

-----Original Message-----
From: vinylherz [mailto:[hidden email]]
Sent: Sunday, December 29, 2013 9:02 AM
To: [hidden email]
Subject: When combining Swing & Pivot, is there an alternative to JInternalFrames?

I ask because I'd like to use something like JPanels instead of JInternalFrames, and a simple Frame instead of DesktopPane

I got it barely working, there is no redraw and components do not show up ...
if you resize the frame, just the swing compoents will be drawn

<http://apache-pivot-users.399431.n3.nabble.com/file/n4022817/ex.jpg>




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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: When combining Swing & Pivot, is there an alternative to JInternalFrames?

Michel Eisenmann
In reply to this post by vinylherz
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

Loading...