这是为了检查,自己的绘制,有没有越界。
- 效果
- 代码
package taishan; import java.awt.Color; import java.awt.Graphics; @SuppressWarnings("serial") public abstract class RotateFontFrameAbstract extends TFrame { private final static int FRAME_WIDTH = 540; private final static int FRAME_HEIGHT = 480; private void drawFrameBorder(Graphics g) { int startX = 8; int startY = 31; int endX = FRAME_WIDTH - 9; int endY = FRAME_HEIGHT - 9; g.setColor(COLOR_BORDER); g.drawLine(startX, startY, FRAME_WIDTH, startY); g.drawLine(startX, startY, startX, FRAME_HEIGHT); g.drawLine(startX, endY, endX, endY); g.drawLine(endX, startY, endX, endY); } @Override public final void paint(Graphics g) { super.paint(g); drawFrameBorder(); } protected final static void display(TFrame frame) { frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); frame.setVisible(true); } }