use of com.glitchcog.fontificator.gui.component.palette.Palette in project ChatGameFontificator by GlitchCog.
the class ControlPanelColor method build.
@Override
protected void build() {
useTwitchBox = new JCheckBox("Override Palette with Twitch Username Colors when Available");
joinBox = new JCheckBox("Color Join Messages");
usernameBox = new JCheckBox("Color Usernames");
timestampBox = new JCheckBox("Color Timestamps");
messageBox = new JCheckBox("Color Messages");
ActionListener boxListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JCheckBox source = (JCheckBox) e.getSource();
if (useTwitchBox.equals(source)) {
config.setUseTwitchColors(source.isSelected());
} else if (joinBox.equals(source)) {
config.setColorJoin(source.isSelected());
} else if (usernameBox.equals(source)) {
config.setColorUsername(source.isSelected());
} else if (timestampBox.equals(source)) {
config.setColorTimestamp(source.isSelected());
} else if (messageBox.equals(source)) {
config.setColorMessage(source.isSelected());
}
chat.repaint();
}
};
useTwitchBox.addActionListener(boxListener);
joinBox.addActionListener(boxListener);
usernameBox.addActionListener(boxListener);
timestampBox.addActionListener(boxListener);
messageBox.addActionListener(boxListener);
bgColorButton = new ColorButton("Background", Color.BLACK, "Set the color of the background of the chat", this);
chromaColorButton = new ColorButton("Chroma Key", Color.GREEN, "Set the color for the chroma key border region", this);
fgColorButton = new ColorButton("Text Tint", Color.WHITE, "Set the color of the text of the chat", this);
borderColorButton = new ColorButton("Border Tint", Color.WHITE, "Set the color of the border of the chat", this);
highlightButton = new ColorButton("Highlight Tint", Color.YELLOW, "Set the default color used to highlight the text of the chat", this);
palette = new Palette(Color.BLACK, this);
JPanel topColorPanel = new JPanel(new GridLayout(2, 1));
JPanel botOptionsPanel = new JPanel(new GridBagLayout());
JPanel palettePanel = new JPanel(new GridBagLayout());
topColorPanel.setBorder(new TitledBorder(baseBorder, "Color Selections", TitledBorder.CENTER, TitledBorder.TOP));
palettePanel.setBorder(new TitledBorder(baseBorder, "Palette of Colors drawn from, per Username", TitledBorder.CENTER, TitledBorder.TOP));
botOptionsPanel.setBorder(new TitledBorder(baseBorder, "Color Options", TitledBorder.CENTER, TitledBorder.TOP));
JPanel colorPanelA = new JPanel(new GridLayout(1, 2));
colorPanelA.add(bgColorButton);
colorPanelA.add(chromaColorButton);
JPanel colorPanelB = new JPanel(new GridLayout(1, 3));
colorPanelB.add(fgColorButton);
colorPanelB.add(highlightButton);
colorPanelB.add(borderColorButton);
topColorPanel.add(colorPanelA);
topColorPanel.add(colorPanelB);
GridBagConstraints ppGbc = new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, NO_INSETS, 0, 0);
palettePanel.add(palette, ppGbc);
ppGbc.gridy++;
palettePanel.add(useTwitchBox, ppGbc);
GridBagConstraints optionsGbc = new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, DEFAULT_INSETS, 0, 0);
botOptionsPanel.add(joinBox, optionsGbc);
optionsGbc.gridx++;
botOptionsPanel.add(usernameBox, optionsGbc);
optionsGbc.gridx = 0;
optionsGbc.gridy++;
botOptionsPanel.add(timestampBox, optionsGbc);
optionsGbc.gridx++;
botOptionsPanel.add(messageBox, optionsGbc);
gbc.anchor = GridBagConstraints.NORTH;
gbc.weighty = 0.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
add(topColorPanel, gbc);
gbc.gridy++;
add(palettePanel, gbc);
gbc.gridy++;
add(botOptionsPanel, gbc);
// Filler panel
gbc.gridy++;
gbc.anchor = GridBagConstraints.SOUTH;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
add(new JPanel(), gbc);
gbc.gridy++;
}
Aggregations