salut tout le monde
le projet que je réalise me rend dingue !!!
voila je veut changer le curseur l’osque le souris passe sur un text
voila ce que j'utilise mais j'ai une erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
Exception in thread "AWT-EventQueue-1" java.lang.StringIndexOutOfBoundsException: String index out of range: -101
mon code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
public void mouseMoved(MouseEvent e)
    {
        String handel;
        Document doc;
        int pos = textzone.viewToModel(e.getPoint());
        elem = textzone.getStyledDocument().getCharacterElement(pos);
        as = elem.getAttributes(); 
        int posdepart = pos;
        for(; StyleConstants.getBidiLevel(as) == 20; as = textzone.getStyledDocument().getCharacterElement(posdepart).getAttributes())
        {
            posdepart--;
        }
 
        handel = null;
        doc = textzone.getDocument(); 
        try
        {
            handel = doc.getText(0, doc.getLength()).substring(posdepart, doc.getText(0, doc.getLength()).indexOf(" ", posdepart + 1));
 
        }
        catch(BadLocationException ex) {}
        if(handel == null)
        {
            return;
        }
        handel = handel.replaceAll(">", "").trim();
        textzone.setCursor(new Cursor(12));
        if(StyleConstants.getBidiLevel(as) == 21 || StyleConstants.getBidiLevel(as) == 22)
        {
            textzone.setCursor(new Cursor(12));
        } else
        {
            //hyperlinkReceiver.hidePopupInfos();
            textzone.setCursor(new Cursor(0));
        }
    }
vraiment c'est super ce forum il ma aider a apprendre beaucoup de chose