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

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

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

Canvas.isDisplayable介绍

暂无

代码示例

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

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

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

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

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

synchronized protected void render() {
  if (canvas.isDisplayable() &&
    graphics.image != null) {
   if (canvas.getBufferStrategy() == null) {
    canvas.createBufferStrategy(2);
   }
   BufferStrategy strategy = canvas.getBufferStrategy();
   if (strategy != null) {
    // Render single frame
//        try {
    do {
     // The following loop ensures that the contents of the drawing buffer
     // are consistent in case the underlying surface was recreated
     do {
      Graphics2D draw = (Graphics2D) strategy.getDrawGraphics();
      // draw to width/height, since this may be a 2x image
      draw.drawImage(graphics.image, 0, 0, sketchWidth, sketchHeight, null);
      draw.dispose();
     } while (strategy.contentsRestored());

     // Display the buffer
     strategy.show();

     // Repeat the rendering if the drawing buffer was lost
    } while (strategy.contentsLost());
   }
  }
 }

相关文章

微信公众号

最新文章

更多