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

📄 whitespace.java

📁 关于J4ME J2ME实例
💻 JAVA
字号:
package org.j4me.ui.components;

import javax.microedition.lcdui.*;
import org.j4me.ui.*;

/**
 * The <code>Whitespace</code> component adds whitespace to a form.
 */
public class Whitespace
	extends Component
{
	/**
	 * The number of pixels on the Y-axis to space.
	 */
	private int vertical;
	
	/**
	 * Constructs a <code>Whitespace</code> component.
	 * 
	 * @param vertical is the number of pixels to space.  It must be
	 *  0 or greater.
	 */
	public Whitespace (int vertical)
	{
		setSpacing( vertical );
	}

	/**
	 * Sets the vertical amount of whitespace this component occupies.
	 * This does not include the form's spacing above and below this
	 * component.
	 * 
	 * @param vertical is the number of pixels to space.  It must be
	 *  0 or greater.
	 * @see Dialog#getSpacing()
	 */
	public void setSpacing (int vertical)
	{
		if ( vertical < 0 )
		{
			vertical = 0;
		}
		
		this.vertical = vertical;
	}
	
	/**
	 * Paints the whitespace.
	 * 
	 * @see org.j4me.ui.components.Component#paintComponent(javax.microedition.lcdui.Graphics, org.j4me.ui.Theme, int, int, boolean)
	 */
	protected void paintComponent (Graphics g, Theme theme, int width, int height, boolean selected)
	{
		// Empty space requires no painting.
	}

	/**
	 * Returns the dimensions of the whitespace.
	 * 
	 * @see org.j4me.ui.components.Component#getPreferredComponentSize(org.j4me.ui.Theme, int, int)
	 */
	protected int[] getPreferredComponentSize (Theme theme, int viewportWidth, int viewportHeight)
	{
		return new int[] { viewportWidth, vertical };
	}
}

⌨️ 快捷键说明

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