में जोड़कर मैं जेएलएयरपेन को जेपीनल में जोड़ने की कोशिश कर रहा हूं और फिर एक छवि (जेएलएबल आइकन) और जेएलएर्डपेन में एक बटन जोड़ रहा हूं, लेकिन न ही दिखाएं। मैंने बटन और लेयरपेन के बिना छवि का परीक्षण किया है, इसलिए मुझे पता है कि काम करता है। यहां कुछ कोड है जिसका मैं उपयोग कर रहा हूं। क्या मुझे कुछ याद आ रहा है या गलत कर रहा है? तो अपने उदाहरण में आप स्थान और बच्चे घटकों के आकार सेट करना होगाजेएलएरपेन को जेपीनेल
public class MyClass extends JPanel
{
private JLayeredPane layeredPane;
private JLabel imageContainer = new JLabel();
private JButton info = new JButton("i");
MyClass(ImageIcon image)
{
super();
this.imageContainer.setIcon(image);
this.layeredPane = new JLayeredPane();
layeredPane.setPreferredSize(new Dimension(300, 300));
layeredPane.add(imageContainer, new Integer(50));
layeredPane.add(info, new Integer(100));
this.add(layeredPane);
}
}
बिना किसी प्रकार के फ्रेम में MyClass कहां और कैसे जोड़ते हैं, वहां कोई जानकारी नहीं है कि आप गलत कहां गए हैं। –