Search in sources :

Example 6 with Window

use of org.apache.pivot.wtk.Window in project pivot by apache.

the class WindowSkin method getPreferredHeight.

@Override
public int getPreferredHeight(int width) {
    Window window = (Window) getComponent();
    Component content = window.getContent();
    return (content != null) ? content.getPreferredHeight(width) : 0;
}
Also used : Window(org.apache.pivot.wtk.Window) Component(org.apache.pivot.wtk.Component)

Example 7 with Window

use of org.apache.pivot.wtk.Window in project pivot by apache.

the class WindowSkin method getPreferredSize.

@Override
public Dimensions getPreferredSize() {
    Window window = (Window) getComponent();
    Component content = window.getContent();
    return (content != null) ? content.getPreferredSize() : Dimensions.ZERO;
}
Also used : Window(org.apache.pivot.wtk.Window) Component(org.apache.pivot.wtk.Component)

Example 8 with Window

use of org.apache.pivot.wtk.Window in project pivot by apache.

the class WindowSkin method mouseDown.

@Override
public boolean mouseDown(Container container, Mouse.Button button, int x, int y) {
    boolean consumed = super.mouseDown(container, button, x, y);
    Window window = (Window) container;
    window.moveToFront();
    return consumed;
}
Also used : Window(org.apache.pivot.wtk.Window)

Example 9 with Window

use of org.apache.pivot.wtk.Window in project pivot by apache.

the class WindowSkin method layout.

@Override
public void layout() {
    Window window = (Window) getComponent();
    Component content = window.getContent();
    if (content != null) {
        content.setSize(window.getSize());
    }
}
Also used : Window(org.apache.pivot.wtk.Window) Component(org.apache.pivot.wtk.Component)

Example 10 with Window

use of org.apache.pivot.wtk.Window in project pivot by apache.

the class SwingDemo method createPivotFrame.

private static void createPivotFrame() {
    // Create the internal frame that will contain the Pivot components
    JInternalFrame internalFrame = new JInternalFrame("Pivot Components");
    desktop.add(internalFrame);
    // Create the display host
    ApplicationContext.DisplayHost displayHost = new ApplicationContext.DisplayHost();
    internalFrame.add(displayHost);
    // Add the display to the display list
    displays.add(displayHost.getDisplay());
    // Load the Pivot window
    BXMLSerializer bxmlSerializer = new BXMLSerializer();
    Window window;
    try {
        window = (Window) bxmlSerializer.readObject(SwingDemo.class.getResource("pivot_window.bxml"));
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    } catch (SerializationException exception) {
        throw new RuntimeException(exception);
    }
    // Open the Pivot window on the display
    window.open(displayHost.getDisplay());
    // Open and select the internal frame
    internalFrame.setLocation(240, 100);
    internalFrame.setSize(480, 360);
    internalFrame.setVisible(true);
    internalFrame.setResizable(true);
    try {
        internalFrame.setSelected(true);
    } catch (PropertyVetoException exception) {
        throw new RuntimeException(exception);
    }
}
Also used : Window(org.apache.pivot.wtk.Window) PropertyVetoException(java.beans.PropertyVetoException) ApplicationContext(org.apache.pivot.wtk.ApplicationContext) SerializationException(org.apache.pivot.serialization.SerializationException) IOException(java.io.IOException) JInternalFrame(javax.swing.JInternalFrame) BXMLSerializer(org.apache.pivot.beans.BXMLSerializer)

Aggregations

Window (org.apache.pivot.wtk.Window)45 Component (org.apache.pivot.wtk.Component)14 BXMLSerializer (org.apache.pivot.beans.BXMLSerializer)13 PushButton (org.apache.pivot.wtk.PushButton)9 BoxPane (org.apache.pivot.wtk.BoxPane)8 Button (org.apache.pivot.wtk.Button)7 ButtonPressListener (org.apache.pivot.wtk.ButtonPressListener)6 Display (org.apache.pivot.wtk.Display)5 Border (org.apache.pivot.wtk.Border)4 Label (org.apache.pivot.wtk.Label)4 Sheet (org.apache.pivot.wtk.Sheet)4 TablePane (org.apache.pivot.wtk.TablePane)4 File (java.io.File)3 Bounds (org.apache.pivot.wtk.Bounds)3 Point (org.apache.pivot.wtk.Point)3 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 SerializationException (org.apache.pivot.serialization.SerializationException)2 Vote (org.apache.pivot.util.Vote)2 TaskExecutionException (org.apache.pivot.util.concurrent.TaskExecutionException)2