Set colour for lines, texts etc.
java.awt.Color
java.awt.Graphics
The example hands out a red text („Hello world!“) and a red line.
public void paintComponent(Graphics g) { g.setColor(Color.RED); // Also red: g.setColor(255, 0, 0); g.drawString("Hello world!", 10, 10); g.drawLine(g, 0, 0, 10, 10); }