samedi 7 novembre 2020

Can't use variable "Line" in if statement

    public static void running() {
        int line = 0;
        try {
            int offset = page[0].getCaretPosition();
            line = page[0].getLineOfOffset(offset);
        } catch (BadLocationException e) {
            e.printStackTrace();
        }
        if(line >= 21) {
            System.out.println("Line 21+");
            page[0].replaceRange("", 0, 21);
        }
    }

This does not work as if(line >= 21) does not show anything in console! Please help and thank you!

Aucun commentaire:

Enregistrer un commentaire