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

📄 labelexample.java

📁 j2me的1套UI框架,可以帮助开发者迅速的开发j2me应用程序.
💻 JAVA
字号:
package org.j4me.examples.ui.components;

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

/**
 * Shows a <code>Label</code> component in action.  The label displays
 * mutliple paragraphs, line breaks, and text justification.
 */
public class LabelExample
	extends Dialog
{
	/**
	 * The previous screen.
	 */
	private DeviceScreen previous;
	
	/**
	 * The label demonstrated by this example.
	 */
	private Label label = new Label();
	
	/**
	 * Constructs a screen that shows a <code>Label</code> component in action.
	 * 
	 * @param previous is the screen to return to once this done.
	 */
	public LabelExample (DeviceScreen previous)
	{
		this.previous = previous;
		
		// Set the title and menu for this screen.
		setTitle( "Label Example" );
		setMenuText( "Back", null );
		
		// Center the text.
		label.setHorizontalAlignment( Graphics.HCENTER );

		// Make the label be mutliple paragraphs.
		label.setLabel(
				"This is a label component.  It shows text using the theme's font " +
				"and color.  However, that can be overridden using the setFont() " +
				"and setFontColor() methods.\n" +
				"This label is center aligned.  Labels can also be left or right " +
				"aligned.\n" +
				"Labels can span multiple paragraphs using the '\\n' character.\n" +
				"Labels will wrap text if they take up more than one line.  " +
				"Wraps happen at the last space, hyphen, or slash characters.  "  +
				"If a single word is bigger than a line, it will break mid-word." );
		
		// Add the label to this screen.
		append( label );
	}

	/**
	 * Takes the user to the previous screen.
	 */
	protected void declineNotify ()
	{
		previous.show();
	}
}

⌨️ 快捷键说明

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