(int[] location, int[] editorLocation)
| 861 | |
| 862 | |
| 863 | @Override |
| 864 | public void placeWindow(int[] location, int[] editorLocation) { |
| 865 | //Dimension window = setFrameSize(sketchWidth, sketchHeight); |
| 866 | Dimension window = setFrameSize(); //sketchWidth, sketchHeight); |
| 867 | |
| 868 | int contentW = Math.max(sketchWidth, MIN_WINDOW_WIDTH); |
| 869 | int contentH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT); |
| 870 | |
| 871 | if (sketch.sketchFullScreen()) { |
| 872 | setFullFrame(); |
| 873 | } |
| 874 | |
| 875 | // Ignore placement of previous window and editor when full screen |
| 876 | if (!sketch.sketchFullScreen()) { |
| 877 | if (location != null) { |
| 878 | // a specific location was received from the Runner |
| 879 | // (applet has been run more than once, user placed window) |
| 880 | frame.setLocation(location[0], location[1]); |
| 881 | |
| 882 | } else if (editorLocation != null) { |
| 883 | int locationX = editorLocation[0] - 20; |
| 884 | int locationY = editorLocation[1]; |
| 885 | |
| 886 | if (locationX - window.width > 10) { |
| 887 | // if it fits to the left of the window |
| 888 | frame.setLocation(locationX - window.width, locationY); |
| 889 | |
| 890 | } else { // doesn't fit |
| 891 | // if it fits inside the editor window, |
| 892 | // offset slightly from upper lefthand corner |
| 893 | // so that it's plunked inside the text area |
| 894 | //locationX = editorLocation[0] + 66; |
| 895 | //locationY = editorLocation[1] + 66; |
| 896 | locationX = (sketch.displayWidth - window.width) / 2; |
| 897 | locationY = (sketch.displayHeight - window.height) / 2; |
| 898 | |
| 899 | /* |
| 900 | if ((locationX + window.width > sketch.displayWidth - 33) || |
| 901 | (locationY + window.height > sketch.displayHeight - 33)) { |
| 902 | // otherwise center on screen |
| 903 | locationX = (sketch.displayWidth - window.width) / 2; |
| 904 | locationY = (sketch.displayHeight - window.height) / 2; |
| 905 | } |
| 906 | */ |
| 907 | frame.setLocation(locationX, locationY); |
| 908 | } |
| 909 | } else { // just center on screen |
| 910 | setFrameCentered(); |
| 911 | } |
| 912 | Point frameLoc = frame.getLocation(); |
| 913 | if (frameLoc.y < 0) { |
| 914 | // Windows actually allows you to place frames where they can't be |
| 915 | // closed. Awesome. http://dev.processing.org/bugs/show_bug.cgi?id=1508 |
| 916 | frame.setLocation(frameLoc.x, 30); |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | canvas.setBounds((contentW - sketchWidth)/2, |
nothing calls this directly
no test coverage detected