Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
TrafficLightComponent.java 548 Bytes
Copy Edit Raw Blame History
root authored 2020-04-07 07:54 . 作业
import javax.swing.JComponent;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
public class TrafficLightComponent extends JComponent
{
public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.RED);
g2.fillRoundRect(10, 10, 40, 40, 50, 50);
g2.setColor(Color.YELLOW);
g2.fillRoundRect(10, 60, 40, 40, 50, 50);
g2.setColor(Color.GREEN);
g2.fillRoundRect(10, 110, 40, 40, 50, 50);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化