Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.BoxPane$BoxPaneListenerList


    private Frame frame1;
    private Frame frame2;

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        BoxPane boxPane1 = new BoxPane(Orientation.VERTICAL);
        TextInput textInput1 = new TextInput();
        textInput1.setText("ABCD");
        boxPane1.add(textInput1);
        boxPane1.add(new TextInput());
        boxPane1.add(new TextInput());
        frame1 = new Frame(boxPane1);
        frame1.setPreferredSize(320, 240);
        frame1.open(display);

        BoxPane boxPane2 = new BoxPane(Orientation.VERTICAL);
        TextInput textInput2 = new TextInput();
        textInput2.setText("1234");
        boxPane2.add(textInput2);
        boxPane2.add(new TextInput());
        boxPane2.add(new TextInput());
        frame2 = new Frame(boxPane2);
        frame2.setPreferredSize(320, 240);
        frame2.open(display);

        frame2.requestFocus();
View Full Code Here


    private static Component addPointControl(final Dictionary<String, Object> dictionary,
        final String key, Form.Section section) {
        Point point = (Point)dictionary.get(key);

        BoxPane boxPane = new BoxPane(Orientation.VERTICAL);
        section.add(boxPane);
        Form.setLabel(boxPane, key);

        FlowPane flowPane = new FlowPane();
        flowPane.getStyles().put("alignToBaseline", true);
        flowPane.getStyles().put("horizontalSpacing", 5);
        boxPane.add(flowPane);

        TextInput textInput = new TextInput();
        textInput.setTextSize(3);
        textInput.setMaximumLength(4);
        textInput.setValidator(new IntValidator());
        textInput.setText(String.valueOf(point.x));
        flowPane.add(textInput);

        textInput.getComponentStateListeners().add(new ComponentStateListener.Adapter() {
            @Override
            public void focusedChanged(Component component, Component obverseComponent) {
                if (!component.isFocused()) {
                    TextInput textInputLocal = (TextInput)component;
                    Point pointLocal = (Point)dictionary.get(key);

                    try {
                        int x = Integer.parseInt(textInputLocal.getText());
                        dictionary.put(key, new Point(x, pointLocal.y));
                    } catch (Exception exception) {
                        displayErrorMessage(exception, component.getWindow());
                        textInputLocal.setText(String.valueOf(pointLocal.x));
                    }
                }
            }
        });

        Label label = new Label("x");
        label.getStyles().put("font", "{italic:true}");
        flowPane.add(label);

        flowPane = new FlowPane();
        flowPane.getStyles().put("alignToBaseline", true);
        flowPane.getStyles().put("horizontalSpacing", 5);
        boxPane.add(flowPane);

        textInput = new TextInput();
        textInput.setTextSize(3);
        textInput.setMaximumLength(4);
        textInput.setValidator(new IntValidator());
View Full Code Here

        return boxPane;
    }

    private void updatePointControl(Dictionary<String, Object> dictionary, String key) {
        BoxPane boxPane = (BoxPane)controls.get(key);

        if (boxPane != null) {
            Point point = (Point)dictionary.get(key);

            TextInput xTextInput = (TextInput)((FlowPane)boxPane.get(0)).get(0);
            TextInput yTextInput = (TextInput)((FlowPane)boxPane.get(1)).get(0);

            xTextInput.setText(String.valueOf(point.x));
            yTextInput.setText(String.valueOf(point.y));
        }
    }
View Full Code Here

        Label label = new Label();
        label.setText(Integer.toString(index));
        label.getStyles().put("backgroundColor", Color.WHITE);
        label.getStyles().put("padding", 2);

        BoxPane boxPane = new BoxPane();
        boxPane.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
        boxPane.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);

        boxPane.add(new Border(label));
        stackPane.add(boxPane);

        return stackPane;
    }
View Full Code Here

            public void buttonRemoved(ButtonGroup buttonGroupArgument, Button button) {
                System.out.println("buttonRemoved(): " + button);
            }
        });

        BoxPane boxPane = new BoxPane();

        PushButton button1 = new PushButton("One");
        button1.setToggleButton(true);
        button1.setButtonGroup(buttonGroup);
        boxPane.add(button1);

        PushButton button2 = new PushButton("Two");
        button2.setToggleButton(true);
        button2.setButtonGroup(buttonGroup);
        boxPane.add(button2);

        PushButton button3 = new PushButton("Three");
        button3.setToggleButton(true);
        button3.setButtonGroup(buttonGroup);
        boxPane.add(button3);

        PushButton button4 = new PushButton("Four");
        button4.setToggleButton(true);
        button4.setButtonGroup(buttonGroup);
        boxPane.add(button4);

        // button1.setSelected(true);
        // buttonGroup.setSelection(button1);
        // buttonGroup.setSelection(null);
View Full Code Here

public class LinkButtonTest extends Application.Adapter {
    private Window window = new Window();

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        BoxPane boxPane = new BoxPane();
        boxPane.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
        boxPane.getStyles().put("spacing", 8);
        boxPane.getComponentMouseListeners().add(new ComponentMouseListener() {
            @Override
            public boolean mouseMove(Component component, int x, int y) {
                System.out.println("BOX PANE " + x + ", " + y);
                return false;
            }

            @Override
            public void mouseOver(Component component) {
                // empty block
            }

            @Override
            public void mouseOut(Component component) {
                // empty block
            }
        });

        Image image = Image.load(getClass().getResource("go-home.png"));

        LinkButton linkButton = null;

        linkButton = new LinkButton("ABCDE");
        boxPane.add(linkButton);
        linkButton.getComponentMouseListeners().add(new ComponentMouseListener() {
            @Override
            public boolean mouseMove(Component component, int x, int y) {
                return true;
            }

            @Override
            public void mouseOver(Component component) {
                // empty block
            }

            @Override
            public void mouseOut(Component component) {
                // empty block
            }
        });

        linkButton = new LinkButton(image);
        boxPane.add(linkButton);

        linkButton = new LinkButton(new ButtonData(image, "12345"));
        boxPane.add(linkButton);

        window.setContent(boxPane);
        window.open(display);
    }
View Full Code Here

    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

    @BXML private TextInput textInput2 = null;
    @BXML private TextInput textInput3 = null;

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        BoxPane boxPane = new BoxPane(Orientation.VERTICAL);
        boxPane.add(new TextInput());
        boxPane.add(new TextInput());
        boxPane.add(new TextInput());
        frame1 = new Frame(boxPane);
        frame1.setLocation(50, 50);
        frame1.setPreferredSize(320, 240);
        frame1.setTitle("Frame 1");
View Full Code Here

        listFrame.setTitle("List Frame");
        listFrame.setPreferredSize(400, 300);
        listFrame.setLocation(20, 20);
        listFrame.getStyles().put("padding", new Insets(0, 0, 0, 0));

        BoxPane boxPane = new BoxPane();
        boxPane.getStyles().put("fill", true);
        boxPane.setOrientation(Orientation.VERTICAL);
        listFrame.setContent(boxPane);

        Label infoLabel = new Label("Double click on a list item to open a detail frame");
        boxPane.add(infoLabel);

        ScrollPane scrollPane = new ScrollPane();
        scrollPane.setHorizontalScrollBarPolicy(ScrollBarPolicy.FILL);
        scrollPane.setVerticalScrollBarPolicy(ScrollBarPolicy.FILL_TO_CAPACITY);
        scrollPane.setRepaintAllViewport(true)// workaround for pivot-738, needed only in in some cases
        boxPane.add(scrollPane);

        final ListView listView = new ListView();
        List<String> listData = new ArrayList<String>();
        for (int i = 0; i < 50; ++i) {
            listData.add("List Item " + i);
        }
        listView.setListData(listData);
        scrollPane.setView(listView);

        listView.getListViewSelectionListeners().add(new ListViewSelectionListener.Adapter() {
            @Override
            public void selectedItemChanged(ListView listViewArgument, Object previousSelectedItem) {
                System.out.println("selectedItemChanged : " + listViewArgument.getSelectedItem());
            }
        });

        listView.getComponentMouseButtonListeners().add(new ComponentMouseButtonListener.Adapter() {
            @Override
            public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
                System.out.println("mouseClick : " + count);

                if (count == 2) {
                    System.out.println("double click, now open a detail frame");

                    Frame detailFrame = new Frame();
                    detailFrame.setTitle("Detail Frame");
                    detailFrame.setPreferredSize(400, 300);
                    int selectedIndex = listView.getSelectedIndex();
                    detailFrame.setLocation(80 + (selectedIndex * 10), 80 + (selectedIndex * 10));
                    detailFrame.getStyles().put("padding", new Insets(0, 0, 0, 0));

                    BoxPane boxPaneLocal = new BoxPane();
                    boxPaneLocal.getStyles().put("fill", true);
                    boxPaneLocal.setOrientation(Orientation.VERTICAL);
                    detailFrame.setContent(boxPaneLocal);

                    String selectedItem = listView.getSelectedItem().toString();
                    Label label = new Label("Selected Item is \"" + selectedItem + "\"");
                    boxPaneLocal.add(label);
                    boxPaneLocal.add(new Label(""))// spacer

                    boxPaneLocal.add(new Label("Click inside the text input to focus it"));
                    TextInput textInput = new TextInput();
                    textInput.setText("Focusable component");
                    boxPaneLocal.add(textInput)// workaround for pivot-811: add a focusable element inside the frame

                    detailFrame.open(displayArgument);

                    // workaround for pivot-811: force the focus on the first focusable element inside the frame
                    detailFrame.requestFocus();
View Full Code Here

    private Window window = null;
    private PushButton helloButton = null;

    @Override
    public void startup(Display display, Map<String, String> properties) throws Exception {
        BoxPane boxPane = new BoxPane();
        boxPane.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
        boxPane.getStyles().put("verticalAlignment", VerticalAlignment.BOTTOM);

        helloButton = new PushButton("Say Hello");
        boxPane.add(helloButton);

        helloButton.getButtonPressListeners().add(new ButtonPressListener() {
            @Override
            public void buttonPressed(Button button) {
                String text = button.getButtonData().toString();
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.BoxPane$BoxPaneListenerList

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.