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

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

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

Canvas.setBounds介绍

暂无

代码示例

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

  1. private void setCanvasSize() {
  2. // System.out.format("setting canvas size %d %d%n", sketchWidth, sketchHeight);
  3. // new Exception().printStackTrace(System.out);
  4. int contentW = Math.max(sketchWidth, MIN_WINDOW_WIDTH);
  5. int contentH = Math.max(sketchHeight, MIN_WINDOW_HEIGHT);
  6. canvas.setBounds((contentW - sketchWidth)/2,
  7. (contentH - sketchHeight)/2,
  8. sketchWidth, sketchHeight);
  9. }

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

  1. public void layoutContainer(java.awt.Container parent)
  2. {
  3. c.setBounds(parent.getInsets().left, parent.getInsets().top, parent.getWidth() - parent.getInsets().left - parent.getInsets().right,
  4. parent.getHeight() - parent.getInsets().top - parent.getInsets().bottom);
  5. //System.out.println("LAYOUT frame bounds=" + f.getBounds() + " videoBounds=" + videoBounds + " parentBounds=" + parent.getBounds());
  6. }
  7. };

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

  1. public void layoutContainer(java.awt.Container parent)
  2. {
  3. c.setBounds(parent.getInsets().left, parent.getInsets().top, parent.getWidth() - parent.getInsets().left - parent.getInsets().right,
  4. parent.getHeight() - parent.getInsets().top - parent.getInsets().bottom);
  5. // videoCanvas.setBounds(parent.getInsets().left, parent.getInsets().top,
  6. // parent.getWidth() - parent.getInsets().left - parent.getInsets().right,
  7. // parent.getHeight() - parent.getInsets().top - parent.getInsets().bottom);//vf.setBounds(x, y, w, h);
  8. //System.out.println("LAYOUT frame bounds=" + f.getBounds() + " videoBounds=" + videoBounds + " parentBounds=" + parent.getBounds());
  9. }
  10. };

代码示例来源:origin: org.junit/com.springsource.junit

  1. public void setBounds(int x, int y, int w, int h) {
  2. super.setBounds(x, y, w, h);
  3. fProgressX= scale(fProgress);
  4. }

代码示例来源:origin: com.github.steveash.mallet/mallet

  1. /**
  2. * Set bounds of canvas
  3. */
  4. public void setBounds(int x, int y, int width, int height)
  5. {
  6. super.setBounds(x, y, width, height);
  7. fm = getFontMetrics(getFont());
  8. titleHeight = fm.getHeight();
  9. yLabelWidth = fm.stringWidth(yLabel);
  10. xLabelHeight = fm.getHeight();
  11. labelWidth = Math.max(fm.stringWidth(new Integer(min).toString()),
  12. fm.stringWidth(new Integer(max).toString())) + 2;
  13. top = padding + titleHeight;
  14. bottom = getSize().height - padding - xLabelHeight - fm.getHeight();
  15. left = padding + yLabelWidth;
  16. right = getSize().width - padding;
  17. }

代码示例来源:origin: de.julielab/jcore-mallet-2.0.9

  1. /**
  2. * Set bounds of canvas
  3. */
  4. public void setBounds(int x, int y, int width, int height)
  5. {
  6. super.setBounds(x, y, width, height);
  7. fm = getFontMetrics(getFont());
  8. titleHeight = fm.getHeight();
  9. yLabelWidth = fm.stringWidth(yLabel);
  10. xLabelHeight = fm.getHeight();
  11. labelWidth = Math.max(fm.stringWidth(new Integer(min).toString()),
  12. fm.stringWidth(new Integer(max).toString())) + 2;
  13. top = padding + titleHeight;
  14. bottom = getSize().height - padding - xLabelHeight - fm.getHeight();
  15. left = padding + yLabelWidth;
  16. right = getSize().width - padding;
  17. }

代码示例来源:origin: net.imagej/ij

  1. public void setBounds(int x, int y, int width, int height) {
  2. super.setBounds(x, y, width, height);
  3. tp.adjustVScroll();
  4. tp.adjustHScroll();
  5. iImage = null;
  6. }

代码示例来源:origin: de.julielab/jcore-mallet-0.4

  1. /**
  2. * Set bounds of canvas
  3. */
  4. public void setBounds(int x, int y, int width, int height)
  5. {
  6. super.setBounds(x, y, width, height);
  7. fm = getFontMetrics(getFont());
  8. titleHeight = fm.getHeight();
  9. yLabelWidth = fm.stringWidth(yLabel);
  10. xLabelHeight = fm.getHeight();
  11. labelWidth = Math.max(fm.stringWidth(new Integer(min).toString()),
  12. fm.stringWidth(new Integer(max).toString())) + 2;
  13. top = padding + titleHeight;
  14. bottom = getSize().height - padding - xLabelHeight - fm.getHeight();
  15. left = padding + yLabelWidth;
  16. right = getSize().width - padding;
  17. }

代码示例来源:origin: cc.mallet/mallet

  1. /**
  2. * Set bounds of canvas
  3. */
  4. public void setBounds(int x, int y, int width, int height)
  5. {
  6. super.setBounds(x, y, width, height);
  7. fm = getFontMetrics(getFont());
  8. titleHeight = fm.getHeight();
  9. yLabelWidth = fm.stringWidth(yLabel);
  10. xLabelHeight = fm.getHeight();
  11. labelWidth = Math.max(fm.stringWidth(new Integer(min).toString()),
  12. fm.stringWidth(new Integer(max).toString())) + 2;
  13. top = padding + titleHeight;
  14. bottom = getSize().height - padding - xLabelHeight - fm.getHeight();
  15. left = padding + yLabelWidth;
  16. right = getSize().width - padding;
  17. }

代码示例来源:origin: imagej/ImageJA

  1. public void setBounds(int x, int y, int width, int height) {
  2. super.setBounds(x, y, width, height);
  3. tp.adjustVScroll();
  4. tp.adjustHScroll();
  5. iImage = null;
  6. }

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

  1. Region region = new Region();
  2. region.add(new int[] {3, 3, 20, 20, 3, 20});
  3. Canvas c = new Canvas(this, SWT.NONE);
  4. c.setBounds(35, 35, 60, 60);
  5. c.setRegion(region);
  6. Menu menu = new Menu(this);
  7. c.setMenu(menu);
  8. MenuItem mntmProperties = new MenuItem(menu, SWT.NONE);
  9. mntmProperties.setText("Properties");
  10. MenuItem mntmDelete = new MenuItem(menu, SWT.NONE);
  11. mntmDelete.setText("Delete");

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

  1. canvas.setBounds((screenRect.width - sketchWidth) / 2,
  2. (screenRect.height - sketchHeight) / 2,
  3. sketchWidth, sketchHeight);

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

  1. canvas.setBounds(0,0,image.getImageData().width, image.getImageData().height);
  2. canvas.addPaintListener(new PaintListener() {
  3. public void paintControl(PaintEvent e) {

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

  1. case1.setBounds(84, 111, 136, 64);

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

  1. canvas.setBounds((contentW - sketchWidth)/2,
  2. (contentH - sketchHeight)/2,
  3. sketchWidth, sketchHeight);

代码示例来源:origin: uk.co.caprica/vlcj

  1. c.setBounds(0, 0, 1000, 900);
  2. o1.setBounds(100, 60, 200, 300);
  3. o2.setBounds(400, 200, 150, 150);
  4. o3.setBounds(50, 500, 200, 200);

相关文章