コード例 #1
0
ファイル: Canvas.java プロジェクト: vparfonov/api-samples
 /**
  * Create a Canvas.
  *
  * @param title title to appear in Canvas Frame
  * @param width the desired width for the canvas
  * @param height the desired height for the canvas
  * @param bgClour the desired background colour of the canvas
  */
 private Canvas(String title, int width, int height, Color bgColour) {
   frame = new JFrame();
   canvas = new CanvasPane();
   frame.setContentPane(canvas);
   frame.setTitle(title);
   canvas.setPreferredSize(new Dimension(width, height));
   backgroundColour = bgColour;
   frame.pack();
 }
コード例 #2
0
ファイル: Canvas.java プロジェクト: amoto/POOB-ECI
 /**
  * Create a Canvas.
  *
  * @param title title to appear in Canvas Frame
  * @param width the desired width for the canvas
  * @param height the desired height for the canvas
  * @param bgClour the desired background colour of the canvas
  */
 private Canvas(String title, int width, int height, Color bgColour) {
   frame = new JFrame();
   canvas = new CanvasPane();
   frame.setContentPane(canvas);
   frame.setTitle(title);
   canvas.setPreferredSize(new Dimension(width, height));
   backgroundColour = bgColour;
   frame.pack();
   objects = new ArrayList<Object>();
   shapes = new HashMap<Object, ShapeDescription>();
 }
コード例 #3
0
ファイル: Canvas.java プロジェクト: vparfonov/api-samples
 /**
  * Sets the size of the canvas.
  *
  * @param width new width
  * @param height new height
  */
 public void setSize(int width, int height) {
   canvas.setPreferredSize(new Dimension(width, height));
   frame.pack();
 }