labelfigure.java

来自「基于eclipse的工具开发代码」· Java 代码 · 共 35 行

JAVA
35
字号
package com.cownew.uidesigner.components.label;

import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants;


public class LabelFigure extends Figure
{
	private Label label;
	private String text;
	
	public LabelFigure()
	{
		super();
		label = new Label();
		label.setLabelAlignment(PositionConstants.LEFT);
		add(label);
	}

	public void setText(String text)
	{
		this.text = text;
		this.repaint();
	}

	protected void paintFigure(Graphics gc)
	{
		super.paintFigure(gc);
		label.setBounds(getBounds());
		label.setText(text);
	}
}

⌨️ 快捷键说明

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