Skip to content

Commit 9c21632

Browse files
committed
hi-dpi handling for default message dialog
1 parent af0e6fc commit 9c21632

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/processing/mode/android/AndroidUtil.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@
4242
import processing.app.Platform;
4343
import processing.app.SketchException;
4444
import processing.app.Util;
45+
import processing.app.ui.Toolkit;
4546
import processing.core.PApplet;
4647

4748
/**
4849
* Some utilities.
4950
*/
5051
public class AndroidUtil {
52+
final static private int FONT_SIZE = Toolkit.zoom(11);
53+
final static private int TEXT_MARGIN = Toolkit.zoom(8);
54+
final static private int TEXT_WIDTH = Toolkit.zoom(300);
5155

5256
// Creates a message dialog, where the text can contain clickable links.
5357
static public void showMessage(String title, String text) {
@@ -56,8 +60,10 @@ static public void showMessage(String title, String text) {
5660
System.out.println(title + ": " + text);
5761
} else {
5862
String htmlString = "<html> " +
59-
"<head> <style type=\"text/css\">"+
60-
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px; width: 300px }"+
63+
"<head> <style type=\"text/css\">" +
64+
"p { font: " + FONT_SIZE + "pt \"Lucida Grande\"; " +
65+
"margin: " + TEXT_MARGIN + "px; " +
66+
"width: " + TEXT_WIDTH + "px }" +
6167
"</style> </head>" +
6268
"<body> <p>" + text + "</p> </body> </html>";
6369
JEditorPane pane = new JEditorPane("text/html", htmlString);

0 commit comments

Comments
 (0)