3

Can anyone explain to me (point me to right documentation) on how to embed an HTML page into Java dialog box? Thank you all so much.

3 Answers 3

6

The tutorial on How to use HTML in Swing Components will show you how to do it exactly.

Sign up to request clarification or add additional context in comments.

Comments

4

I guess the following code should work for you:

String htmlMsg = "<html>You can use</b>HTML here</html>";

JOptionPane dialogBox = new JOptionPane();
dialogBox.setMessage(msg);
dialogBox.setMessageType(JOptionPane.INFORMATION_MESSAGE);
//....

Comments

2

You could use the LGPL Flying Saucer libraries, it all depends on what you want to achieve with the HTML. It's got XHTML + CSS covered, but is less backwards compatible than other renderers.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.