Package javax.swing.plaf

Examples of javax.swing.plaf.TextUI


         */
        public void paint(Graphics g, int p0, int p1, Shape bounds, JTextComponent c) {

            try {
               
                TextUI textUI = c.getUI();
                Rectangle start = textUI.modelToView(c, p0);
                Rectangle end = textUI.modelToView(c, p1);

                g.setColor(getLineColor());

                // This is the y coordinate of the bottom of the area we can draw in
                int y = start.y + start.height - 1;
View Full Code Here


         * rectangles equals null, do nothing.
         *
         */
        public void paint(final Graphics g, final int p0, final int p1,
                          final Shape shape, final JTextComponent jtc) {
            TextUI textUI = jtc.getUI();
            if (textUI == null) {
                return;
            }

            int start = Math.min(p0, p1);
            int end = Math.max(p0, p1);
            Rectangle startRect = null;
            Rectangle endRect = null;
            Rectangle shapeBounds = shape.getBounds();

            try {
                startRect = textUI.modelToView(jtc, start,
                                               Position.Bias.Forward);
                endRect = textUI.modelToView(jtc, end, Position.Bias.Backward);
            } catch (final BadLocationException e) {
            }

            if (startRect == null || endRect == null) {
                return;
View Full Code Here

         * rectangles equals null, do nothing.
         *
         */
        public void paint(final Graphics g, final int p0, final int p1,
                          final Shape shape, final JTextComponent jtc) {
            TextUI textUI = jtc.getUI();
            if (textUI == null) {
                return;
            }

            int start = Math.min(p0, p1);
            int end = Math.max(p0, p1);
            Rectangle startRect = null;
            Rectangle endRect = null;
            Rectangle shapeBounds = shape.getBounds();

            try {
                startRect = textUI.modelToView(jtc, start,
                                               Position.Bias.Forward);
                endRect = textUI.modelToView(jtc, end, Position.Bias.Backward);
            } catch (final BadLocationException e) {
            }

            if (startRect == null || endRect == null) {
                return;
View Full Code Here

        }
    }

    public void testUpdateUI() throws Exception {
        assertTrue(jtComp.getUI() instanceof TextCompUI);
        TextUI textUI1 = jtComp.getUI();
        SimplePropertyChangeListener listener = new SimplePropertyChangeListener();
        jtComp.addPropertyChangeListener(listener);
        jtComp.UIClassId = "TextCompUISecond";
        TextUI textUI2 = (TextUI) UIManager.getUI(jtComp);
        assertNotNull(textUI2);
        jtComp.updateUI();
        assertEqualsPropertyChangeEvent("UI", textUI1, jtComp.getUI(), listener.event);
        assertTrue(jtComp.getUI() instanceof BasicTextAreaUI);
    }
View Full Code Here

        assertEquals(new InsetsUIResource(0, 0, 0, 0), jtComp.getMargin());
    }

    public void testSetGetUITextUI() throws Exception {
        assertTrue(jtComp.getUI() instanceof TextCompUI);
        TextUI textUI1 = jtComp.getUI();
        SimplePropertyChangeListener listener = new SimplePropertyChangeListener();
        jtComp.addPropertyChangeListener(listener);
        jtComp.UIClassId = "TextCompUISecond";
        TextUI textUI2 = (TextUI) UIManager.getUI(jtComp);
        jtComp.setUI(textUI2);
        assertEqualsPropertyChangeEvent("UI", textUI1, textUI2, listener.event);
        assertEquals(textUI2, jtComp.getUI());
    }
View Full Code Here

        try {
            r1 = jta.modelToView(6);
            r2 = jta.modelToView(10);
            r3 = jta.modelToView(15);
            r4 = jta.modelToView(2);
            TextUI textUI = jta.getUI();
            r5 = textUI.modelToView(jta, 5, Position.Bias.Backward);
            r6 = textUI.modelToView(jta, 7, Position.Bias.Forward);
            assertNotNull(r1);
            assertNotNull(r2);
            assertNotNull(r3);
            assertNotNull(r4);
        } catch (BadLocationException e) {
View Full Code Here

        return keymapName;
    }

    public void testCreateKeymap() {
        JTextComponent.removeKeymap("BasicTextAreaUI");
        TextUI ui = jta.getUI();
        Keymap keymap = ((BasicTextUI) ui).createKeymap();
        assertEquals(getKeymapName(jta), keymap.getName());
        assertTrue(keymap.getDefaultAction() instanceof DefaultEditorKit.DefaultKeyTypedAction);
        assertEquals(0, keymap.getBoundActions().length);
        assertEquals(0, keymap.getBoundKeyStrokes().length);
View Full Code Here

        assertTrue(index >= 0);
        return str.replaceFirst(subStr, "");
    }

    public void testUninstallUI() throws Exception {
        TextUI ui = jta.getUI();
        assertTrue(ui instanceof TextAreaUI);
        TextAreaUI.callOrder = "";
        jta.setVisible(false);
        jta.getUI().uninstallUI(jta);
        String tmp = TextAreaUI.callOrder;
View Full Code Here

    public void testInstallUI() throws Exception {
        Caret caret = jta.getCaret();
        Highlighter highlighter = jta.getHighlighter();
        String prefix = ((BasicTextUI) tf.getUI()).getPropertyPrefix();
        (jta.getUI()).uninstallUI(jta);
        TextUI ui = jta.getUI();
        assertTrue(ui instanceof TextAreaUI);
        TextAreaUI.callOrder = "";
        (jta.getUI()).installUI(jta);
        String tmp = TextAreaUI.callOrder;
        tmp = findAndRemoveSubstring(tmp, "installUI::");
View Full Code Here

    g.setColor(getForeground());
    g.drawLine(getWidth() - 1, 0, getWidth() - 1, viewport.getHeight());

    // try to get the first element still shown in the viewport
    Rectangle vr = viewport.getViewRect();
    TextUI ui1 = editor.getUI();

    int p0 = ui1.viewToModel(editor, new Point(vr.x, vr.y));
    int p1 =
        ui1.viewToModel(editor, new Point(vr.x + vr.width, vr.y + vr.height));

    // find elements in document that contain p0 and p1
    int start =
        editor.getDocument().getDefaultRootElement().getElementIndex(p0);
    int end = editor.getDocument().getDefaultRootElement().getElementIndex(p1);
View Full Code Here

TOP

Related Classes of javax.swing.plaf.TextUI

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.