ResizableCanvas.java
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
00003  * All rights reserved. This program is made available under the terms of the
00004  * Eclipse Public License v1.0 which accompanies this distribution, and is
00005  * available at http://www.eclipse.org/legal/epl-v10.html
00006  * Contributors:
00007  * General Robotix Inc.
00008  * National Institute of Advanced Industrial Science and Technology (AIST) 
00009  */
00016 package com.generalrobotix.ui.view.tdview;
00017 
00018 import java.awt.*;
00019 import java.awt.event.*;
00020 
00021 import javax.swing.*;
00022 
00023 @SuppressWarnings("serial")
00024 public class ResizableCanvas extends JScrollPane {
00025     Canvas canvas_;
00026 
00032     public ResizableCanvas(Canvas canvas) {
00033         super(canvas, VERTICAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_NEVER);
00034         canvas_ = canvas;
00035         setBorder(null);
00036 
00037         addComponentListener(
00038             new ComponentAdapter() {
00039                 public void componentResized(ComponentEvent evt) {
00040                     canvas_.setSize(
00041                         ResizableCanvas.this.getSize().width,
00042                         ResizableCanvas.this.getSize().height
00043                     );
00044                 }
00045             }
00046         );
00047     }
00048 
00054     public Canvas getCanvas() {
00055         return canvas_;
00056     }
00057 }


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Apr 11 2019 03:30:19