Skip to content

SwingBox Chinese garbled code  #84

@nenoxj

Description

@nenoxj

I used Swingbox to build the code, but the Chinese characters were garbled.

  • I am trying to use BrowserConfig to set the Asian font to be invalid
  • My attempt to modify the custom charset is also invalid

Test Method:
`
BrowserConfig browserConfig=new BrowserConfig();
browserConfig.setDefaultFont(java.awt.Font.SANS_SERIF, "Arial");
browserConfig.registerDOMSource(DefaultDOMSource.class);
BrowserPane swingbox = new BrowserPane();
JTextField input = new JTextField("file:///F:/Person_workspace/note-single-html/single/demo/simple-local.html");
JButton text = ButtonFactory.primaryButton("测试");
text.addActionListener(e -> {
try {
swingbox.setPage(new URL(input.getText()));
} catch (IOException e1) {
e1.printStackTrace();
swingbox.setText("加载html错误!");
swingbox.repaint();
}
});
view.add(input, "grow");
view.add(text, "wrap");
view.add(new JScrollPane(swingbox), "span 2,grow");

`
image

simple-local.html Just a simple bootstrap example

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions