Package javax.swing.plaf

Examples of javax.swing.plaf.TextUI


            Object useMap = attr.getAttribute(HTML.Attribute.USEMAP);
            if (useMap != null && (useMap instanceof String)) {
                Map m = hdoc.getMap((String)useMap);
                if (m != null && offset < hdoc.getLength()) {
                    Rectangle bounds;
                    TextUI ui = html.getUI();
                    try {
                        Shape lBounds = ui.modelToView(html, offset,
                                                   Position.Bias.Forward);
                        Shape rBounds = ui.modelToView(html, offset + 1,
                                                   Position.Bias.Backward);
                        bounds = lBounds.getBounds();
                        bounds.add((rBounds instanceof Rectangle) ?
                                    (Rectangle)rBounds : rBounds.getBounds());
                    } catch (BadLocationException ble) {
View Full Code Here


        private boolean doesElementContainLocation(JEditorPane editor,
                                                   Element e, int offset,
                                                   int x, int y) {
            if (e != null && offset > 0 && e.getStartOffset() == offset) {
                try {
                    TextUI ui = editor.getUI();
                    Shape s1 = ui.modelToView(editor, offset,
                                              Position.Bias.Forward);
        if (s1 == null) {
      return false;
        }
                    Rectangle r1 = (s1 instanceof Rectangle) ? (Rectangle)s1 :
                                    s1.getBounds();
                    Shape s2 = ui.modelToView(editor, e.getEndOffset(),
                                              Position.Bias.Backward);
        if (s2 != null) {
      Rectangle r2 = (s2 instanceof Rectangle) ? (Rectangle)s2 :
                                    s2.getBounds();
      r1.add(r2);
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

    /**
     * Removes all highlights.
     */
    public void removeAllHighlights() {
  TextUI mapper = component.getUI();
  if (getDrawsLayeredHighlights()) {
      int len = highlights.size();
      if (len != 0) {
    int minX = 0;
    int minY = 0;
View Full Code Here

         */
        public void paint(Graphics g, int offs0, int offs1, Shape bounds, JTextComponent c) {
      Rectangle alloc = bounds.getBounds();
      try {
    // --- determine locations ---
    TextUI mapper = c.getUI();
    Rectangle p0 = mapper.modelToView(c, offs0);
    Rectangle p1 = mapper.modelToView(c, offs1);

    // --- render ---
    Color color = getColor();

    if (color == null) {
View Full Code Here

        /**
         * Executes range(s) damage and cleans range queue.
         */
        public synchronized void run() {
            if (component != null) {
                TextUI mapper = component.getUI();
                if (mapper != null && lastDoc == component.getDocument()) {
                    // the Document should be the same to properly
                    // display highlights
                    int len = p0.size();
                    for (int i = 0; i < len; i++){
                        mapper.damageRange(component,
                                p0.get(i).getOffset(),
                                p1.get(i).getOffset());
                    }
                }
            }
View Full Code Here

    //long startTime = System.currentTimeMillis();

    backgroundPainter.paint(g, getVisibleRect());

    // Paint the main part of the text area.
    TextUI ui = getUI();
    if (ui != null) {
      // Not allowed to modify g, so make a copy.
      Graphics scratchGraphics = g.create();
      try {
        ui.update(scratchGraphics, this);
      } finally {
        scratchGraphics.dispose();
      }
    }
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

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.