English 中文(简体)
科罗氏圈的改变
原标题:Change Color of Circle
  • 时间:2024-05-07 02:48:27
  •  标签:
  • java

我试图为学校项目建造交通模拟器。 我在安排汽车时使用了圈子,并背离了先前的法典。 前一部法典的圈子为青.,但就我这样的项目而言,是黑色的。

在我的手法中,我看到了圈子的颜色。 我将彩色从蓝色改为黑色,如下文所示,但在实际模拟中,没有变化,圈子仍然是蓝色的。 该方案的任何其他地方都不应把圈子打上色。 The Code I used from a previous project:

    @Override
    public void draw(Graphics g) {
            g.setColor(Color.BLUE); // Change the color to blue
            int location = SimulationPanel.getInstance().getXInPixelsFromXInMeters(this.getXLocation());
            g.fillOval(location - (HEIGHT / 2), (int) y, HEIGHT, HEIGHT);
    }

我的增订守则如下:

    @Override
    public void draw(Graphics g) {
            g.setColor(Color.BLACK); // Change the color to black
            int location = SimulationPanel.getInstance().getXInPixelsFromXInMeters(this.getXLocation());
            g.fillOval(location - (HEIGHT / 2), (int) y, HEIGHT, HEIGHT);
    }
问题回答

这应当加以确定:(我把它 black为黑白,不管你想要什么东西。)

@Override
public void draw(Graphics g) {
    g.setColor(Color.BLACK); // Change the color to black
    int location = SimulationPanel.getInstance().getXInPixelsFromXInMeters(this.getXLocation());
    g.fillOval(location - (HEIGHT / 2), (int) y, HEIGHT, HEIGHT);
    graphic.repaint();
}




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签