Results 1 to 1 of 1
  1. #1
    xlomo is offline Member
    Join Date
    Dec 2010
    Posts
    19
    Rep Power
    0

    Default JEditorPane Text selecting and cursor position problems after scaling

    I have a JEditorPane that displays HTML files, with overriden paintComponent function as follows :
    Java Code:
       
        protected void paintComponent(Graphics g) {
        Graphics2D g2d= (Graphics2D)g;
        g2d.scale(zoom, zoom);
        
        super.paintComponent(g2d);        
        }
    This allows me to change the EditorPane's content size, like zooming.
    My problem is that when i do that, with zoom diferent than 1, whenever I select text from the EditorPane with the mouse, it selects the text that would have been there before the zoom, thus returning wrong results.
    To further explain the getSelectionStart() and getSelectionEnd() of the editor pane dont work correctly, any possible workaround ?
    Last edited by xlomo; 10-29-2011 at 08:10 PM.

Similar Threads

  1. Invalid operation at current cursor position
    By bcg9 in forum New To Java
    Replies: 4
    Last Post: 02-26-2013, 09:38 AM
  2. Selecting a text
    By mathnitin in forum Advanced Java
    Replies: 12
    Last Post: 02-27-2011, 07:04 PM
  3. cursor position in text area
    By Saran185 in forum AWT / Swing
    Replies: 1
    Last Post: 02-02-2011, 07:00 AM
  4. Printing, scaling, dpi problems...
    By aragornx in forum AWT / Swing
    Replies: 0
    Last Post: 11-30-2010, 12:28 PM
  5. how to place cursor at end of each line in JEditorPane
    By prasad.vara in forum AWT / Swing
    Replies: 2
    Last Post: 10-25-2010, 12:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •