I'm using this string for a Java swing JLabel:
"<html>\n" +
"<head><style>\n" +
"p { color: white;\n" +
" text-shadow:\n" +
" -1px -1px 0 #000,\n" +
" 1px -1px 0 #000,\n" +
" -1px 1px 0 #000,\n" +
" 1px 1px 0 #000; }" +
"</style></head>\n" +
"<body><p>testing123</p></body>\n" +
"</html>"
Which is a slightly modified example I found of how to stroke the outline around text with HTML. When I do this, "testing123" shows up in white (or whatever color I place of white), which is good, but no shadow or outline is ever visible, regardless of background. This works on the w3schools css tester page. I read that it only works on certain browsers, so I'm guessing that excludes swing? Is there any way to make this work?
I read that it only works on certain browsers, so I'm guessing that excludes swing?
You guessed right! Swing's HTML support includes a sub-set of HTML 3.2 . The CSS support is equally patchy and incomplete.
Is there any way to make this work?
The Java-FX based WebView
would seem to be the best approach. Java-FX based components can be embedded into Swing apps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.