Package org.apache.pivot.wtk

Examples of org.apache.pivot.wtk.Label$LabelListenerList


    @Override
    public void startup(Display display, Map<String, String> properties) {
        this.window = new Window();

        Label label = new Label();
        label.setText("Hello World!");
        label.getStyles().put("font", new Font("Arial", Font.BOLD, 24));
        label.getStyles().put("color", Color.RED);
        label.getStyles().put("horizontalAlignment",
            HorizontalAlignment.CENTER);
        label.getStyles().put("verticalAlignment",
            VerticalAlignment.CENTER);

        this.window.setContent(label);
        this.window.setTitle("Hello World!");
        this.window.setMaximized(true);
View Full Code Here


            + "listen very hard the tune will come to you at last when all are "
            + "one and one is all:\nto be a rock and not to roll.";

        BoxPane boxPane = new BoxPane(Orientation.VERTICAL);

        Label label1 = new Label(line1);
        label1.getStyles().put("wrapText", true);
        label1.getStyles().put("horizontalAlignment", HorizontalAlignment.LEFT);
        boxPane.add(label1);

        Label label2 = new Label(line2)// strikethrough
        label2.getStyles().put("wrapText", true);
        label2.getStyles().put("horizontalAlignment", HorizontalAlignment.LEFT);
        label2.getStyles().put("textDecoration", TextDecoration.STRIKETHROUGH);
        boxPane.add(label2);

        Label label3 = new Label(line2)// disabled
        label3.getStyles().put("wrapText", true);
        label3.getStyles().put("horizontalAlignment", HorizontalAlignment.LEFT);
        label3.setEnabled(false);
        boxPane.add(label3);

        boxPane.getStyles().put("fill", true);
        boxPane.getStyles().put("padding", new Insets(10));
View Full Code Here

        Border border = new Border();
        border.getStyles().put("backgroundColor", index);

        stackPane.add(border);

        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);
View Full Code Here

                window1.getComponentListeners().remove(this);
            }
        });

        display.getStyles().put("backgroundColor", new Color(0, 127, 127));
        window1.setContent(new Label("Hello Bar"));
        window1.open(display);

        ApplicationContext.queueCallback(new Runnable() {
            @Override
            public void run() {
                final Sheet sheet = new Sheet();
                sheet.setPreferredSize(120, 60);
                sheet.open(window1);

                ApplicationContext.queueCallback(new Runnable() {
                    @Override
                    public void run() {
                        Sheet sheet2 = new Sheet();
                        sheet2.setPreferredSize(60, 30);
                        sheet2.open(sheet);
                    }
                });
            }
        });

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

        Frame window1ai = new Frame();
        window1ai.setTitle("Window 1 A I");
        window1ai.setLocation(150, 300);
        window1ai.setPreferredSize(320, 200);
        window1ai.open(window1a);
        window1ai.getDecorators().update(0, new ReflectionDecorator());

        Frame window1aii = new Frame();
        window1aii.setTitle("Window 1 A II");
        window1aii.setLocation(50, 400);
        window1aii.setPreferredSize(320, 200);
        window1aii.open(window1a);

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

        Frame window1bi = new Frame();
        window1bi.setTitle("Window 1 B I");
        window1bi.setPreferredSize(180, 60);
        window1bi.setLocation(270, 160);
        window1bi.setContent(new Label("This window is not enabled"));
        window1bi.setEnabled(false)// to test even a not enabled window ...
        window1bi.open(window1b);

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

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

        Palette palette2 = new Palette();
        palette2.setTitle("Palette 1bii 2");
        palette2.setPreferredSize(160, 60);
        palette2.setLocation(600, 200);
        palette2.setContent(new Label("This palette is not enabled"));
        palette2.setEnabled(false)// to test even a not enabled palette ...
        palette2.open(window1bii);

        dialogOwner.setTitle("Dialog Owner");
        dialogOwner.setPreferredSize(320, 120);
View Full Code Here

        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);
View Full Code Here

public class LabelAntialiasTest extends Application.Adapter {
    private Window window = null;

    private Label buildLabel(double rotation) {
        Label label = new Label();

        Font font = new Font("Arial", Font.BOLD, 64);

        AffineTransform fontAT = new AffineTransform();
        // Derive a new font using a rotation transform
        fontAT.rotate(rotation * java.lang.Math.PI / 180.0d);
        Font fontDerived = font.deriveFont(fontAT);

        label.setText("Hello at " + rotation + " degree.");
        label.getStyles().put("color", Color.RED);
        label.getStyles().put("font", fontDerived);
        label.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
        label.getStyles().put("verticalAlignment",   VerticalAlignment.TOP);

        return label;
    }
View Full Code Here

        window = new Window();

        showFontDesktopHints();
        showFontFamilies();

        Label label = buildLabel(45);
        window.setContent(label);

        window.setTitle("Label Antialiasing Test");
        window.setMaximized(true);
        window.open(display);
View Full Code Here

        Font labelFont = theme.getFont();
        labelFont = labelFont.deriveFont(Font.BOLD);

        for (int i = 0; i < 7; i++) {
            Label label = new Label();
            label.getStyles().put("font", labelFont);
            label.getStyles().put("padding", new Insets(2, 2, 4, 2));
            label.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
            calendarRow.add(label);
        }

        calendarTablePane.getRows().add(calendarRow);
View Full Code Here

        GregorianCalendar gregorianCalendar = new GregorianCalendar(locale);
        SimpleDateFormat monthFormat = new SimpleDateFormat("E", locale);
        int firstDayOfWeek = gregorianCalendar.getFirstDayOfWeek();

        for (int i = 0; i < 7; i++) {
            Label label = (Label)row.get(i);
            gregorianCalendar.set(java.util.Calendar.DAY_OF_WEEK, firstDayOfWeek + i);
            String text = monthFormat.format(gregorianCalendar.getTime());
            text = Character.toString(text.charAt(weekdayCharacterIndex));
            label.setText(text);
        }
    }
View Full Code Here

        monthSpinner.getStyles().put("font", font);
        yearSpinner.getStyles().put("font", font);

        TablePane.Row row = calendarTablePane.getRows().get(1);
        for (int i = 0; i < 7; i++) {
            Label label = (Label)row.get(i);
            label.getStyles().put("font", font);
        }

        invalidateComponent();
    }
View Full Code Here

TOP

Related Classes of org.apache.pivot.wtk.Label$LabelListenerList

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.