0
 itemsTextArea.append("You pulled a 5-star item\n");
            pullsSinceLast4Star = 0;
            pullsSinceLast5Star = 0;
        } else if (randomNumber <= 22) {
            itemsTextArea.append("You pulled a 4-star item\n");
            pullsSinceLast4Star = 0;
        } else {
            itemsTextArea.append("You pulled a 3-star item\n");
        }

i want that the "you pulled a 5-star item" have a color just to him

  • Do you want the ALL the text to be the same color or change the color of individual words/phrases? – MadProgrammer Jun 15 '23 at 00:20
  • 1
    I'd start by looking at [`JTextArea#setForeground`](https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/JComponent.html#setForeground(java.awt.Color)) and [How to Use Text Areas](https://docs.oracle.com/javase/tutorial/uiswing/components/textarea.html). For something more richer (and therefore more complicated), I'd have a look at [How to Use Editor Panes and Text Panes](https://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html) – MadProgrammer Jun 15 '23 at 00:23

0 Answers0