/** * The constructor * * @param title dialog's title */ public FileDialog(String title) { this( Toolkit.getScreenWidth() / 4, Toolkit.getScreenHeight() / 4, Toolkit.getScreenWidth() / 2, Toolkit.getScreenHeight() / 2, title); }
private static int getWidth(String label, String title) { StringTokenizer tokenizer = new StringTokenizer(label, "\n"); int result = 0; while (tokenizer.hasMoreElements()) { String token = tokenizer.nextToken(); if (result < token.length()) { result = token.length(); } } if (title.length() > result) { result = title.length(); } // message nust fit on the schreen if (result > jcurses.system.Toolkit.getScreenWidth() - 3) { result = jcurses.system.Toolkit.getScreenWidth() - 3; } return result; }