Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwingBox Chinese garbled code #84

Open
nenoxj opened this issue Oct 24, 2023 · 0 comments
Open

SwingBox Chinese garbled code #84

nenoxj opened this issue Oct 24, 2023 · 0 comments

Comments

@nenoxj
Copy link

nenoxj commented Oct 24, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant