| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9585,9 +9585,34 @@ protected PSurface initSurface(Color backgroundColor, int displayIndex, | |||
| 9585 | 9585 | g = createPrimaryGraphics(); | |
| 9586 | 9586 | surface = g.createSurface(); | |
| 9587 | 9587 | if (g.displayable()) { | |
| 9588 | - frame = surface.initFrame(this, backgroundColor, displayIndex, present, spanDisplays); | ||
| 9589 | - //surface.setTitle(getClass().getName()); | ||
| 9590 | - frame.setTitle(getClass().getName()); | ||
| 9588 | + frame = new Frame() { | ||
| 9589 | + @Override | ||
| 9590 | + public void setResizable(boolean resizable) { | ||
| 9591 | + deprecationWarning("setResizable"); | ||
| 9592 | + surface.setResizable(resizable); | ||
| 9593 | + } | ||
| 9594 | + | ||
| 9595 | + @Override | ||
| 9596 | + public void setVisible(boolean visible) { | ||
| 9597 | + deprecationWarning("setVisible"); | ||
| 9598 | + surface.setVisible(visible); | ||
| 9599 | + } | ||
| 9600 | + | ||
| 9601 | + @Override | ||
| 9602 | + public void setTitle(String title) { | ||
| 9603 | + deprecationWarning("setTitle"); | ||
| 9604 | + surface.setTitle(title); | ||
| 9605 | + } | ||
| 9606 | + | ||
| 9607 | + private void deprecationWarning(String method) { | ||
| 9608 | + PGraphics.showWarning("Use surface." + method + "() instead of " + | ||
| 9609 | + "frame." + method + " in Processing 3"); | ||
| 9610 | + } | ||
| 9611 | + }; | ||
| 9612 | + | ||
| 9613 | + surface.initFrame(this, backgroundColor, displayIndex, present, spanDisplays); | ||
| 9614 | + surface.setTitle(getClass().getName()); | ||
| 9615 | + //frame.setTitle(getClass().getName()); | ||
| 9591 | 9616 | // } else { | |
| 9592 | 9617 | // // TODO necessary? | |
| 9593 | 9618 | // surface.initOffscreen(this); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,6 @@ | |||
| 24 | 24 | ||
| 25 | 25 | import java.awt.Color; | |
| 26 | 26 | import java.awt.Component; | |
| 27 | - import java.awt.Frame; | ||
| 28 | 27 | ||
| 29 | 28 | ||
| 30 | 29 | public interface PSurface { | |
@@ -48,23 +47,24 @@ public interface PSurface { | |||
| 48 | 47 | ||
| 49 | 48 | public Component initComponent(PApplet sketch); | |
| 50 | 49 | ||
| 51 | - public Frame initFrame(PApplet sketch, Color backgroundColor, | ||
| 52 | - int deviceIndex, boolean fullScreen, boolean spanDisplays); | ||
| 50 | + //public Frame initFrame(PApplet sketch, Color backgroundColor, | ||
| 51 | + public void initFrame(PApplet sketch, Color backgroundColor, | ||
| 52 | + int deviceIndex, boolean fullScreen, boolean spanDisplays); | ||
| 53 | 53 | ||
| 54 | 54 | // | |
| 55 | 55 | ||
| 56 | 56 | // Just call these on an AWT Frame object stored in PApplet. | |
| 57 | 57 | // Silly, but prevents a lot of rewrite and extra methods for little benefit. | |
| 58 | 58 | // However, maybe prevents us from having to document the 'frame' variable? | |
| 59 | 59 | ||
| 60 | - // /** Set the window (and dock, or whatever necessary) title. */ | ||
| 61 | - // public void setTitle(String title); | ||
| 62 | - // | ||
| 63 | - // /** Show or hide the window. */ | ||
| 64 | - // public void setVisible(boolean visible); | ||
| 65 | - // | ||
| 66 | - // /** Set true if we want to resize things (default is not resizable) */ | ||
| 67 | - // public void setResizable(boolean resizable); | ||
| 60 | + /** Set the window (and dock, or whatever necessary) title. */ | ||
| 61 | + public void setTitle(String title); | ||
| 62 | + | ||
| 63 | + /** Show or hide the window. */ | ||
| 64 | + public void setVisible(boolean visible); | ||
| 65 | + | ||
| 66 | + /** Set true if we want to resize things (default is not resizable) */ | ||
| 67 | + public void setResizable(boolean resizable); | ||
| 68 | 68 | ||
| 69 | 69 | // | |
| 70 | 70 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -387,7 +387,7 @@ public Component initComponent(PApplet sketch) { | |||
| 387 | 387 | ||
| 388 | 388 | ||
| 389 | 389 | @Override | |
| 390 | - public Frame initFrame(PApplet sketch, Color backgroundColor, | ||
| 390 | + public void initFrame(PApplet sketch, Color backgroundColor, | ||
| 391 | 391 | int deviceIndex, boolean fullScreen, boolean spanDisplays) { | |
| 392 | 392 | this.sketch = sketch; | |
| 393 | 393 | ||
@@ -514,46 +514,49 @@ public Frame initFrame(PApplet sketch, Color backgroundColor, | |||
| 514 | 514 | // http://code.google.com/p/processing/issues/detail?id=467 | |
| 515 | 515 | frame.setResizable(false); | |
| 516 | 516 | ||
| 517 | - return frame; | ||
| 517 | + // return frame; | ||
| 518 | 518 | } | |
| 519 | 519 | ||
| 520 | 520 | ||
| 521 | - // /** Set the window (and dock, or whatever necessary) title. */ | ||
| 522 | - // public void setTitle(String title) { | ||
| 523 | - // frame.setTitle(title); | ||
| 524 | - // } | ||
| 525 | - // | ||
| 526 | - // | ||
| 527 | - // /** Set true if we want to resize things (default is not resizable) */ | ||
| 528 | - // public void setResizable(boolean resizable) { | ||
| 529 | - // this.resizable = resizable; // really only used for canvas | ||
| 530 | - // | ||
| 531 | - // if (frame != null) { | ||
| 532 | - // frame.setResizable(resizable); | ||
| 533 | - // } | ||
| 534 | - // } | ||
| 535 | - // | ||
| 536 | - // | ||
| 537 | - // public void setVisible(boolean visible) { | ||
| 538 | - // frame.setVisible(visible); | ||
| 539 | - // | ||
| 540 | - // // removing per https://github.com/processing/processing/pull/3162 | ||
| 541 | - // // can remove the code below once 3.0a6 is tested and behaving | ||
| 542 | - ///* | ||
| 543 | - // if (visible && PApplet.platform == PConstants.LINUX) { | ||
| 544 | - // // Linux doesn't deal with insets the same way. We get fake insets | ||
| 545 | - // // earlier, and then the window manager will slap its own insets | ||
| 546 | - // // onto things once the frame is realized on the screen. Awzm. | ||
| 547 | - // if (PApplet.platform == PConstants.LINUX) { | ||
| 548 | - // Insets insets = frame.getInsets(); | ||
| 549 | - // frame.setSize(Math.max(sketchWidth, MIN_WINDOW_WIDTH) + | ||
| 550 | - // insets.left + insets.right, | ||
| 551 | - // Math.max(sketchHeight, MIN_WINDOW_HEIGHT) + | ||
| 552 | - // insets.top + insets.bottom); | ||
| 553 | - // } | ||
| 554 | - // } | ||
| 555 | - //*/ | ||
| 556 | - // } | ||
| 521 | + /** Set the window (and dock, or whatever necessary) title. */ | ||
| 522 | + @Override | ||
| 523 | + public void setTitle(String title) { | ||
| 524 | + frame.setTitle(title); | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + | ||
| 528 | + /** Set true if we want to resize things (default is not resizable) */ | ||
| 529 | + @Override | ||
| 530 | + public void setResizable(boolean resizable) { | ||
| 531 | + //this.resizable = resizable; // really only used for canvas | ||
| 532 | + | ||
| 533 | + if (frame != null) { | ||
| 534 | + frame.setResizable(resizable); | ||
| 535 | + } | ||
| 536 | + } | ||
| 537 | + | ||
| 538 | + | ||
| 539 | + @Override | ||
| 540 | + public void setVisible(boolean visible) { | ||
| 541 | + frame.setVisible(visible); | ||
| 542 | + | ||
| 543 | + // removing per https://github.com/processing/processing/pull/3162 | ||
| 544 | + // can remove the code below once 3.0a6 is tested and behaving | ||
| 545 | + /* | ||
| 546 | + if (visible && PApplet.platform == PConstants.LINUX) { | ||
| 547 | + // Linux doesn't deal with insets the same way. We get fake insets | ||
| 548 | + // earlier, and then the window manager will slap its own insets | ||
| 549 | + // onto things once the frame is realized on the screen. Awzm. | ||
| 550 | + if (PApplet.platform == PConstants.LINUX) { | ||
| 551 | + Insets insets = frame.getInsets(); | ||
| 552 | + frame.setSize(Math.max(sketchWidth, MIN_WINDOW_WIDTH) + | ||
| 553 | + insets.left + insets.right, | ||
| 554 | + Math.max(sketchHeight, MIN_WINDOW_HEIGHT) + | ||
| 555 | + insets.top + insets.bottom); | ||
| 556 | + } | ||
| 557 | + } | ||
| 558 | + */ | ||
| 559 | + } | ||
| 557 | 560 | ||
| 558 | 561 | ||
| 559 | 562 | //public void placeFullScreen(boolean hideStop) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -167,48 +167,67 @@ public void start(final Stage stage) { | |||
| 167 | 167 | } | |
| 168 | 168 | ||
| 169 | 169 | ||
| 170 | - public Frame initFrame(PApplet sketch, java.awt.Color backgroundColor, | ||
| 170 | + //public Frame initFrame(PApplet sketch, java.awt.Color backgroundColor, | ||
| 171 | + public void initFrame(PApplet sketch, java.awt.Color backgroundColor, | ||
| 171 | 172 | int deviceIndex, boolean fullScreen, | |
| 172 | 173 | boolean spanDisplays) { | |
| 173 | 174 | this.sketch = sketch; | |
| 174 | 175 | PApplicationFX.surface = this; | |
| 175 | - Frame frame = new DummyFrame(); | ||
| 176 | + //Frame frame = new DummyFrame(); | ||
| 176 | 177 | new Thread(new Runnable() { | |
| 177 | 178 | public void run() { | |
| 178 | 179 | Application.launch(PApplicationFX.class); | |
| 179 | 180 | } | |
| 180 | 181 | }).start(); | |
| 181 | - return frame; | ||
| 182 | + //return frame; | ||
| 182 | 183 | } | |
| 183 | 184 | ||
| 184 | 185 | ||
| 185 | - class DummyFrame extends Frame { | ||
| 186 | + /** Set the window (and dock, or whatever necessary) title. */ | ||
| 187 | + public void setTitle(String title) { | ||
| 188 | + // TODO ignored? | ||
| 189 | + } | ||
| 186 | 190 | ||
| 187 | - public DummyFrame() { | ||
| 188 | - super(); | ||
| 189 | - } | ||
| 190 | 191 | ||
| 191 | - @Override | ||
| 192 | - public void setResizable(boolean resizable) { | ||
| 193 | - // TODO | ||
| 194 | - } | ||
| 192 | + /** Show or hide the window. */ | ||
| 193 | + public void setVisible(boolean visible) { | ||
| 194 | + // TODO ignored? | ||
| 195 | + } | ||
| 195 | 196 | ||
| 196 | - @Override | ||
| 197 | - public void setVisible(boolean visible) { | ||
| 198 | - stage.show(); | ||
| 199 | - } | ||
| 200 | 197 | ||
| 201 | - @Override | ||
| 202 | - public void setTitle(String title) { | ||
| 203 | - if (stage != null) { | ||
| 204 | - stage.setTitle(title); | ||
| 205 | - } else { | ||
| 206 | - System.err.println("stage was null for setTitle()"); | ||
| 207 | - } | ||
| 208 | - } | ||
| 198 | + /** Set true if we want to resize things (default is not resizable) */ | ||
| 199 | + public void setResizable(boolean resizable) { | ||
| 200 | + // TODO ignored? | ||
| 209 | 201 | } | |
| 210 | 202 | ||
| 211 | 203 | ||
| 204 | + // class DummyFrame extends Frame { | ||
| 205 | + // | ||
| 206 | + // public DummyFrame() { | ||
| 207 | + // super(); | ||
| 208 | + // } | ||
| 209 | + // | ||
| 210 | + // @Override | ||
| 211 | + // public void setResizable(boolean resizable) { | ||
| 212 | + // // TODO | ||
| 213 | + // } | ||
| 214 | + // | ||
| 215 | + // @Override | ||
| 216 | + // public void setVisible(boolean visible) { | ||
| 217 | + // stage.show(); | ||
| 218 | + // } | ||
| 219 | + // | ||
| 220 | + // @Override | ||
| 221 | + // public void setTitle(String title) { | ||
| 222 | + // if (stage != null) { | ||
| 223 | + // stage.setTitle(title); | ||
| 224 | + // } else { | ||
| 225 | + // System.err.println("stage was null for setTitle()"); | ||
| 226 | + // } | ||
| 227 | + // } | ||
| 228 | + // } | ||
| 229 | + | ||
| 230 | + | ||
| 212 | 231 | /* | |
| 213 | 232 | public class PApplicationFX extends Application { | |
| 214 | 233 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,6 @@ | |||
| 24 | 24 | ||
| 25 | 25 | import java.awt.Color; | |
| 26 | 26 | import java.awt.Component; | |
| 27 | - import java.awt.Frame; | ||
| 28 | 27 | ||
| 29 | 28 | ||
| 30 | 29 | /** | |
@@ -55,10 +54,27 @@ public Component initComponent(PApplet sketch) { | |||
| 55 | 54 | } | |
| 56 | 55 | ||
| 57 | 56 | ||
| 58 | - public Frame initFrame(PApplet sketch, Color backgroundColor, | ||
| 57 | + public void initFrame(PApplet sketch, Color backgroundColor, | ||
| 59 | 58 | int deviceIndex, boolean fullScreen, | |
| 60 | 59 | boolean spanDisplays) { | |
| 61 | - return null; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + | ||
| 63 | + /** Set the window (and dock, or whatever necessary) title. */ | ||
| 64 | + public void setTitle(String title) { | ||
| 65 | + // TODO ignored? | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + | ||
| 69 | + /** Show or hide the window. */ | ||
| 70 | + public void setVisible(boolean visible) { | ||
| 71 | + // TODO ignored? | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + /** Set true if we want to resize things (default is not resizable) */ | ||
| 76 | + public void setResizable(boolean resizable) { | ||
| 77 | + // TODO ignored? | ||
| 62 | 78 | } | |
| 63 | 79 | ||
| 64 | 80 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments