更新时间:2023-01-03 23:24:46
这是一个例子:
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JLabel label = new JLabel("This is a text.");
Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>();
attributes.put(TextAttribute.TRACKING, 0.5);
label.setFont(label.getFont().deriveFont(attributes));
JOptionPane.showMessageDialog(null, label);
});
}
结果: