我想在我的JDesktopePane上添加一個JLable ..我在下面給出的代碼中寫了......但標籤沒有顯示在窗格上。如何在JDesktopPane上添加JLabel
{
frame1.setContentPane(desktop);
frame1.setSize(900,700);
frame1.setVisible(true);
desktop.setBackground(Color.DARK_GRAY);
JLabel label1 = new JLabel("Main Page", SwingConstants.CENTER);
label1.setFont(new Font("SansSerif",Font.ITALIC + Font.BOLD,54));
desktop.add(label1);**
}
你爲什麼要添加的標籤(或其他任何東西不是一個internalFrame)直接到窗格? – kleopatra