Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Frame


    private ButtonGroup sizeGroup = null;

    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        frame = new Frame(new BoxPane());
        frame.getStyles().put("padding", 0);
        frame.setTitle("Component Pane Test");
        frame.setPreferredSize(800, 600);
        frame.setLocation(20, 20);
View Full Code Here


        Sheet sheet = new Sheet();
        sheet.setContent(new Label("Hello Foo"));
        sheet.open(window1);

        Frame window1a = new Frame();
        window1a.setTitle("Window 1 A");
        window1a.setPreferredSize(160, 120);
        window1a.open(window1);

        Frame window1ai = new Frame();
        window1ai.setTitle("Window 1 A I");
        window1ai.setPreferredSize(160, 60);
        window1ai.open(window1a);
        window1ai.getDecorators().update(0, new ReflectionDecorator());

        Frame window1aii = new Frame();
        window1aii.setTitle("Window 1 A II");
        window1aii.setPreferredSize(160, 60);
        window1aii.open(window1a);

        Frame window1b = new Frame();
        window1b.setTitle("Window 1 B");
        window1b.setPreferredSize(160, 120);
        window1b.setLocation(20, 20);
        window1b.open(window1);

        Frame window1bi = new Frame();
        window1bi.setTitle("Window 1 B I");
        window1bi.setPreferredSize(160, 60);
        window1bi.open(window1b);

        Frame window1bii = new Frame();
        window1bii.setTitle("Window 1 B II");
        window1bii.setPreferredSize(160, 60);
        window1bii.open(window1b);

        Palette palette1 = new Palette();
        palette1.setTitle("Palette 1bii 1");
        palette1.setPreferredSize(160, 60);
        palette1.open(window1bii);

        Palette palette2 = new Palette();
        palette2.setTitle("Palette 1bii 2");
        palette2.setPreferredSize(160, 60);
        palette2.open(window1bii);

        Frame dialogOwner = new Frame();
        dialogOwner.setTitle("Dialog Owner");
        dialogOwner.setPreferredSize(160, 60);
        dialogOwner.open(display);

        Dialog dialog = new Dialog();
        dialog.setTitle("Dialog 1");
        dialog.setPreferredSize(160, 60);
        dialog.open(dialogOwner);
View Full Code Here

    private Frame frame = null;

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        frame = new Frame((Component)wtkxSerializer.readObject(getClass().getResource("baseline_test.wtkx")));
        frame.setTitle("Baseline Test");
        // frame.setPreferredSize(480, 360);
        frame.open(display);
    }
View Full Code Here

    @Override
    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        frame = new Frame((Component)wtkxSerializer.readObject(getClass().getResource("color_list_button_test.wtkx")));
        frame.setTitle("Color List Button Test");
        frame.setPreferredSize(480, 360);
        frame.open(display);
    }
View Full Code Here

    @Override
    public Dimensions getPreferredSize() {
        int preferredWidth = 0;
        int preferredHeight = 0;

        Frame frame = (Frame)getComponent();

        // Include title bar width plus left/right title bar borders
        Dimensions titleBarSize = titleBarTablePane.getPreferredSize();
        preferredWidth = Math.max(preferredWidth, titleBarSize.width + 2);

        // Include title bar height plus top/bottom title bar borders
        preferredHeight += titleBarSize.height + 2;

        // Include menu bar size
        MenuBar menuBar = frame.getMenuBar();
        if (menuBar != null) {
            Dimensions preferredMenuBarSize = menuBar.getPreferredSize();

            preferredWidth = Math.max(preferredWidth, preferredMenuBarSize.width);
            preferredHeight += preferredMenuBarSize.height;
        }

        Component content = frame.getContent();
        if (content != null) {
            Dimensions preferredContentSize = content.getPreferredSize();

            preferredWidth = Math.max(preferredWidth, preferredContentSize.width);
            preferredHeight += preferredContentSize.height;
View Full Code Here

        return new Dimensions(preferredWidth, preferredHeight);
    }

    @Override
    public void layout() {
        Frame frame = (Frame)getComponent();

        int width = getWidth();
        int height = getHeight();

        boolean maximized = frame.isMaximized();

        if (!maximized
            || getShowWindowControls()) {
            int clientX = 1;
            int clientY = 1;
            int clientWidth = Math.max(width - 2, 0);
            int clientHeight = Math.max(height - 2, 0);

            // Size/position title bar
            titleBarTablePane.setLocation(clientX, clientY);
            titleBarTablePane.setSize(clientWidth, titleBarTablePane.getPreferredHeight());
            titleBarTablePane.setVisible(true);

            // Add bottom title bar border, top content border, and content bevel
            clientY += titleBarTablePane.getHeight() + (showContentBevel ? 1 : 0) + 2;

            // Size/position resize handle
            resizeHandle.setSize(resizeHandle.getPreferredSize());
            resizeHandle.setLocation(clientWidth - resizeHandle.getWidth(),
                clientHeight - resizeHandle.getHeight());
            resizeHandle.setVisible(resizable
                && !maximized
                && (frame.isPreferredWidthSet()
                    || frame.isPreferredHeightSet()));

            // Size/position menu bar
            MenuBar menuBar = frame.getMenuBar();
            if (menuBar != null
                && menuBar.isVisible()) {
                menuBar.setLocation(clientX, clientY);
                menuBar.setSize(clientWidth, menuBar.getPreferredHeight());

                clientY += menuBar.getHeight();
            }

            // Size/position content
            Component content = frame.getContent();
            if (content != null) {
                int contentX = clientX + padding.left;
                int contentY = clientY + padding.top;
                int contentWidth = Math.max(clientWidth - (padding.left + padding.right), 0);
                int contentHeight = Math.max(clientHeight - (clientY + padding.top + padding.bottom) + (showContentBevel ? 1 : 0), 0);

                content.setLocation(contentX, contentY);
                content.setSize(contentWidth, contentHeight);
            }
        } else {
            titleBarTablePane.setVisible(false);
            resizeHandle.setVisible(false);

            // Size/position menu bar
            int clientY = 0;
            MenuBar menuBar = frame.getMenuBar();
            if (menuBar != null
                && menuBar.isVisible()) {
                menuBar.setLocation(0, clientY);
                menuBar.setSize(width, menuBar.getPreferredHeight());

                clientY += menuBar.getHeight();
            }

            Component content = frame.getContent();
            if (content != null) {
                content.setLocation(padding.left, clientY + padding.top);
                content.setSize(Math.max(width - (padding.left + padding.right), 0),
                    Math.max(height - (clientY + padding.top + padding.bottom), 0));
            }
View Full Code Here

    @Override
    public void paint(Graphics2D graphics) {
        // Call the base class to paint the background
        super.paint(graphics);

        Frame frame = (Frame)getComponent();

        int width = getWidth();
        int height = getHeight();

        boolean maximized = frame.isMaximized();

        if (!maximized
            || getShowWindowControls()) {
            int titleBarHeight = titleBarTablePane.getHeight();

            // Draw the title area
            Color titleBarBackgroundColorLocal = frame.isActive() ?
                this.titleBarBackgroundColor : inactiveTitleBarBackgroundColor;
            Color titleBarBorderColorLocal = frame.isActive() ?
                this.titleBarBorderColor : inactiveTitleBarBorderColor;
            Color titleBarBevelColorLocal = frame.isActive() ?
                this.titleBarBevelColor : inactiveTitleBarBevelColor;

            graphics.setPaint(new GradientPaint(width / 2f, 0, titleBarBevelColorLocal,
                width / 2f, titleBarHeight + 1, titleBarBackgroundColorLocal));
            graphics.fillRect(0, 0, width, titleBarHeight + 1);
View Full Code Here

    public Bounds getClientArea() {
        int width = getWidth();
        int height = getHeight();
        int titleBarHeight = titleBarTablePane.getHeight();

        Frame frame = (Frame)getComponent();
        boolean maximized = frame.isMaximized();

        Bounds clientArea;
        if (maximized
            && !getShowWindowControls()) {
            clientArea = new Bounds(0, 0, width, height);
View Full Code Here

    @Override
    public boolean mouseMove(Component component, int x, int y) {
        boolean consumed = super.mouseMove(component, x, y);

        if (Mouse.getCapturer() == component) {
            Frame frame = (Frame)getComponent();
            Display display = frame.getDisplay();

            Point location = frame.mapPointToAncestor(display, x, y);

            // Pretend that the mouse can't move off screen (off the display)
            location = new Point(Math.min(Math.max(location.x, 0), display.getWidth() - 1),
                Math.min(Math.max(location.y, 0), display.getHeight() - 1));

            if (dragOffset != null) {
                // Move the frame
                frame.setLocation(location.x - dragOffset.x, location.y - dragOffset.y);
            } else {
                if (resizeOffset != null) {
                    // Resize the frame
                    int preferredWidth = -1;
                    int preferredHeight = -1;

                    if (frame.isPreferredWidthSet()) {
                        preferredWidth = Math.max(location.x - frame.getX() + resizeOffset.x,
                            titleBarTablePane.getPreferredWidth(-1) + 2);
                        preferredWidth = Math.min(preferredWidth, frame.getMaximumWidth());
                        preferredWidth = Math.max(preferredWidth, frame.getMinimumWidth());
                    }

                    if (frame.isPreferredHeightSet()) {
                        preferredHeight = Math.max(location.y - frame.getY() + resizeOffset.y,
                            titleBarTablePane.getHeight() + resizeHandle.getHeight() + (showContentBevel ? 1 : 0) + 6);
                        preferredHeight = Math.min(preferredHeight, frame.getMaximumHeight());
                        preferredHeight = Math.max(preferredHeight, frame.getMinimumHeight());
                    }

                    frame.setPreferredSize(preferredWidth, preferredHeight);
                }
            }
        } else {
            Cursor cursor = null;
            if (resizeHandle.isVisible()
View Full Code Here

    @Override
    public boolean mouseDown(Component component, Mouse.Button button, int x, int y) {
        boolean consumed = super.mouseDown(component, button, x, y);

        Frame frame = (Frame)getComponent();
        boolean maximized = frame.isMaximized();

        if (button == Mouse.Button.LEFT
            && !maximized) {
            Bounds titleBarBounds = titleBarTablePane.getBounds();
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Frame

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.