我似乎无法查看a1jpanel中的所有三个组件(jtextpanel、image和button),它只显示中间的组件(本例中仅显示pic)。如果我删除jtextpanel,我可以看到其他两个组件。
GridLayout sold = new GridLayout(1,3);
JPanel a1 = new JPanel();
JPanel a2 = new JPanel();
JPanel a3 = new JPanel();
JPanel a4 = new JPanel();
a1.setLayout(sold);
a2.setLayout(sold);
a3.setLayout(sold);
a4.setLayout(sold);
JPanel t1 = new JPanel();
ImageIcon Img = new ImageIcon("images/shopPane.jpg");
JLabel lblNewLabel = new JLabel();
lblNewLabel.setIcon(Img);
t1.add(lblNewLabel);
JPanel t2 = new JPanel();
JTextPane armor1 = new JTextPane();
armor1.setEditable(false);
armor1.setContentType("text/html");
armor1.setText("<html><h3 style=\"color:white;\">· Name :"+ CessPool.armorz.get(0).name +"<br>"
+"· Health Point : "+ CessPool.armorz.get(0).healthPoint+ "<br>"
+"· Defence : "+ CessPool.armorz.get(0).defence + "<br>"
+ "· Accuracy : "+ CessPool.armorz.get(0).accuracy + "<br>"
+ "· Speed : "+CessPool.armorz.get(0).speed +"</h3> </html>");
armor1.setBackground(Color.black);
t2.add(armor1);
JButton Button1 = new JButton();
Button1.setText("Buy");
Button1.setFocusable(false);
Button1.setFocusPainted(false);
Button1.setBackground(new Color(255, 238, 88));
Button1.setForeground(Color.WHITE);
a1.add(Button1);
a1.add(t1);
a1.add(t2);
this.add(a1);
暂无答案!
目前还没有任何答案,快来回答吧!