Examples of TextPane


Examples of com.scriptographer.adm.TextPane

    ImagePane logo = new ImagePane(this);
    logo.setImage(AdmUiFactory.getImage("logo.png"));
    logo.setMargin(-4, 4, -4, -4);
    addToContent(logo, "0, 0, 0, 1, L, T");

    TextPane text = new TextPane(this);
    if (!Pattern.compile("[\n\r]").matcher(message).find()
        && getTextSize(message).width > 320)
      text.setMaximumSize(new Size(320, -1));
    text.setMinimumSize(240, -1);
    text.setText(message);
    text.setMarginBottom(8);
    addToContent(text, "1, 0, 2, 0, L, C");

    Button okButton = new Button(this);
    okButton.setText("  OK  ");
    addToContent(okButton, "1, 1, R, T");
View Full Code Here

Examples of org.antlr.works.utils.TextPane

    public DBOutputPanel(DebuggerTab debuggerTab) {
        super("Output", debuggerTab);

        this.debuggerTab = debuggerTab;

        outputTextPane = new TextPane();
        outputTextPane.setBackground(Color.white);
        outputTextPane.setBorder(null);
        outputTextPane.setFont(new Font(AWPrefs.getEditorFont(), Font.PLAIN, AWPrefs.getEditorFontSize()));
        outputTextPane.setText("");
        outputTextPane.setEditable(false);
View Full Code Here

Examples of org.antlr.works.utils.TextPane

    protected TextPane inputTextPane;
    protected JScrollPane textScrollPane;
    protected DBInputProcessorToken processorToken;

    public DBInputTokenPanel(DebuggerTab debuggerTab) {
        inputTextPane = new TextPane();
        inputTextPane.setBackground(Color.white);
        inputTextPane.setBorder(null);
        inputTextPane.setFont(new Font(AWPrefs.getEditorFont(), Font.PLAIN, AWPrefs.getEditorFontSize()));
        inputTextPane.setText("");
        inputTextPane.setEditable(false);
View Full Code Here

Examples of org.apache.pivot.wtk.TextPane

            BXMLSerializer bxmlSerializer = new BXMLSerializer();
            window = (Window) bxmlSerializer.readObject(BXMLExplorer.class,
                "CreateHighlightedXml.bxml", true);

            TextPane textPane = (TextPane) bxmlSerializer.getNamespace().get("textPane");
            textPane.setDocument(doc);

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

Examples of org.apache.pivot.wtk.TextPane

    @Override
    public void install(Component component) {
        super.install(component);

        TextPane textPane = (TextPane)component;
        textPane.getTextPaneListeners().add(this);
        textPane.getTextPaneSelectionListeners().add(this);

        textPane.setCursor(Cursor.TEXT);

        Document document = textPane.getDocument();
        if (document != null) {
            documentView = (TextPaneSkinDocumentView)createNodeView(document);
            documentView.attach();
            updateSelection();
        }
View Full Code Here

Examples of org.apache.pivot.wtk.TextPane

    }

    @Override
    public void layout() {
        if (documentView != null) {
            TextPane textPane = (TextPane)getComponent();
            int width = getWidth();

            int breakWidth;
            if (wrapText) {
                breakWidth = Math.max(width - (margin.left + margin.right), 0);
            } else {
                breakWidth = Integer.MAX_VALUE;
            }
            documentView.layout(breakWidth);
            documentView.setSkinLocation(margin.left, margin.top);

            updateSelection();
            caretX = caret.x;

            if (textPane.isFocused()) {
                scrollCharacterToVisible(textPane.getSelectionStart());
            }

            showCaret(textPane.isFocused()
                && textPane.getSelectionLength() == 0);
        }
    }
View Full Code Here

Examples of org.apache.pivot.wtk.TextPane

    @Override
    public void paint(Graphics2D graphics) {
        super.paint(graphics);

        TextPane textPane = (TextPane)getComponent();

        if (documentView != null) {
            // Draw the selection highlight
            if (selection != null) {
                graphics.setColor(textPane.isFocused()
                    && textPane.isEditable() ?
                    selectionBackgroundColor : inactiveSelectionBackgroundColor);
                graphics.fill(selection);
            }

            int width = getWidth();
            int breakWidth;
            if (wrapText) {
                breakWidth = Math.max(width - (margin.left + margin.right), 0);
            } else {
                breakWidth = Integer.MAX_VALUE;
            }
            documentView.layout(breakWidth);

            // Draw the document content
            graphics.translate(margin.left, margin.top);
            documentView.paint(graphics);
            graphics.translate(-margin.left, -margin.top);

            // Draw the caret
            if (selection == null
                && caretOn
                && textPane.isFocused()) {
                graphics.setColor(textPane.isEditable() ? color : inactiveColor);
                graphics.fill(caret);
            }
        }
    }
View Full Code Here

Examples of org.apache.pivot.wtk.TextPane

        return characterBounds;
    }

    private void scrollCharacterToVisible(int offset) {
        TextPane textPane = (TextPane)getComponent();
        Bounds characterBounds = getCharacterBounds(offset);

        if (characterBounds != null) {
            textPane.scrollAreaToVisible(characterBounds.x, characterBounds.y,
                characterBounds.width, characterBounds.height);
        }
    }
View Full Code Here

Examples of org.apache.pivot.wtk.TextPane

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

        if (Mouse.getCapturer() == component) {
            TextPane textPane = (TextPane)getComponent();

            Bounds visibleArea = textPane.getVisibleArea();
            visibleArea = new Bounds(visibleArea.x, visibleArea.y,
                visibleArea.width, visibleArea.height);

            if (y >= visibleArea.y
                && y < visibleArea.y + visibleArea.height) {
                // Stop the scroll selection timer
                if (scheduledScrollSelectionCallback != null) {
                    scheduledScrollSelectionCallback.cancel();
                    scheduledScrollSelectionCallback = null;
                }

                scrollDirection = null;
                int offset = getInsertionPoint(x, y);

                if (offset != -1) {
                    // Select the range
                    if (offset > anchor) {
                        textPane.setSelection(anchor, offset - anchor);
                    } else {
                        textPane.setSelection(offset, anchor - offset);
                    }
                }
            } else {
                if (scheduledScrollSelectionCallback == null) {
                    scrollDirection = (y < visibleArea.y) ? TextPane.ScrollDirection.UP : TextPane.ScrollDirection.DOWN;
View Full Code Here

Examples of org.apache.pivot.wtk.TextPane

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

        if (button == Mouse.Button.LEFT) {
            TextPane textPane = (TextPane)component;

            anchor = getInsertionPoint(x, y);

            if (anchor != -1) {
                if (Keyboard.isPressed(Keyboard.Modifier.SHIFT)) {
                    // Select the range
                    int selectionStart = textPane.getSelectionStart();

                    if (anchor > selectionStart) {
                        textPane.setSelection(selectionStart, anchor - selectionStart);
                    } else {
                        textPane.setSelection(anchor, selectionStart - anchor);
                    }
                } else {
                    // Move the caret to the insertion point
                    textPane.setSelection(anchor, 0);
                    consumed = true;
                }
            }

            caretX = caret.x;

            // Set focus to the text input
            textPane.requestFocus();
        }

        return consumed;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.