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 閱讀(364) 評論(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!!  回復  更多評論   


          主站蜘蛛池模板: 宜川县| 巩义市| 朝阳县| 西藏| 苍溪县| 兰西县| 南江县| 秦皇岛市| 西乌| 龙山县| 施秉县| 闸北区| 冷水江市| 福贡县| 塔城市| 通河县| 兴化市| 新建县| 两当县| 靖宇县| 江阴市| 新安县| 隆子县| 昌黎县| 仙居县| 双鸭山市| 张家口市| 堆龙德庆县| 于都县| 鄄城县| 建昌县| 乌鲁木齐县| 化州市| 泸州市| 乌海市| 宜君县| 太原市| 天台县| 博爱县| 荥经县| 西畴县|