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

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

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

Canvas.getWidth介绍

暂无

代码示例

代码示例来源:origin: libgdx/libgdx

  1. public int getWidth () {
  2. return Math.round(super.getWidth() * scaleX);
  3. }

代码示例来源:origin: libgdx/libgdx

  1. public int getWidth () {
  2. return Math.round(super.getWidth() * scaleX);
  3. }

代码示例来源:origin: libgdx/libgdx

  1. private void checkCatched (MouseEvent e) {
  2. if (catched && robot != null && canvas.isShowing()) {
  3. int x = Math.max(0, Math.min(e.getX(), canvas.getWidth()) - 1) + canvas.getLocationOnScreen().x;
  4. int y = Math.max(0, Math.min(e.getY(), canvas.getHeight()) - 1) + canvas.getLocationOnScreen().y;
  5. if (e.getX() < 0 || e.getX() >= canvas.getWidth() || e.getY() < 0 || e.getY() >= canvas.getHeight()) {
  6. robot.mouseMove(x, y);
  7. }
  8. }
  9. }

代码示例来源:origin: libgdx/libgdx

  1. private void checkCatched (MouseEvent e) {
  2. if (catched && robot != null && canvas.isShowing()) {
  3. int x = Math.max(0, Math.min(e.getX(), canvas.getWidth()) - 1) + canvas.getLocationOnScreen().x;
  4. int y = Math.max(0, Math.min(e.getY(), canvas.getHeight()) - 1) + canvas.getLocationOnScreen().y;
  5. if (e.getX() < 0 || e.getX() >= canvas.getWidth() || e.getY() < 0 || e.getY() >= canvas.getHeight()) {
  6. robot.mouseMove(x, y);
  7. }
  8. }
  9. }

代码示例来源:origin: libgdx/libgdx

  1. public int getWidth () {
  2. if (canvas != null)
  3. return Math.max(1, canvas.getWidth());
  4. else
  5. return (int)(Display.getWidth() * Display.getPixelScaleFactor());
  6. }

代码示例来源:origin: libgdx/libgdx

  1. public int getWidth () {
  2. if (canvas != null)
  3. return Math.max(1, canvas.getWidth());
  4. else
  5. return (int)(Display.getWidth() * Display.getPixelScaleFactor());
  6. }

代码示例来源:origin: libgdx/libgdx

  1. LwjglGraphics (Canvas canvas) {
  2. this.config = new LwjglApplicationConfiguration();
  3. config.width = canvas.getWidth();
  4. config.height = canvas.getHeight();
  5. this.canvas = canvas;
  6. }

代码示例来源:origin: libgdx/libgdx

  1. LwjglGraphics (Canvas canvas) {
  2. this.config = new LwjglApplicationConfiguration();
  3. config.width = canvas.getWidth();
  4. config.height = canvas.getHeight();
  5. this.canvas = canvas;
  6. }

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

  1. int newWidth = Math.max(canvas.getWidth(), 1);
  2. int newHeight = Math.max(canvas.getHeight(), 1);
  3. if (width != newWidth || height != newHeight){

代码示例来源:origin: runelite/runelite

  1. graphics.fillRect(0, 0, client.getCanvas().getWidth(), client.getCanvas().getHeight());

代码示例来源:origin: libgdx/libgdx

  1. int width = graphics.canvas.getWidth();
  2. int height = graphics.canvas.getHeight();
  3. if (lastWidth != width || lastHeight != height) {

代码示例来源:origin: libgdx/libgdx

  1. int width = graphics.canvas.getWidth();
  2. int height = graphics.canvas.getHeight();
  3. if (lastWidth != width || lastHeight != height) {

代码示例来源:origin: google/sagetv

  1. public void componentResized(java.awt.event.ComponentEvent evt)
  2. {
  3. synchronized (inputQueue)
  4. {
  5. inputQueue.add(new java.awt.Dimension(c.getWidth(), c.getHeight()));
  6. inputQueue.notifyAll();
  7. }
  8. }
  9. });

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

  1. private void checkCatched (MouseEvent e) {
  2. if (catched && robot != null && canvas.isShowing()) {
  3. int x = Math.max(0, Math.min(e.getX(), canvas.getWidth()) - 1) + canvas.getLocationOnScreen().x;
  4. int y = Math.max(0, Math.min(e.getY(), canvas.getHeight()) - 1) + canvas.getLocationOnScreen().y;
  5. if (e.getX() < 0 || e.getX() >= canvas.getWidth() || e.getY() < 0 || e.getY() >= canvas.getHeight()) {
  6. robot.mouseMove(x, y);
  7. }
  8. }
  9. }

代码示例来源:origin: google/sagetv

  1. public void componentResized(java.awt.event.ComponentEvent evt)
  2. {
  3. if (myConn != null)
  4. myConn.postResizeEvent(new java.awt.Dimension(c.getWidth(), c.getHeight()));
  5. }
  6. });

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

  1. public int getWidth () {
  2. if (canvas != null)
  3. return Math.max(1, canvas.getWidth());
  4. else
  5. return (int)(Display.getWidth() * Display.getPixelScaleFactor());
  6. }

代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl

  1. LwjglGraphics (Canvas canvas) {
  2. this.config = new LwjglApplicationConfiguration();
  3. config.width = canvas.getWidth();
  4. config.height = canvas.getHeight();
  5. this.canvas = canvas;
  6. }

代码示例来源:origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

  1. /**
  2. * Returns the size of the canvas as a vector.
  3. * @return size of the canvas in pixel
  4. */
  5. public IVector2 getCanvasSize()
  6. {
  7. return new Vector2Double(canvas_.getWidth(), canvas_.getHeight());
  8. }

代码示例来源:origin: com.projectdarkstar.example.projectsnowman/snowman-world-editor

  1. @Override
  2. public void componentResized(ComponentEvent ce) {
  3. impl.resizeCanvas(comp.getWidth(), comp.getHeight());
  4. }
  5. });

代码示例来源:origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

  1. /**
  2. * Returns the size of a pixel.
  3. * @retun size of a pixel
  4. */
  5. public IVector2 getPixelSize()
  6. {
  7. Canvas canvas = canvas_;
  8. if (canvas == null)
  9. return Vector2Double.ZERO;
  10. return paddedSize_.copy().divide(new Vector2Double(canvas.getWidth(), canvas.getHeight()));
  11. }

相关文章