我有一个奇怪的白色条纹(见下文)出现在我的背景图像上。代码很简单。如何摆脱白色条纹?JFrame奇怪的白色条纹背景图像
//Graphics side of the game
public class GUI extends JFrame {
private final int larghezza = 1280;
private final int altezza = 720;
private final String name = "Sette e Mezzo";
private final ImageIcon backgroundImage;
private JLabel bgImageLabel;
private JPanel backgroundPanel, borderLayoutPanel, topGridLayout, botGridLayout;
public GUI() {
backgroundImage = new ImageIcon ("assets/background.png");
bgImageLabel = new JLabel (backgroundImage);
//Panels
borderLayoutPanel = new JPanel (new BorderLayout());
topGridLayout = new JPanel (new GridLayout (1, 3));
botGridLayout = new JPanel (new GridLayout (1, 3));
backgroundPanel = new JPanel();
backgroundPanel.add (bgImageLabel);
//Frame
this.setName (name);
this.setPreferredSize (new Dimension(larghezza, altezza));
this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
//Adding to frame and panels
borderLayoutPanel.add (topGridLayout, BorderLayout.NORTH);
borderLayoutPanel.add (botGridLayout, BorderLayout.SOUTH);
this.add (borderLayoutPanel);
this.add (backgroundPanel);
this.pack();
this.setLocationRelativeTo (null);
this.setVisible (true);
}
}
1)为了更好地帮助越早,张贴[MCVE]或[简要,独立的,正确的示例](http://www.sscce.org/)。 (例如,为了完成上面的代码需要导入和一个主要的方法)2)*“'新的ImageIcon(”assets/background.png“);'”*一个例子获取图像的方法是以热点链接到[本问答](http://stackoverflow.com/q/19209650/418556)中看到的图像。 –
.. 3)顺便说一句 - 这不是白色的,它是RGB(255,250,254)。 –