朋友,我嘗試使用seticon方法將圖像添加到我的Jbutton中,但是它會隱藏按鈕上的文本標簽。這是代碼: try { Image img = ImageIO.read(getClass().getResource("image.jpg")); studentsButton.setIcon(new ImageIcon(img)); } catch (IOException ex) { }我在eclipse中使用swing而不使用init()/ paint()/ graphics,它是main方法中的簡單框架。
添加回答
舉報
0/150
提交
取消