Images In JFrame are overwriting each other not displaying both images over eachother [duplicate]
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: This question already has an answer here: Why does the first panel added to a frame disappear? 2 answers public class Board extends JFrame { public void bd () { JFrame frame = new JFrame (); JLabel background1 = new JLabel ( new ImageIcon ( "background.png" )); JLabel knight = new JLabel ( new ImageIcon ( "knight.jpg" )); frame . add ( background1 ); frame . add ( knight ); frame . pack (); frame . setResizable ( false ); frame . setVisible ( true ); } } I've been having some trouble with my code when i add the knight image the