button.java
来自「moto手机专用的LWT类库源码」· Java 代码 · 共 69 行
JAVA
69 行
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: Button.java
package com.motorola.lwt;
import javax.microedition.lcdui.Graphics;
// Referenced classes of package com.motorola.lwt:
// InteractableComponent, Component
public class Button extends InteractableComponent
{
public static int BUTTON_ACTION_EVENT = 1;
public Button()
{
super(null);
}
public Button(String s)
{
super(s);
}
public int getPreferredWidth()
{
return labelWidth + 10;
}
public int getPreferredHeight()
{
return labelHeight + 6;
}
public void componentActuated()
{
dispatchComponentEvent(BUTTON_ACTION_EVENT);
}
public void paint(Graphics g)
{
g.setFont(itsFont);
g.setColor(enabled ? 0 : 0x808080);
if(hasFocus())
g.drawRect(0, 0, width - 1, height - 1);
g.drawLine(3, 2, width - 4, 2);
g.drawLine(3, height - 3, width - 4, height - 3);
g.drawLine(2, 3, 2, height - 4);
g.drawLine(width - 3, 3, width - 3, height - 4);
if(pressed)
{
g.setColor(0);
g.fillRect(3, 3, width - 6, height - 6);
g.setColor(0xffffff);
} else
{
g.setColor(0x808080);
g.fillRect(3, 3, width - 6, height - 6);
g.setColor(enabled ? 0 : 0x404040);
}
if(label != null)
g.drawString(label, width >> 1, 2, 17);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?