You are on page 1of 1

private

void
changeColor(
) {
Color color = lbText.getForeground();
if (color == Color.BLACK) lbText.setForeground(Color.RED);
else if (color == Color.RED) lbText.setForeground(Color.YELLOW);
else if (color == Color.YELLOW)
lbText.setForeground(Color.BLUE);
else if (color == Color.BLUE) lbText.setForeground(Color.GREEN);
else lbText.setForeground(Color.BLACK);
}

//change all font(font size, font style, name)


int fontStyle = 0; int fontSize = 15;
String[] fontName = {"Times", "Italic", "Verdana"}; int count = 0;
private void changeFont() {
lbText.setFont(new Font(fontName[count++ % fontName.length],
fontStyle++ % 4,
fontSize++ % 36));
}

You might also like