逛奔的蜗牛

我不聪明,但我会很努力

   ::  :: 新随笔 ::  ::  :: 管理 ::

        textArea.addCaretListener(new CaretListener() {

            public void caretUpdate(CaretEvent e) {

                try {

                    // Show the caret's position in the status bar.

                    int row = textArea.getLineOfOffset(e.getDot());

                    int column = e.getDot() - textArea.getLineStartOffset(row);

                    statusLabel.setText("Line: " + (row + 1) + ", Column: " + column);

                } catch (Exception e2) {

                    e2.printStackTrace();

                }

            }

        });


posted on 2009-05-27 04:57 逛奔的蜗牛 阅读(1926) 评论(0)  编辑 收藏 引用 所属分类: Java

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理