CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Sep 2007
    Location
    Philippines
    Posts
    60

    Question JTextArea line (not border) around rect

    In my application I added a JTextArea, and though I set the Border to Empty Border or null, a blue line always surrounds the rect of the JTextArea. I think it's not the border because I tried to set a border for the JTextArea and the blue line was incide the border and still visible. Can someone help me how to remove this line? Thank you very much

    P.S. I'm using Netbaens 6.1 GUI Builder to build the UI of my application. Thanks again
    Last edited by iron59; August 3rd, 2009 at 03:49 AM. Reason: Additional Info

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: JTextArea line (not border) around rect

    Are you sure this isn't the focus marker? If it is then the line will disappear as soon as the focus shifts to another component.

  3. #3
    Join Date
    Sep 2007
    Location
    Philippines
    Posts
    60

    Re: JTextArea line (not border) around rect

    Quote Originally Posted by keang View Post
    Are you sure this isn't the focus marker? If it is then the line will disappear as soon as the focus shifts to another component.
    I don't think so. I have two JTextArea and the were both painted this way

  4. #4
    Join Date
    Apr 2007
    Posts
    442

    Re: JTextArea line (not border) around rect

    Could it have something to do with the gui builder, or layout manager? Some managers have internal debug states that eg. draw a grid around the components getBounds().

  5. #5
    Join Date
    Sep 2007
    Location
    Philippines
    Posts
    60

    Re: JTextArea line (not border) around rect

    Quote Originally Posted by Londbrok View Post
    Could it have something to do with the gui builder, or layout manager? Some managers have internal debug states that eg. draw a grid around the components getBounds().
    If that's the case is there a way to remove it?

  6. #6
    Join Date
    Apr 2007
    Posts
    442

    Re: JTextArea line (not border) around rect

    Would not know how to remove, I do not use netbeans myself and have thus no idea of the respective gui builder. Debug state would sound sensible a thing in a gui builder though.

  7. #7
    Join Date
    Sep 2007
    Location
    Philippines
    Posts
    60

    Re: JTextArea line (not border) around rect

    Quote Originally Posted by Londbrok View Post
    Would not know how to remove, I do not use netbeans myself and have thus no idea of the respective gui builder. Debug state would sound sensible a thing in a gui builder though.
    Sorry I did not what you mean by debug state. I'll run the application in Debug mode? Well I think I'll try to create a renderer for my JTextArea, I hope this works, but I'm still open for suggestions

  8. #8
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: JTextArea line (not border) around rect

    What Londbrok was saying was that the GUI Builder itself might be adding the line so you can see the bounds of the component. If this is the case, it is purely for debug purposes and the lines will not appear when you run the application outside of NetBeans. Also there will almost certainly be a switch you can set to stop these lines showing in NetBeans and it will be possibly be called something like "debug mode", "hide/show bounds" etc.

    What OS and what Look and Feel are you using?

    You will almost certainly not need to create your own renderer to get this to display properly.

  9. #9
    Join Date
    Sep 2007
    Location
    Philippines
    Posts
    60

    Re: JTextArea line (not border) around rect

    The LookAndFeel I'm using right now is the one used by the OS. Now I get what you're trying to say. Thank you very much very much for the clraification. I'll try to look for options and I'll also try to run the program outside Netbeans. If one of these will work, it will save me time creatin my own renderer. I just think its weird thst in Netbeans, this only applies to the JTextArea component. I'll update this thread for progress. Thanks again

  10. #10
    Join Date
    Sep 2007
    Location
    Philippines
    Posts
    60

    Re: JTextArea line (not border) around rect

    I finally figured it out. Netbeans automatically creates a JScrollpane for the textarea and that's where the border comes from. i'm really sorry for my stupidity

  11. #11
    Join Date
    Apr 2007
    Posts
    442

    Re: JTextArea line (not border) around rect

    Automatic scrollpane is not a bad thing. You can get rid of the extra border by setting setBorder(null) on the JScrollPane instance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured