当前位置: 首页>>代码示例>>Java>>正文


Java Canvas.setBounds方法代码示例

本文整理汇总了Java中java.awt.Canvas.setBounds方法的典型用法代码示例。如果您正苦于以下问题:Java Canvas.setBounds方法的具体用法?Java Canvas.setBounds怎么用?Java Canvas.setBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Canvas的用法示例。


在下文中一共展示了Canvas.setBounds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AView

import java.awt.Canvas; //导入方法依赖的package包/类
/**
 * Initiates a new View instance.
 * 
 * @param title
 *            The title displayed on the frame.
 * @param width
 *            The width of the frame.
 * @param height
 *            The height of the frame.
 * @param manager
 *            The RenderManager of this View, managing render layers.
 */
public AView(String mTitle, int mWidth, int mHeight, RenderManager mManager) {
	super(0, 0, mWidth, mHeight);

	manager = mManager;
	title = mTitle;
	height = mHeight;
	width = mWidth;

	frame = new JFrame(title);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.setResizable(false);
	frame.setSize(width, height);
	frame.setLocationRelativeTo(null);
	frame.setVisible(false);

	canvas = new Canvas();
	canvas.setPreferredSize(new Dimension(width, height));
	canvas.setMaximumSize(new Dimension(width, height));
	canvas.setMinimumSize(new Dimension(width, height));
	canvas.setFocusable(false);
	canvas.setBounds(0, 0, width, height);

	frame.add(canvas);

}
 
开发者ID:Ativelox,项目名称:Rummy,代码行数:38,代码来源:AView.java

示例2: initialize

import java.awt.Canvas; //导入方法依赖的package包/类
/**
 * Initialize the contents of the frame.
 */	
@SuppressWarnings({ "unchecked", "rawtypes" })
private void initialize() {
	
	frame = new JFrame("Sensor Display");
	
	frame.setBounds(200, 200, 650, 650);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.getContentPane().setLayout(null);
	
	//List Model 
	ListModel model = new DefaultListModel();

	
	//Hashtable in order to store item objects and their name

	//Jlabel to say if an item has been sent

	
	//Selection lister to enable or disable the Jlabel according to the value of item flag
	
	
	JLabel lblNew = new JLabel("Sensors");
	//lblNew.setMaximumSize(new Dimension(10000, 50));
	
	lblNew.setBounds(0, 0, 100, 100);
	frame.getContentPane().add(lblNew);
	
	lblNew.setVisible(true);

		// saving sample_minimal.png
		

	Server serv;
	JLabel lblNew2 = new JLabel("Distribution");
	//lblNew.setMaximumSize(new Dimension(10000, 50));
	
	lblNew2.setBounds(350, 50, 100, 10);
	frame.getContentPane().add(lblNew2);
	
	 canvas = new Canvas();
	  canvas.setBounds(350, 100, 236, 150);

	
	    canvas.setBackground(Color.WHITE);
	    canvas.setVisible(true);
	    canvas.setFocusable(false);

	    frame.getContentPane().add(canvas);
	    
	try {
		
		 serv=new Server(6005,this);
		 new Thread(serv).start();
		 
		 
	} catch (IOException e) {
		e.printStackTrace();
	}
	
	
	//On exit close all connections 


}
 
开发者ID:fmcalcagno,项目名称:Sensors,代码行数:68,代码来源:Interface.java


注:本文中的java.awt.Canvas.setBounds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。