Skip to content

Commit 707da37

Browse files
committed
修复mac字符显示问题
1 parent 9ea7495 commit 707da37

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/main/java/com/laker/postman/common/component/tree/RequestTreeCellRenderer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
public class RequestTreeCellRenderer extends DefaultTreeCellRenderer {
1919

2020
private static final int ICON_SIZE = 16;
21-
private static final int METHOD_FONT_PX = 8;
22-
private static final int NAME_FONT_PX = 9;
21+
private static final int METHOD_FONT_PX = 9;
22+
private static final int NAME_FONT_PX = 10;
2323

2424
@Override
2525
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded,

src/main/java/com/laker/postman/panel/collections/left/RequestCollectionsLeftPanel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public boolean isPathEditable(TreePath path) {
108108
// 设置树支持多选(支持批量删除)
109109
requestTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
110110
// 设置树的字体和行高
111+
requestTree.setFont(FontsUtil.getDefaultFont(Font.PLAIN, 12));
111112
requestTree.setCellRenderer(new RequestTreeCellRenderer());
112113
requestTree.setRowHeight(28);
113114
JScrollPane treeScrollPane = new JScrollPane(requestTree);

src/main/java/com/laker/postman/panel/history/HistoryPanel.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ protected void initUI() {
7272
// 历史列表
7373
historyListModel = new DefaultListModel<>();
7474
historyList = new JList<>(historyListModel);
75-
historyList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);// 优化:设置固定行高,提升渲染性能
75+
historyList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
76+
// 显式设置字体,确保在 DMG 环境中正确显示字符
77+
historyList.setFont(FontsUtil.getDefaultFont(Font.PLAIN, 12));
78+
// 优化:设置固定行高,提升渲染性能
7679
historyList.setFixedCellHeight(24);
7780
// 使用缓存的 Renderer
7881
historyList.setCellRenderer(new OptimizedHistoryListCellRenderer());

0 commit comments

Comments
 (0)