public IMChatListElement(Icon icon, String title, WebButton removeBtn) { this.removeBtn = removeBtn; // 图片和标题 WebLabel titleLabel = new WebLabel(title, icon); titleLabel.setMargin(0, 0, 0, 4); titleLabel.setAlignmentX(WebLabel.LEFT_ALIGNMENT); titleLabel.setOpaque(false); titleLabel.setForeground(Color.WHITE); this.add(titleLabel, BorderLayout.CENTER); this.add(removeBtn, BorderLayout.LINE_END); setPainter(new ChatListElementPainter()); }