Java 怎么绘制边框

2019年8月20日22:29:35 评论 22

1.简介

Java 怎么绘制边框?——请看下文。

2.代码

/**
 * 版权所有 编程十万个怎么办(www.tah1986.com)
 */


import java.awt.Color;

import java.awt.Graphics;

public class Main {
    public static void drawBorder(Graphics offLineBuffer,
            Color borderColor, int x, int y, int width, int height) {
        offLineBuffer.setColor(borderColor);
        offLineBuffer.drawRect(x, y, width, height);
    }

    public static void drawRect(Graphics offLineBuffer, Color color, int x,
            int y, int width, int height) {
        offLineBuffer.setColor(color);
        offLineBuffer.drawRect(x, y, width, height);
    }
}

 

3.总结

示例代码演示了 Java 怎么绘制边框,具体步骤参见示例代码。

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: