📄 spacer.java
字号:
/* * @(#)Spacer.java 1.21 02/10/07 @(#) * * Copyright (c) 2002 Sun Microsystems, Inc. All rights reserved. * PROPRIETARY/CONFIDENTIAL * Use is subject to license terms. */package javax.microedition.lcdui;import java.lang.IllegalArgumentException;public class Spacer extends Item { public Spacer(int minWidth, int minHeight) { super(null); updateSizes(minWidth, minHeight); } public void setMinimumSize(int minWidth, int minHeight) { updateSizes(minWidth, minHeight); } public void addCommand(Command cmd) { throw new IllegalStateException(); } public void setDefaultCommand(Command cmd) { throw new IllegalStateException(); } public void setLabel(String label) { throw new IllegalStateException(); } // package private implementation int callMinimumWidth() { return width; } int callPreferredWidth(int h) { return width; } int callMinimumHeight() { return height; } int callPreferredHeight(int w) { return height; } boolean shouldSkipTraverse() { return true; } void callPaint(Graphics g, int w, int h) { /* * There's no reason to erase anything because Form will erase * any dirty region for us * g.setColor(Display.ERASE_COLOR); g.fillRect(g.getClipX(), g.getClipY(), g.getClipWidth(), g.getClipHeight()); g.setColor(Display.FG_COLOR); */ } private void updateSizes(int minW, int minH) { if (minW < 0 || minH < 0) { throw new IllegalArgumentException(); } synchronized (Display.LCDUILock) { width = minW; height = minH; //invalidate(); } } /** The preferred (and minimum) width of this Spacer */ private int width; /** The preferred (and minimum) height of this Spacer */ private int height;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -