linecomponent.java

来自「sound recorder which supports .wav forma」· Java 代码 · 共 29 行

JAVA
29
字号
package com.vimas.interfaceapplet;

import java.awt.*;

public class LineComponent extends Component
{
  Color c;//it's color
  int direction;//VERICAL<=>HORISONTAl
  int length;//length
  public static final int VERTICAL=1;
  public static final int HORIZONTAL=2;

  public LineComponent(int direction, int length, Color c)
  {
    super();
    this.c=c;
    this.direction=direction;
    this.length=length;
  }
public void paint(Graphics g)
  {
    g.setColor(c);
    int x2=0,y2=0;
    if(direction==1) y2=length; else x2=length;
    g.drawLine(0,0,x2,y2);
  }

}

⌨️ 快捷键说明

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