commit
0d17493028
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,715 @@
|
|||||||
|
package ColorChatAlternator;
|
||||||
|
|
||||||
|
import java.awt.Container;
|
||||||
|
import java.awt.GridLayout;
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.awt.datatransfer.Clipboard;
|
||||||
|
import java.awt.datatransfer.StringSelection;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.ItemEvent;
|
||||||
|
import java.awt.event.ItemListener;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import javax.swing.ButtonGroup;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JComboBox;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JRadioButton;
|
||||||
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
|
public class ColorChatAlternator extends JFrame{
|
||||||
|
private static char colorList [] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
|
||||||
|
private static String alphaList [] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
|
||||||
|
private static String upperList [] = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
|
||||||
|
private static String numList [] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
|
||||||
|
private static ArrayList <String> customFXList = new ArrayList <String>();
|
||||||
|
private static ArrayList <Character> customColorList = new ArrayList <Character>();
|
||||||
|
private static String text;
|
||||||
|
private static String char1;
|
||||||
|
private static String char2;
|
||||||
|
private static String fancyChars;
|
||||||
|
private static String cleanChars;
|
||||||
|
private final int WIDTH = 435;
|
||||||
|
private final int HEIGHT = 280;
|
||||||
|
private char a;
|
||||||
|
private char b;
|
||||||
|
private boolean ready;
|
||||||
|
private int randomColors = 0;
|
||||||
|
private JLabel blankLabel = new JLabel("");
|
||||||
|
private JLabel textLabel = new JLabel("Put your text here");
|
||||||
|
private JLabel color1Label = new JLabel("Color 1");
|
||||||
|
private JLabel color2Label = new JLabel("Color 2");
|
||||||
|
private JLabel modeLabel = new JLabel("Coloring mode");
|
||||||
|
private JLabel outputLabel = new JLabel("Copy this into Minecraft");
|
||||||
|
private JLabel copyLabel = new JLabel("Automatically copy to clipboard?");
|
||||||
|
private JTextField textField = new JTextField("");
|
||||||
|
private JTextField outputField = new JTextField("");
|
||||||
|
private JComboBox chara = new JComboBox();
|
||||||
|
private JComboBox charb = new JComboBox();
|
||||||
|
private JComboBox copyBox = new JComboBox();
|
||||||
|
private JComboBox modeBox = new JComboBox();
|
||||||
|
private JCheckBox color0 = new JCheckBox("<html><font color=#000000>0 - Black</font></html>");
|
||||||
|
private JCheckBox color1 = new JCheckBox("<html><font color=#0000AA>1 - Dark Blue</font></html>");
|
||||||
|
private JCheckBox color2 = new JCheckBox("<html><font color=#00AA00>2 - Dark Green</font></html>");
|
||||||
|
private JCheckBox color3 = new JCheckBox("<html><font color=#00AAAA>3 - Dark Aqua</font></html>");
|
||||||
|
private JCheckBox color4 = new JCheckBox("<html><font color=#AA0000>4 - Dark Red</font></html>");
|
||||||
|
private JCheckBox color5 = new JCheckBox("<html><font color=#AA00AA>5 - Dark Purple</font></html>");
|
||||||
|
private JCheckBox color6 = new JCheckBox("<html><font color=#FFAA00>6 - Gold</font></html>");
|
||||||
|
private JCheckBox color7 = new JCheckBox("<html><font color=#AAAAAA>7 - Gray</font></html>");
|
||||||
|
private JCheckBox color8 = new JCheckBox("<html><font color=#555555>8 - Dark Gray</font></html>");
|
||||||
|
private JCheckBox color9 = new JCheckBox("<html><font color=#5555FF>9 - Blue</font></html>");
|
||||||
|
private JCheckBox colora = new JCheckBox("<html><font color=#55FF55>a - Green</font></html>");
|
||||||
|
private JCheckBox colorb = new JCheckBox("<html><font color=#55FFFF>b - Aqua</font></html>");
|
||||||
|
private JCheckBox colorc = new JCheckBox("<html><font color=#FF5555>c - Red</font></html>");
|
||||||
|
private JCheckBox colord = new JCheckBox("<html><font color=#FF55FF>d - Light Purple</font></html>");
|
||||||
|
private JCheckBox colore = new JCheckBox("<html><font color=#FFFF55>e - Yellow</font></html>");
|
||||||
|
private JCheckBox colorf = new JCheckBox("<html><font color=#FFFFFF>f - White</font></html>");
|
||||||
|
private JRadioButton selectedColorsRadio = new JRadioButton("Use selected colors", true);
|
||||||
|
private JRadioButton randomColorsRadio = new JRadioButton("Use random colors", false);
|
||||||
|
private JRadioButton customRandomColorsRadio = new JRadioButton("Use custom random colors", false);
|
||||||
|
private ButtonGroup colorGroup = new ButtonGroup();
|
||||||
|
private JButton customColorsSaveButton = new JButton("Save changes");
|
||||||
|
private JButton customColorButton = new JButton("Edit Custom Random Colors");
|
||||||
|
private JButton customEffectsButton = new JButton("Custom Color Effects");
|
||||||
|
private JButton colorButton = new JButton("Color list");
|
||||||
|
private JButton doneButton = new JButton("Add Colors");
|
||||||
|
|
||||||
|
public ColorChatAlternator(){
|
||||||
|
setTitle("Color Alternator");
|
||||||
|
setSize(WIDTH, HEIGHT);
|
||||||
|
setVisible(true);
|
||||||
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
Container pane = getContentPane();
|
||||||
|
pane.setLayout(new GridLayout(10, 2));
|
||||||
|
JComboInit();
|
||||||
|
outputField.setEditable(false);
|
||||||
|
pane.add(textLabel);
|
||||||
|
pane.add(textField);
|
||||||
|
pane.add(color1Label);
|
||||||
|
pane.add(chara);
|
||||||
|
pane.add(color2Label);
|
||||||
|
pane.add(charb);
|
||||||
|
pane.add(selectedColorsRadio);
|
||||||
|
pane.add(randomColorsRadio);
|
||||||
|
pane.add(customRandomColorsRadio);
|
||||||
|
pane.add(customColorButton);
|
||||||
|
pane.add(copyLabel);
|
||||||
|
pane.add(copyBox);
|
||||||
|
pane.add(modeLabel);
|
||||||
|
pane.add(modeBox);
|
||||||
|
pane.add(outputLabel);
|
||||||
|
pane.add(outputField);
|
||||||
|
pane.add(customEffectsButton);
|
||||||
|
pane.add(blankLabel);
|
||||||
|
pane.add(colorButton);
|
||||||
|
pane.add(doneButton);
|
||||||
|
customColorsSaveButton.addActionListener(new colorSaveListener());
|
||||||
|
customColorButton.addActionListener(new customColorListener());
|
||||||
|
colorButton.addActionListener(new colorListener());
|
||||||
|
customEffectsButton.addActionListener(new fancyListener());
|
||||||
|
doneButton.addActionListener(new doneListener());
|
||||||
|
randomColorsRadio.addItemListener(new randomListener());
|
||||||
|
selectedColorsRadio.addItemListener(new selectedListener());
|
||||||
|
customRandomColorsRadio.addItemListener(new customRandomListener());
|
||||||
|
pane.setVisible(true);
|
||||||
|
}
|
||||||
|
public void JComboInit(){
|
||||||
|
colorGroup.add(selectedColorsRadio);
|
||||||
|
colorGroup.add(randomColorsRadio);
|
||||||
|
colorGroup.add(customRandomColorsRadio);
|
||||||
|
modeBox.addItem("Alternate Every Other Letter");
|
||||||
|
modeBox.addItem("Every Other Word");
|
||||||
|
modeBox.addItem("First Letter of Each Word");
|
||||||
|
modeBox.addItem("Random Colors Every Letter");
|
||||||
|
modeBox.addItem("Custom Random Colors Every Letter");
|
||||||
|
modeBox.addItem("MultiColor");
|
||||||
|
modeBox.addItem("Split Message");
|
||||||
|
modeBox.addItem("Color Capital Letters");
|
||||||
|
modeBox.addItem("Light Rainbow");
|
||||||
|
modeBox.addItem("Rainbow");
|
||||||
|
chara.addItem("0");
|
||||||
|
chara.addItem("1");
|
||||||
|
chara.addItem("2");
|
||||||
|
chara.addItem("3");
|
||||||
|
chara.addItem("4");
|
||||||
|
chara.addItem("5");
|
||||||
|
chara.addItem("6");
|
||||||
|
chara.addItem("7");
|
||||||
|
chara.addItem("8");
|
||||||
|
chara.addItem("9");
|
||||||
|
chara.addItem("a");
|
||||||
|
chara.addItem("b");
|
||||||
|
chara.addItem("c");
|
||||||
|
chara.addItem("d");
|
||||||
|
chara.addItem("e");
|
||||||
|
chara.addItem("f");
|
||||||
|
charb.addItem("0");
|
||||||
|
charb.addItem("1");
|
||||||
|
charb.addItem("2");
|
||||||
|
charb.addItem("3");
|
||||||
|
charb.addItem("4");
|
||||||
|
charb.addItem("5");
|
||||||
|
charb.addItem("6");
|
||||||
|
charb.addItem("7");
|
||||||
|
charb.addItem("8");
|
||||||
|
charb.addItem("9");
|
||||||
|
charb.addItem("a");
|
||||||
|
charb.addItem("b");
|
||||||
|
charb.addItem("c");
|
||||||
|
charb.addItem("d");
|
||||||
|
charb.addItem("e");
|
||||||
|
charb.addItem("f");
|
||||||
|
copyBox.addItem("Yes");
|
||||||
|
copyBox.addItem("No");
|
||||||
|
}
|
||||||
|
public static void main(String[] args){
|
||||||
|
ColorChatAlternator prog = new ColorChatAlternator();
|
||||||
|
}
|
||||||
|
public void toClipboard(String words){
|
||||||
|
StringSelection stringSelection = new StringSelection(words);
|
||||||
|
Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||||
|
clpbrd.setContents(stringSelection, null);
|
||||||
|
}
|
||||||
|
public String alternateLetter(){
|
||||||
|
boolean ab = true;
|
||||||
|
ArrayList<String> output = new ArrayList <String>();
|
||||||
|
for (int c = 0; c < text.length(); c++){
|
||||||
|
if (!text.substring(c, c + 1).equals(" ")) {
|
||||||
|
if (ab){
|
||||||
|
output.add("&" + a);
|
||||||
|
ab = false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
output.add("&" + b);
|
||||||
|
ab = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
}
|
||||||
|
lengthCheck(stringify(output));
|
||||||
|
return stringify(output);
|
||||||
|
}
|
||||||
|
public String firstLetterWord(){
|
||||||
|
ArrayList<String> output = new ArrayList <String>();
|
||||||
|
output.add("&" + a);
|
||||||
|
output.add(text.substring(0, 1));
|
||||||
|
output.add("&" + b);
|
||||||
|
for (int c = 1; c < text.length(); c++){
|
||||||
|
if (!text.substring(c, c + 1).equals(" "))
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
else{
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
output.add("&" + a);
|
||||||
|
output.add(text.substring(c + 1, c + 2));
|
||||||
|
output.add("&" + b);
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lengthCheck(stringify(output));
|
||||||
|
return stringify(output);
|
||||||
|
}
|
||||||
|
public String randomColorsEveryLetter(){
|
||||||
|
ArrayList<String> output = new ArrayList <String>();
|
||||||
|
for (int c = 0; c < text.length(); c++){
|
||||||
|
output.add("&" + colorList[randomInt(colorList.length)]);
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
}
|
||||||
|
lengthCheck(stringify(output));
|
||||||
|
return stringify(output);
|
||||||
|
}
|
||||||
|
public String customRandomColorsEveryLetter(){
|
||||||
|
if (customColorList.size()==0)
|
||||||
|
{
|
||||||
|
JOptionPane.showMessageDialog(null, "Your color list is empty! Click\n"
|
||||||
|
+ "<html><font color=#FF5555>Edit Custom Random Colors\n"
|
||||||
|
+ "above and add some to the list.", "Minecraft Colors", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
ArrayList <String> output = new ArrayList <String>();
|
||||||
|
for (int c = 0; c < text.length(); c++){
|
||||||
|
output.add("&" + customColorList.get(randomInt(customColorList.size())));
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
}
|
||||||
|
lengthCheck(stringify(output));
|
||||||
|
return stringify(output);
|
||||||
|
}
|
||||||
|
public String multiFX(){
|
||||||
|
//System.out.println("InputCount: " + customFXList.size());
|
||||||
|
int FXindex = 0;
|
||||||
|
if (customFXList.size() == 0)
|
||||||
|
{
|
||||||
|
JOptionPane.showMessageDialog(null, "No color pattern set! Click\n<html><font color=#FF5555>Custom Color Effects\nto the left to set them up.", "Minecraft Colors", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
ArrayList <String> output = new ArrayList<String>();
|
||||||
|
for (int c = 0; c < text.length(); c++){
|
||||||
|
//System.out.print("FXindex: " + FXindex + "\t");
|
||||||
|
if (FXindex >= customFXList.size())
|
||||||
|
FXindex = 0;
|
||||||
|
if (!text.substring(c, c + 1).equals(" ")){
|
||||||
|
output.add("&" + customFXList.get(FXindex));
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
FXindex++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
}
|
||||||
|
lengthCheck(stringify(output));
|
||||||
|
return stringify(output);
|
||||||
|
}
|
||||||
|
public String altEveryWord()
|
||||||
|
{
|
||||||
|
ArrayList<String> output = new ArrayList <String>();
|
||||||
|
|
||||||
|
int alt = 0;
|
||||||
|
output.add("&" + a);
|
||||||
|
for (int c = 0; c < text.length(); c++)
|
||||||
|
{
|
||||||
|
if (alt == 0 && text.substring(c, c + 1).equals(" "))
|
||||||
|
{
|
||||||
|
alt = 1;
|
||||||
|
output.add("&" + b);
|
||||||
|
}
|
||||||
|
else if (alt == 1 && text.substring(c, c + 1).equals(" "))
|
||||||
|
{
|
||||||
|
alt = 0;
|
||||||
|
output.add("&" + a);
|
||||||
|
}
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*output.add("&" + a);
|
||||||
|
output.add(text.substring(0, 1));
|
||||||
|
output.add("&" + b);
|
||||||
|
for (int c = 1; c < text.length(); c++){
|
||||||
|
if (!text.substring(c, c + 1).equals(" "))
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
else{
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
output.add("&" + a);
|
||||||
|
output.add(text.substring(c + 1, c + 2));
|
||||||
|
output.add("&" + b);
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
lengthCheck(stringify(output));
|
||||||
|
return stringify(output);
|
||||||
|
}
|
||||||
|
public String rainbowificate(){
|
||||||
|
ArrayList<String> output = new ArrayList <String>();
|
||||||
|
char rainbowChars [] = {'4', 'c', '6', 'e', 'a', '2', '3', '1', 'b', '9', 'd', '5'};
|
||||||
|
int rainIndex = 0;
|
||||||
|
int textIndex = 0;
|
||||||
|
int initials = 0;
|
||||||
|
int lengths = text.length() / 12;
|
||||||
|
if (text.length()%12 == 0){
|
||||||
|
for (int c = 0; c < 12; c++){
|
||||||
|
output.add("&" + rainbowChars[c]);
|
||||||
|
output.add(text.substring(textIndex, textIndex + lengths));
|
||||||
|
textIndex += lengths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
lengths++;
|
||||||
|
initials = text.length() % 12;
|
||||||
|
System.out.println("Lengths: " + lengths + "\ninitials: " + initials);
|
||||||
|
System.out.println(rainIndex + " " + rainbowChars[rainIndex]);
|
||||||
|
for (int c = 0; c < initials; c++){
|
||||||
|
System.out.println("Lengths: " + lengths + "\ninitials: " + initials);
|
||||||
|
System.out.println(rainIndex + " " + rainbowChars[rainIndex]);
|
||||||
|
output.add("&" + rainbowChars[c]);
|
||||||
|
output.add(text.substring(textIndex, textIndex + lengths));
|
||||||
|
textIndex += lengths;
|
||||||
|
rainIndex = c;
|
||||||
|
}
|
||||||
|
lengths--;
|
||||||
|
rainIndex++;
|
||||||
|
System.out.println("Lengths: " + lengths + "\ninitials: " + initials);
|
||||||
|
System.out.println(rainIndex + " " + rainbowChars[rainIndex]);
|
||||||
|
for (int c = 0; c < 12 - initials; c++){
|
||||||
|
System.out.println("Lengths: " + lengths + "\ninitials: " + initials);
|
||||||
|
System.out.println(rainIndex + " " + rainbowChars[rainIndex]);
|
||||||
|
if (rainIndex > 11)
|
||||||
|
rainIndex = 11;
|
||||||
|
output.add("&" + rainbowChars[rainIndex]);
|
||||||
|
try {
|
||||||
|
output.add(text.substring(textIndex, textIndex + lengths));
|
||||||
|
}
|
||||||
|
catch (Exception E){
|
||||||
|
System.err.println("error caught");
|
||||||
|
System.err.println(E);
|
||||||
|
}
|
||||||
|
rainIndex++;
|
||||||
|
textIndex += lengths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("Lengths: " + lengths + "\ninitials: " + initials);
|
||||||
|
lengthCheck(stringify(output));
|
||||||
|
return stringify(output);
|
||||||
|
}
|
||||||
|
public String lightRainbowificate(){
|
||||||
|
ArrayList<String> output = new ArrayList <String>();
|
||||||
|
char rainbowChars [] = {'c', 'e', 'a', 'b', 'd'};
|
||||||
|
int rainIndex = 0;
|
||||||
|
int textIndex = 0;
|
||||||
|
int initials = 0;
|
||||||
|
int lengths = text.length() / 5;
|
||||||
|
if (text.length()%5 == 0){
|
||||||
|
for (int c = 0; c < 5; c++){
|
||||||
|
output.add("&" + rainbowChars[c]);
|
||||||
|
output.add(text.substring(textIndex, textIndex + lengths));
|
||||||
|
textIndex += lengths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
lengths++;
|
||||||
|
initials = text.length() % 5;
|
||||||
|
for (int c = 0; c < initials; c++){
|
||||||
|
output.add("&" + rainbowChars[c]);
|
||||||
|
output.add(text.substring(textIndex, textIndex + lengths));
|
||||||
|
textIndex += lengths;
|
||||||
|
rainIndex = c;
|
||||||
|
}
|
||||||
|
lengths--;
|
||||||
|
rainIndex++;
|
||||||
|
for (int c = 0; c < 5 - initials; c++){
|
||||||
|
output.add("&" + rainbowChars[rainIndex]);
|
||||||
|
try {
|
||||||
|
output.add(text.substring(textIndex, textIndex + lengths));
|
||||||
|
}
|
||||||
|
catch (Exception E){
|
||||||
|
System.err.println("error caught");
|
||||||
|
}
|
||||||
|
rainIndex++;
|
||||||
|
textIndex += lengths;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("Lengths: " + lengths + "\ninitials: " + initials);
|
||||||
|
lengthCheck(stringify(output));
|
||||||
|
return stringify(output);
|
||||||
|
}
|
||||||
|
public String splitColors(){
|
||||||
|
ArrayList<String> output = new ArrayList <String>();
|
||||||
|
if (text.length() % 2 == 1){
|
||||||
|
int length = (text.length() - 1) / 2;
|
||||||
|
output.add("&" + a);
|
||||||
|
output.add(text.substring(0,length));
|
||||||
|
output.add("&" + b);
|
||||||
|
output.add(text.substring(length));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
int length = (text.length()) / 2;
|
||||||
|
output.add("&" + a);
|
||||||
|
output.add(text.substring(0,length));
|
||||||
|
output.add("&" + b);
|
||||||
|
output.add(text.substring(length));
|
||||||
|
}
|
||||||
|
lengthCheck(stringify(output));
|
||||||
|
return stringify(output);
|
||||||
|
}
|
||||||
|
public String colorCapital(){
|
||||||
|
ArrayList<String> output = new ArrayList <String>();
|
||||||
|
for (int c = 0; c < text.length(); c++)
|
||||||
|
{
|
||||||
|
System.out.println("Start Loop");
|
||||||
|
System.out.println("Testing " + text.substring(c, c + 1));
|
||||||
|
for (int z = 0; z < alphaList.length; z++)
|
||||||
|
{
|
||||||
|
System.out.println("comparing " + text.substring(c, c + 1) + " to " + alphaList[z] + " and " + upperList[z]);
|
||||||
|
if (text.substring(c, c + 1).equals(alphaList[z]))
|
||||||
|
{
|
||||||
|
System.out.println("Lowercase");
|
||||||
|
output.add("&" + a);
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
z = alphaList.length;
|
||||||
|
}
|
||||||
|
else if (text.substring(c, c + 1).equals(upperList[z]))
|
||||||
|
{
|
||||||
|
System.out.println("Uppercase");
|
||||||
|
output.add("&" + b);
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
z = alphaList.length;
|
||||||
|
}
|
||||||
|
else if (text.substring(c, c + 1).equals(" "))
|
||||||
|
{
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
z = alphaList.length;
|
||||||
|
}
|
||||||
|
else if (text.substring(c, c + 1).equals(numList[z]))
|
||||||
|
{
|
||||||
|
output.add(text.substring(c, c + 1));
|
||||||
|
z = alphaList.length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.out.println("Neither");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("returned");
|
||||||
|
lengthCheck(stringify(output));
|
||||||
|
return stringify(output);
|
||||||
|
}
|
||||||
|
public String stringify(ArrayList<String> list){
|
||||||
|
String words = "";
|
||||||
|
String mode = (String)modeBox.getSelectedItem();
|
||||||
|
//words = list.toString();
|
||||||
|
//words = words.replace("[", "");
|
||||||
|
//words = words.replace("]", "");
|
||||||
|
//words = words.replace(", ", "");
|
||||||
|
for (int c = 0; c < list.size(); c++){
|
||||||
|
words = words + list.get(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return words;
|
||||||
|
}
|
||||||
|
public void lengthCheck(String list)
|
||||||
|
{
|
||||||
|
if (list.length()>100)
|
||||||
|
JOptionPane.showMessageDialog(null, ""
|
||||||
|
+ "Your message is too long and will\n"
|
||||||
|
+ "not fit in the chat box, however it\n"
|
||||||
|
+ "has still been copied to your\n"
|
||||||
|
+ "clipboard.", "Minecraft Colors", JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
private class colorListener implements ActionListener{
|
||||||
|
public void actionPerformed(ActionEvent e){
|
||||||
|
JOptionPane.showMessageDialog(null, "<html><font color=#000000>0 - Black\n<html><font color=#0000AA>1 - Dark Blue\n<html><font color=#00AA00>2 - Dark Green\n<html><font color=#00AAAA>3 - Dark Aqua\n<html><font color=#AA0000>4 - Dark Red\n<html><font color=#AA00AA>5 - Dark Purple\n<html><font color=#FFAA00>6 - Gold\n<html><font color=#AAAAAA>7 - Gray\n<html><font color=#555555>8 - Dark Gray\n<html><font color=#5555FF>9 - Blue\n<html><font color=#55FF55>a - Green\n<html><font color=#55FFFF>b - Aqua\n<html><font color=#FF5555>c - Red\n<html><font color=#FF55FF>d - Light Purple\n<html><font color=#FFFF55>e - Yellow\n<html><font color=#FFFFFF>f - White</font></html>", "Minecraft Colors", JOptionPane.PLAIN_MESSAGE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private class customColorListener implements ActionListener{
|
||||||
|
public void actionPerformed(ActionEvent e){
|
||||||
|
showCustomColorGUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private class fancyListener implements ActionListener{
|
||||||
|
public void actionPerformed(ActionEvent e){
|
||||||
|
customFXList.clear();
|
||||||
|
fancyChars = JOptionPane.showInputDialog(null, "Enter character String\ne.g. 91b to use 9, 1, and b alternatively\nAny number of colors is usable");
|
||||||
|
cleanChars = fancyChars;
|
||||||
|
for (int c = 0; c < colorList.length; c++)
|
||||||
|
cleanChars = cleanChars.replace(Character.toString(colorList[c]), "");
|
||||||
|
System.out.println(cleanChars);
|
||||||
|
if (cleanChars.length() > 0)
|
||||||
|
JOptionPane.showMessageDialog(null, "<html><font color=#AA0000>\'" + cleanChars + "\' are not valid color codes.", "Minecraft Colors", JOptionPane.ERROR_MESSAGE);
|
||||||
|
for (int c = 0; c < fancyChars.length(); c++){
|
||||||
|
String part =fancyChars.substring(c, c + 1);
|
||||||
|
customFXList.add(part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private class colorSaveListener implements ActionListener{
|
||||||
|
public void actionPerformed(ActionEvent e){
|
||||||
|
customColorList.clear();
|
||||||
|
if (color0.isSelected())
|
||||||
|
customColorList.add('0');
|
||||||
|
if (color1.isSelected())
|
||||||
|
customColorList.add('1');
|
||||||
|
if (color2.isSelected())
|
||||||
|
customColorList.add('2');
|
||||||
|
if (color3.isSelected())
|
||||||
|
customColorList.add('3');
|
||||||
|
if (color4.isSelected())
|
||||||
|
customColorList.add('4');
|
||||||
|
if (color5.isSelected())
|
||||||
|
customColorList.add('5');
|
||||||
|
if (color6.isSelected())
|
||||||
|
customColorList.add('6');
|
||||||
|
if (color7.isSelected())
|
||||||
|
customColorList.add('7');
|
||||||
|
if (color8.isSelected())
|
||||||
|
customColorList.add('8');
|
||||||
|
if (color9.isSelected())
|
||||||
|
customColorList.add('9');
|
||||||
|
if (colora.isSelected())
|
||||||
|
customColorList.add('a');
|
||||||
|
if (colorb.isSelected())
|
||||||
|
customColorList.add('b');
|
||||||
|
if (colorc.isSelected())
|
||||||
|
customColorList.add('c');
|
||||||
|
if (colord.isSelected())
|
||||||
|
customColorList.add('d');
|
||||||
|
if (colore.isSelected())
|
||||||
|
customColorList.add('e');
|
||||||
|
if (colorf.isSelected())
|
||||||
|
customColorList.add('f');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private class randomListener implements ItemListener{
|
||||||
|
public void itemStateChanged(ItemEvent event) {
|
||||||
|
randomColors = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private class selectedListener implements ItemListener{
|
||||||
|
public void itemStateChanged(ItemEvent e) {
|
||||||
|
randomColors = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private class customRandomListener implements ItemListener{
|
||||||
|
public void itemStateChanged(ItemEvent event){
|
||||||
|
randomColors = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private class doneListener implements ActionListener{
|
||||||
|
public void actionPerformed(ActionEvent e){
|
||||||
|
ready = true;
|
||||||
|
if (randomColors == 1){
|
||||||
|
a = colorList[randomInt(colorList.length)];
|
||||||
|
b = colorList[randomInt(colorList.length)];
|
||||||
|
}
|
||||||
|
else if (randomColors == 0){
|
||||||
|
String astr = (String)chara.getSelectedItem();
|
||||||
|
String bstr = (String)charb.getSelectedItem();
|
||||||
|
a = astr.charAt(0);
|
||||||
|
b = bstr.charAt(0);
|
||||||
|
}
|
||||||
|
else if (randomColors == 2){
|
||||||
|
if (customColorList.size() < 1){
|
||||||
|
ready = false;
|
||||||
|
JOptionPane.showMessageDialog(null, "Your custom color list is empty", "Chat Color Alternator", JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
a = customColorList.get(randomInt(customColorList.size()));
|
||||||
|
b = customColorList.get(randomInt(customColorList.size()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
JOptionPane.showMessageDialog(null, "Reply to the forum topic stating \n\"Error in randomColors\"\n so MinerMike can debug and fix", "Chat Color Alternator", JOptionPane.ERROR_MESSAGE);
|
||||||
|
String copy = (String)copyBox.getSelectedItem();
|
||||||
|
String mode = (String)modeBox.getSelectedItem();
|
||||||
|
text = textField.getText();
|
||||||
|
if (text.trim().equals("")){
|
||||||
|
JOptionPane.showMessageDialog(null, "You can't add color to nothing", "Chat Color Alternator", JOptionPane.ERROR_MESSAGE);
|
||||||
|
ready = false;
|
||||||
|
}
|
||||||
|
if (ready){
|
||||||
|
if (mode.equalsIgnoreCase("alternate every other letter")){
|
||||||
|
if (copy.equalsIgnoreCase("yes")){
|
||||||
|
toClipboard(alternateLetter());
|
||||||
|
outputField.setText("Text copied to clipboard!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outputField.setText(alternateLetter());
|
||||||
|
}
|
||||||
|
else if (mode.equalsIgnoreCase("first letter of each word")){
|
||||||
|
if (copy.equalsIgnoreCase("yes")){
|
||||||
|
toClipboard(firstLetterWord());
|
||||||
|
outputField.setText("Text copied to clipboard!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outputField.setText(firstLetterWord());
|
||||||
|
}
|
||||||
|
else if (mode.equalsIgnoreCase("random colors every letter")){
|
||||||
|
if (copy.equalsIgnoreCase("yes")){
|
||||||
|
toClipboard(randomColorsEveryLetter());
|
||||||
|
outputField.setText("Text copied to clipboard!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outputField.setText(randomColorsEveryLetter());
|
||||||
|
}
|
||||||
|
else if (mode.equalsIgnoreCase("custom random colors every letter")){
|
||||||
|
if (copy.equalsIgnoreCase("yes")){
|
||||||
|
toClipboard(customRandomColorsEveryLetter());
|
||||||
|
outputField.setText("Text copied to clipboard!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outputField.setText(customRandomColorsEveryLetter());
|
||||||
|
}
|
||||||
|
else if (mode.equalsIgnoreCase("multicolor")){
|
||||||
|
if (cleanChars.length() > 0)
|
||||||
|
{
|
||||||
|
JOptionPane.showMessageDialog(null, "<html><font color=#AA0000>\'" + cleanChars + "\' are not valid color codes.", "Minecraft Colors", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (copy.equalsIgnoreCase("yes")){
|
||||||
|
toClipboard(multiFX());
|
||||||
|
outputField.setText("Text copied to clipboard!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outputField.setText(multiFX());
|
||||||
|
}
|
||||||
|
else if (mode.equalsIgnoreCase("rainbow")){
|
||||||
|
if (copy.equalsIgnoreCase("yes")){
|
||||||
|
toClipboard(rainbowificate());
|
||||||
|
outputField.setText("Text copied to clipboard!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outputField.setText(rainbowificate());
|
||||||
|
}
|
||||||
|
else if (mode.equalsIgnoreCase("split message")){
|
||||||
|
if (copy.equalsIgnoreCase("yes")){
|
||||||
|
toClipboard(splitColors());
|
||||||
|
outputField.setText("Text copied to clipboard!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outputField.setText(splitColors());
|
||||||
|
}
|
||||||
|
else if (mode.equalsIgnoreCase("color capital letters")){
|
||||||
|
if (copy.equalsIgnoreCase("yes")){
|
||||||
|
toClipboard(colorCapital());
|
||||||
|
outputField.setText("Text copied to clipboard!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outputField.setText(colorCapital());
|
||||||
|
}
|
||||||
|
else if (mode.equalsIgnoreCase("every other word")){
|
||||||
|
if (copy.equalsIgnoreCase("yes")){
|
||||||
|
toClipboard(altEveryWord());
|
||||||
|
outputField.setText("Text copied to clipboard!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outputField.setText(altEveryWord());
|
||||||
|
}
|
||||||
|
else if (mode.equalsIgnoreCase("light rainbow")){
|
||||||
|
if (copy.equalsIgnoreCase("yes")){
|
||||||
|
toClipboard(lightRainbowificate());
|
||||||
|
outputField.setText("Text copied to clipboard!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outputField.setText(lightRainbowificate());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int randomInt(int max){
|
||||||
|
return (int) (Math.random() * max);
|
||||||
|
}
|
||||||
|
private void showCustomColorGUI(){
|
||||||
|
customColorGUI gui = new customColorGUI();
|
||||||
|
gui.setSize(360,225);
|
||||||
|
gui.setVisible(true);
|
||||||
|
}
|
||||||
|
private class customColorGUI extends JFrame{
|
||||||
|
public customColorGUI(){
|
||||||
|
super("Custom Random Color Settings");
|
||||||
|
setLayout(new GridLayout(7,3));
|
||||||
|
add(color0);
|
||||||
|
add(color1);
|
||||||
|
add(color2);
|
||||||
|
add(color3);
|
||||||
|
add(color4);
|
||||||
|
add(color5);
|
||||||
|
add(color6);
|
||||||
|
add(color7);
|
||||||
|
add(color8);
|
||||||
|
add(color9);
|
||||||
|
add(colora);
|
||||||
|
add(colorb);
|
||||||
|
add(colorc);
|
||||||
|
add(colord);
|
||||||
|
add(colore);
|
||||||
|
add(new JLabel(""));
|
||||||
|
add(colorf);
|
||||||
|
add(new JLabel(""));
|
||||||
|
add(new JLabel(""));
|
||||||
|
add(customColorsSaveButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue