Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By SurfMan

Thread: Remove border in Jtable

  1. #1
    Join Date
    Apr 2015
    Posts
    2
    Rep Power
    0

    Question Remove border in Jtable

    How can I remove the light blue border?I tried to remove all the things that I know.

    Remove border in Jtable-omg.png
    Last edited by kitman20022002; 04-26-2015 at 05:28 AM.

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,991
    Rep Power
    8

    Default Re: Remove border in Jtable

    Isn't that the border of the JScrollPane that's surrounds it?
    kitman20022002 likes this.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

    Default Re: Remove border in Jtable

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,991
    Rep Power
    8

    Default Re: Remove border in Jtable

    Quote Originally Posted by DarrylBurke View Post
    Aaaaaaarrrrggggh! For gods sake! At least I beat camickr to the answer :)
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  5. #5
    Join Date
    Apr 2015
    Posts
    2
    Rep Power
    0

    Default Re: Remove border in Jtable

    Thanks , I didn't know because about the JScrollPane

  6. #6
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Remove border in Jtable

    You can "remove" the scrollpane border by creating a new border of size 0, or transparent color and applying it to the scrollpane.

    Java Code:
    LineBorder lb = new LineBorder(new Color(0,0,0,0)); // transparent border
    LineBorder lb = new LineBorder(Color.black, 0); // zero thickness border
    However, if you remove the ScrollPane border the left and top side of the table will be blank so you will have to add your own JTable border. You may also want to try the following to limit how much of the scrollpane is showing.

    Java Code:
    table.setPreferredScrollableViewportSize();
    You could even rig it to grow dynamically as more rows or columns are added.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. How to Add,Remove Rows in JTable
    By Dinesh_rockz in forum AWT / Swing
    Replies: 2
    Last Post: 02-03-2011, 05:30 AM
  2. Remove Jtable rows
    By anilkumar_vist in forum Advanced Java
    Replies: 2
    Last Post: 09-17-2010, 08:03 AM
  3. Add or remove a row on a jtable with Netbeans 6.0
    By Pieter in forum AWT / Swing
    Replies: 8
    Last Post: 07-12-2010, 06:18 PM
  4. How to remove border in JComboBox
    By tiro in forum AWT / Swing
    Replies: 2
    Last Post: 03-08-2009, 05:45 PM

Tags for this Thread

Posting Permissions

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