I use BorderLayout
, I put something in north and something in south, but there always has a white line between this two panel (north and south), how to delete this line?
I have try to setVGap
and set HGap
for BorderLayout
and I have try to set the background color for the parent frame, that don't work either
Thank you for your help, now i put some code here, maybe you can see something wrong.
public class MediaSelector extends JPanel{
public MediaSelector() {
setBorder(new EmptyBorder(-1, -1, 0, -2));
setBackground(Color.red);
setLayout(new BorderLayout());
JPanel panel1 = new JPanel();
panel1.setBackground(new Color(home_screen_r,home_screen_g,home_screen_b));
panel1.setLayout(null);
JPanel buttonPane = new JPanel();
GridBagLayout gridbag = new GridBagLayout();
buttonPane.setLayout(gridbag);
buttonPane.setBackground(new Color(footer_r, footer_g, footer_b));
add("North", panel1);
add("South", buttonPane);
}
main(){
mediaSelectorPane = new MediaSelector();
mediaSelectorPane.setOpaque(true); // content panes must be opaque
frame.setContentPane(mediaSelectorPane);
if (isFullScreen) {
frame.dispose();
frame.setUndecorated(true);
frame.getGraphicsConfiguration().getDevice()
.setFullScreenWindow(frame);
frame.setVisible(true);
}
}