List of utility methods to do Rectangle Create Parse
Rectangle | stringToBounds(String str, Rectangle defaultRect) Parses the string into a Rectangle. Rectangle rect = defaultRect; if ((str != null) && (str.length() > 0)) { String[] xywh = str.split(","); if (xywh.length == 4) { try { Rectangle r = new Rectangle(Integer.parseInt(xywh[0]), Integer.parseInt(xywh[1]), Integer.parseInt(xywh[2]), ... |
Rectangle | stringToRectangle(String s) string To Rectangle try { String[] split = s.split(","); if (split.length >= 4) return new Rectangle(Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]), Integer.parseInt(split[3])); } catch (Exception e) { return null; ... |
Rectangle | stringToRectangle(String s, Rectangle defaultValue) string To Rectangle if (s == null) return defaultValue; String[] sa = s.split(" +"); if (sa.length != 4) return defaultValue; int[] ia = new int[4]; for (int i = 0; i < 4; i++) try { ... |
Rectangle | stringToRectangle(String str) string To Rectangle if (str == null) return null; String[] r = str.split("\\s*,\\s*"); int x = Integer.parseInt(r[0]); int y = Integer.parseInt(r[1]); int width = Integer.parseInt(r[2]); int height = Integer.parseInt(r[3]); return new Rectangle(x, y, width, height); ... |
Rectangle | stringToRectangle(String string, Rectangle defaultValue) Convert a string in the format of x,y,width,height in to a Rectangle object.
if (string == null) { return defaultValue; StringTokenizer t = new StringTokenizer(string, ","); try { return new Rectangle(Integer.parseInt(t.nextToken()), Integer.parseInt(t.nextToken()), Integer.parseInt(t.nextToken()), Integer.parseInt(t.nextToken())); } catch (Exception e) { ... |
Rectangle | stringToRectangle(String value) string To Rectangle Rectangle rect = null; final StringTokenizer tok; if (value != null) { try { tok = new StringTokenizer(value); rect = new Rectangle(Integer.parseInt(tok.nextToken()), Integer.parseInt(tok.nextToken()), Integer.parseInt(tok.nextToken()), Integer.parseInt(tok.nextToken())); } catch (NoSuchElementException e1) { ... |