001package com.fs.starfarer.api.util; 002 003import java.awt.Color; 004import java.util.ArrayList; 005import java.util.Arrays; 006import java.util.List; 007 008public class Highlights { 009 010 private String [] text = new String[0]; 011 private Color [] colors = new Color[0]; 012 013 014 public void setText(String ... text) { 015 this.text = text; 016 } 017 018 public void setColors(Color ... colors) { 019 this.colors = colors; 020 } 021 022 public String[] getText() { 023 return text; 024 } 025 026 public Color[] getColors() { 027 return colors; 028 } 029 030 031 public String [] prependText(String str) { 032 List<String> list = new ArrayList<String>(Arrays.asList(text)); 033 list.add(0, str); 034 return (String[]) list.toArray(new String [1]); 035 } 036 037 public Color [] prependColor(Color color) { 038 List<Color> list = new ArrayList<Color>(Arrays.asList(colors)); 039 list.add(0, color); 040 return (Color[]) list.toArray(new Color [1]); 041 } 042 043 public void append(String str, Color color) { 044 List<String> list = new ArrayList<String>(Arrays.asList(text)); 045 list.add(str); 046 text = list.toArray(new String [1]); 047 048 List<Color> list2 = new ArrayList<Color>(Arrays.asList(colors)); 049 list2.add(color); 050 colors = list2.toArray(new Color [1]); 051 } 052} 053 054 055