5073 lines · 187.2 KB · Java
RawDownload
                Element elem = sDoc.getCharacterElement(c.composedTextStart.getOffset());                AttributeSet attr = elem.getAttributes();                bg = sDoc.getBackground(attr);            }             if (bg == null) {                bg = c.getBackground();            }        }         //        // Draw caret in XOR mode.        //        public void paint(Graphics g) {            if(isVisible()) {                try {                    Rectangle r = component.modelToView(getDot());                    g.setXORMode(bg);                    g.drawLine(r.x, r.y, r.x, r.y + r.height - 1);                    g.setPaintMode();                } catch (BadLocationException e) {                    // can't render I guess                    //System.err.println("Can't render cursor");                }            }        }         //        // If some area other than the composed text is clicked by mouse,        // issue endComposition() to force commit the composed text.        //        protected void positionCaret(MouseEvent me) {            JTextComponent host = component;            Point pt = new Point(me.getX(), me.getY());            int offset = host.viewToModel(pt);            int composedStartIndex = host.composedTextStart.getOffset();            if ((offset < composedStartIndex) ||                (offset > composedTextEnd.getOffset())) {                try {                    // Issue endComposition                    Position newPos = host.getDocument().createPosition(offset);                    host.getInputContext().endComposition();                     // Post a caret positioning runnable to assure that the positioning                    // occurs *after* committing the composed text.                    EventQueue.invokeLater(new DoSetCaretPosition(host, newPos));                } catch (BadLocationException ble) {                    System.err.println(ble);                }            } else {                // Normal processing                super.positionCaret(me);            }        }    }     //    // Runnable class for invokeLater() to set caret position later.    //    private class DoSetCaretPosition implements Runnable {        JTextComponent host;        Position newPos;         DoSetCaretPosition(JTextComponent host, Position newPos) {            this.host = host;            this.newPos = newPos;        }         public void run() {            host.setCaretPosition(newPos.getOffset());        }    }}

Lines 5001–5073 of 5073. Previous lines

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t