⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 controlanimator.java

📁 jfa2ce 源码帮助开发人员更好的理解运用
💻 JAVA
字号:
/******************************************************************************* * Copyright (c) 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: *     IBM Corporation - initial API and implementation ******************************************************************************/package org.eclipse.jface.dialogs;import org.eclipse.swt.graphics.Point;import org.eclipse.swt.graphics.Rectangle;import org.eclipse.swt.widgets.Control;/** * ControlAnimator provides a simple implementation to display or hide a control * at the bottom of the parent composite. Other animations will be written as * subclasses of this class. <p> * Instances of this class can be created using an AnimatorFactory. *  * @since 3.2 */public class ControlAnimator {		protected Control control;			/**	 * Constructs a new ControlAnimator instance and passes along the	 * control that will be displayed or hidden.	 * 	 * @param control the control that will be displayed or hidden.	 */	public ControlAnimator(Control control) {		this.control = control;	}	/**	 * Displays or hides a control at the bottom of the parent composite	 * and makes use of the control's SWT visible flag.<p>	 * Subclasses should override this method.</p>	 * 	 * @param visible <code>true</code> if the control should be shown, 	 * 		  and <code>false</code> otherwise.	 */	public void setVisible(boolean visible){		// Using the SWT visible flag to determine if the control has		// already been displayed or hidden. Return if already displayed		// and visible is true, or if already hidden and visible is false.		if (!(control.isVisible() ^ visible))			return;		control.setVisible(visible);		Rectangle parentBounds = control.getParent().getBounds();		int bottom = parentBounds.height;				final int endY = visible ? bottom - control.getBounds().height				: bottom;		Point loc = control.getLocation();		control.setLocation(loc.x,endY);	}	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -