java - Remove border from JScrollPane -
i have jlist object in jscrollpane , jscrollpane inside of jpanel . jlist memberslist = new jlist(); jpanel memberspanel = new jpanel(); memberspanel.setlayout(new borderlayout()); jscrollpane scrollpane = new jscrollpane(memberslist); memberspanel.add(scrollpane, borderlayout.center); i tried set borders of memberslist, memberspanel , scrollpane null. tried: border emptyborder = borderfactory.createemptyborder(0, 0, 0, 0); memberslist.setborder(emptyborder); memberspanel.setborder(emptyborder); scrollpane.setborder(emptyborder); but somehow can't remove border. doing wrong? the scroll pane has viewport can have own border. scrollpane.setviewportborder(null);