问题描述
我似乎无法查看 a1 JPanel 中的所有三个组件(JTextPanel、Image 和 Button),它只显示中间组件(在这种情况下仅显示图片)。而如果我删除 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);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)