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

📄 displayable1.java~1~

📁 自己做的作业
💻 JAVA~1~
字号:

import javax.microedition.lcdui.*;

public class Displayable1 extends Canvas implements CommandListener {
  /** Constructor */
  public Displayable1() {
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
  }

  /**Component initialization*/
  private void jbInit() throws Exception {
    // Set up this Displayable to listen to command events
    setCommandListener(this);
    // add the Exit command
    addCommand(new Command("Exit", Command.EXIT, 1));
  }

  /**Handle command events*/
  public void commandAction(Command command, Displayable displayable) {
    /** @todo Add command handling code */
    if (command.getCommandType() == Command.EXIT) {
// stop the MIDlet
      MIDlet1.quitApp();
    }
  }

  /** Required paint implementation */
  protected void paint(Graphics g) {
    int width = getWidth();
    int height = getHeight();
// Fill the background using black
    g.setColor(0);
    g.fillRect(0, 0, width, height);
// White horizontal line
    g.setColor(0xFFFFFF);
    g.drawLine(0, height / 2, width - 1, height / 2);
// Yellow dotted horizontal line
    g.setStrokeStyle(Graphics.DOTTED);
    g.setColor(0xFFFF00);
    g.drawLine(0, height / 4, width - 1, height / 4);
// Solid diagonal line in brightest gray
    g.setGrayScale(255);
    g.setStrokeStyle(Graphics.SOLID);
    g.drawLine(0, 0, width - 1, height - 1);
  }
}

⌨️ 快捷键说明

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