You can browse and search Github Trending in Idea without opening a browser
Java对xml解析方式主流分为Dom、SAX、JDom、Dom4J,但是面对如下两种标签时,会出现xml解析失败:
- 不存在闭合标签
<meta charset="utf-8">
- 属性不以key=value的形式出现
<link rel="preconnect" href="https://github.githubassets.com" crossorigin>
每个条目中的文案长度不一致,导致cell height不相同,由于JBList中的ListUI机制(BasicListUI#updateLayoutState),无法保证JBList+JTextArea支持动态Item高度。
JBList:
JBList listView = new JBList<>();
//设置单选
listView.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
//绑定数据源
listModel = new DefaultListModel<>();
listView.setModel(this.listModel);
//设置UI样式
listView.setCellRenderer(new TrendingCellRender());
//item 点击
listView.addListSelectionListener(e -> {
int index = this.listView.getSelectedIndex();
...
});
Box:
Box listView = Box.createVerticalBox();
listView.add(itemView);
JLabel 无法多行显示,了解 JLabel、JTextArea、JTextField、JEditorPane、JTextComponent 继承关系以及区别
JTextArea descView = new JTextArea();
//设置自动换行
descView.setLineWrap(true);
descView.setWrapStyleWord(true);
//设置透明背景色
descView.setBackground(new Color(0, 0, 0, 0));