java.awt.Canvas.isDisplayable()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(228)

本文整理了Java中java.awt.Canvas.isDisplayable()方法的一些代码示例,展示了Canvas.isDisplayable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Canvas.isDisplayable()方法的具体详情如下:
包路径:java.awt.Canvas
类名称:Canvas
方法名:isDisplayable

Canvas.isDisplayable介绍

暂无

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

  1. while (!canvas.isDisplayable()){
  2. try {
  3. Thread.sleep(10);

代码示例来源:origin: us.ihmc.thirdparty.jme/jme3-lwjgl

  1. while (!canvas.isDisplayable()){
  2. try {
  3. Thread.sleep(10);

代码示例来源:origin: org.processing/core

  1. synchronized protected void render() {
  2. if (canvas.isDisplayable() &&
  3. graphics.image != null) {
  4. if (canvas.getBufferStrategy() == null) {
  5. canvas.createBufferStrategy(2);
  6. }
  7. BufferStrategy strategy = canvas.getBufferStrategy();
  8. if (strategy != null) {
  9. // Render single frame
  10. // try {
  11. do {
  12. // The following loop ensures that the contents of the drawing buffer
  13. // are consistent in case the underlying surface was recreated
  14. do {
  15. Graphics2D draw = (Graphics2D) strategy.getDrawGraphics();
  16. // draw to width/height, since this may be a 2x image
  17. draw.drawImage(graphics.image, 0, 0, sketchWidth, sketchHeight, null);
  18. draw.dispose();
  19. } while (strategy.contentsRestored());
  20. // Display the buffer
  21. strategy.show();
  22. // Repeat the rendering if the drawing buffer was lost
  23. } while (strategy.contentsLost());
  24. }
  25. }
  26. }

相关文章