javax.swing.JFrame.createBufferStrategy()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(143)

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

JFrame.createBufferStrategy介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

JFrame jframe = new JFrame ();

...

BufferStrategy bufferstrategy = jframe.getBufferStrategy ();

if (bufferstrategy == null) {
  jframe.createBufferStrategy(3);
  return;
}

g.dispose();
bufferstrategy.show();

代码示例来源:origin: org.datavec/datavec-data-image

public void start() {

    int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData();
    boolean running = true;
    while (running) {
      BufferStrategy bs = frame.getBufferStrategy();
      if (bs == null) {
        frame.createBufferStrategy(4);
        return;
      }
      for (int i = 0; i < width * height; i++)
        pixels[i] = 0;

      Graphics g = bs.getDrawGraphics();
      g.drawImage(img, heightOffset, widthOffset, width, height, null);
      g.dispose();
      bs.show();

    }
  }
}

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

public void start() {

    int[] pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData();
    boolean running = true;
    while (running) {
      BufferStrategy bs = frame.getBufferStrategy();
      if (bs == null) {
        frame.createBufferStrategy(4);
        return;
      }
      for (int i = 0; i < width * height; i++)
        pixels[i] = 0;

      Graphics g = bs.getDrawGraphics();
      g.drawImage(img, heightOffset, widthOffset, width, height, null);
      g.dispose();
      bs.show();

    }
  }
}

代码示例来源:origin: org.nd4j/canova-nd4j-image

public void start(){

    int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
    boolean running = true;
    while(running){
      BufferStrategy bs = frame.getBufferStrategy();
      if(bs==null){
        frame.createBufferStrategy(4);
        return;
      }
      for (int i = 0; i < width * height; i++)
        pixels[i] = 0;

      Graphics g= bs.getDrawGraphics();
      g.drawImage(img, heightOffset, widthOffset, width, height, null);
      g.dispose();
      bs.show();

    }
  }
}

代码示例来源:origin: stackoverflow.com

/*****************************************************************************
* @description: Creates window for program to run in, using appropriate DM
* @param DisplayMode dm 
*/
 public void setFullScreen(DisplayMode dm){
   JFrame f = new JFrame();
   f.setUndecorated(true); //no titlebars/scroll bars etc.
   f.setIgnoreRepaint(true);
   f.setResizable(false); //user cannot resize window
   vc.setFullScreenWindow(f);
   if(dm!=null && vc.isDisplayChangeSupported()){ //if DM is changeable
     try {
       vc.setDisplayMode(dm);
     } catch (Exception e){/*Catch 'em all*/}
   }
   f.createBufferStrategy(2); //set # of screen buffers to 2
 }//setFullScreen()

代码示例来源:origin: klamonte/jexer

/**
 * Setup to render to an existing JFrame.
 */
public void setupFrame() {
  frame.setTitle("Jexer Application");
  frame.setBackground(Color.black);
  frame.pack();
  // Kill the X11 cursor
  // Transparent 16 x 16 pixel cursor image.
  BufferedImage cursorImg = new BufferedImage(16, 16,
    BufferedImage.TYPE_INT_ARGB);
  // Create a new blank cursor.
  Cursor blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(
  cursorImg, new Point(0, 0), "blank cursor");
  frame.setCursor(blankCursor);
  // Be capable of seeing Tab / Shift-Tab
  frame.setFocusTraversalKeysEnabled(false);
  // Setup triple-buffering
  if (tripleBuffer) {
    frame.setIgnoreRepaint(true);
    frame.createBufferStrategy(3);
  }
}

代码示例来源:origin: stackoverflow.com

f.setSize(512, 512);
f.setVisible(true);
f.createBufferStrategy(2);

代码示例来源:origin: stackoverflow.com

frame.setVisible(true);
frame.createBufferStrategy(2);
final BufferStrategy bs = frame.getBufferStrategy();

代码示例来源:origin: stackoverflow.com

amountBuffer = 2;
frame.createBufferStrategy(amountBuffer, bcaps);
bufferStrategy = frame.getBufferStrategy();

相关文章

JFrame类方法