相关疑难解决方法(0)

在运行时更改字体

请问有没有另一种方法如何在运行时更改Font作为整个AWT/Swing GUI使用FontUIResource,没有任何知识/兴趣,如果有局部变量和JComponents的类型

在此输入图像描述在此输入图像描述

import java.awt.*;
import java.awt.event.*;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import javax.swing.plaf.FontUIResource;
import javax.swing.plaf.basic.BasicComboBoxRenderer;

public class SystemFontDisplayer extends JFrame {

    private static final long serialVersionUID = 1L;
    private JFrame frame = new JFrame("Nimbus UIDeafaults and Font");
    private JComboBox fontsBox;
    private javax.swing.Timer timer = null;
    private JButton testButton = new JButton("testButton");
    private JTextField testTextField = new JTextField("testTextField");
    private JLabel testLabel = new JLabel("testLabel");

    public SystemFontDisplayer() {
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        String[] fontFamilyNames = ge.getAvailableFontFamilyNames(Locale.getDefault());
        fontsBox = new …
Run Code Online (Sandbox Code Playgroud)

java fonts swing jcomponent swingutilities

6
推荐指数
1
解决办法
4586
查看次数

标签 统计

fonts ×1

java ×1

jcomponent ×1

swing ×1

swingutilities ×1