J-XMoses

          J-XMoses

          Why the select method of JTextArea don't take effect.

          In my swing UI, there is JTextArea component named "textarea_webpage", I want to mark some sentence in the textarea as marked using program just as user selecting them using mouse.
          ------------------------------------------------------------Code Below-------------------------------------------------
          textarea_webpage.setSelectionColor(Color.black);
          textarea_webpage.setSelectedTextColor(Color.white);
          textarea_webpage.setSelectedTextColor(Color.white);
          textarea_webpage.select(urlItem.getStart(),urlItem.getEnd()); // the urlItem is self-defined object to store positon information of certain sentences
          ----------------------------------------------------------------------------------------------------------------------------

          Every time the code is executed, there is nothing take place in my textarea.
          After goolge for the answer in the net.
          I found that I forgot the code 
                   
          textarea_webpage.getCaret().setSelectionVisible(true);

          There are so many tricks in Swing designing, I'm just a beginner.
          Pay more attention.

          posted on 2006-02-20 13:32 Java-XMoses 閱讀(360) 評論(1)  編輯  收藏 所屬分類: Java

          Feedback

          # re: Why the select method of JTextArea don't take effect. 2006-09-23 20:23 song

          Thank you!!
          I met the same problem as yours and it give me a lot of troubles.
          But now I have make it.
          Thank you!!  回復  更多評論   


          主站蜘蛛池模板: 饶河县| 海丰县| 东明县| 长治市| 佛坪县| 永定县| 玉环县| 顺义区| 长岛县| 吉木乃县| 开原市| 左贡县| 常熟市| 玉山县| 安顺市| 富顺县| 封丘县| 衢州市| 汽车| 阿克陶县| 富川| 简阳市| 望江县| 中卫市| 电白县| 吉林省| 盈江县| 青阳县| 门头沟区| 榕江县| 文登市| 离岛区| 宝应县| 龙山县| 民和| 彩票| 南乐县| 武隆县| 稷山县| 新巴尔虎左旗| 隆子县|