Merge pull request #66 from informatik-ag-ngl/f/ThemeCustomizationAlignment
Settings UI Allignment
This commit is contained in:
commit
e2dc19fbef
@ -25,6 +25,7 @@ import envoy.client.util.EnvoyLog;
|
||||
* Created: <strong>20 Dec 2019</strong><br>
|
||||
*
|
||||
* @author Kai S. K. Engelbart
|
||||
* @author Maximilian Käfer
|
||||
* @since Envoy v0.2-alpha
|
||||
*/
|
||||
public class ThemeCustomizationPanel extends SettingsPanel {
|
||||
@ -81,10 +82,17 @@ public class ThemeCustomizationPanel extends SettingsPanel {
|
||||
gbc_themes.insets = insets;
|
||||
|
||||
add(themes, gbc_themes);
|
||||
|
||||
GridBagLayout gbl_colorCustomizations = new GridBagLayout();
|
||||
|
||||
colorsPanel.setLayout(new BoxLayout(colorsPanel, BoxLayout.Y_AXIS));
|
||||
colorsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
gbl_colorCustomizations.columnWidths = new int[] { 1, 1 };
|
||||
gbl_colorCustomizations.rowHeights = new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1};
|
||||
gbl_colorCustomizations.columnWeights = new double[] { 1.0, 1.0 };
|
||||
gbl_colorCustomizations.rowWeights = new double[] { 1, 1, 1, 1, 1, 1, 1, 1};
|
||||
|
||||
colorsPanel.setLayout(gbl_colorCustomizations);
|
||||
|
||||
|
||||
Theme theme = Settings.getInstance().getThemes().get(Settings.getInstance().getCurrentTheme());
|
||||
buildCustomizeElements(theme);
|
||||
|
||||
@ -170,6 +178,7 @@ public class ThemeCustomizationPanel extends SettingsPanel {
|
||||
colorsPanel.removeAll();
|
||||
|
||||
buildCustomizeElements(theme);
|
||||
colorsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
|
||||
GridBagConstraints gbc_createNewTheme = new GridBagConstraints();
|
||||
gbc_createNewTheme.gridx = 0;
|
||||
@ -179,19 +188,18 @@ public class ThemeCustomizationPanel extends SettingsPanel {
|
||||
}
|
||||
|
||||
private void buildCustomizeElements(Theme theme) {
|
||||
buildCustomizeElement(theme, theme.getBackgroundColor(), "Background", "backgroundColor");
|
||||
buildCustomizeElement(theme, theme.getCellColor(), "Cells", "cellColor");
|
||||
buildCustomizeElement(theme, theme.getInteractableForegroundColor(), "Interactable Foreground", "interactableForegroundColor");
|
||||
buildCustomizeElement(theme, theme.getInteractableBackgroundColor(), "Interactable Background", "interactableBackgroundColor");
|
||||
buildCustomizeElement(theme, theme.getMessageColorChat(), "Messages Chat", "messageColorChat");
|
||||
buildCustomizeElement(theme, theme.getDateColorChat(), "Date Chat", "dateColorCat");
|
||||
buildCustomizeElement(theme, theme.getSelectionColor(), "Selection", "selectionColor");
|
||||
buildCustomizeElement(theme, theme.getTypingMessageColor(), "Typing Message", "typingMessageColor");
|
||||
buildCustomizeElement(theme, theme.getUserNameColor(), "User Names", "userNameColor");
|
||||
buildCustomizeElement(theme, theme.getBackgroundColor(), "Background", "backgroundColor", 1);
|
||||
buildCustomizeElement(theme, theme.getCellColor(), "Cells", "cellColor", 2);
|
||||
buildCustomizeElement(theme, theme.getInteractableForegroundColor(), "Interactable Foreground", "interactableForegroundColor", 3);
|
||||
buildCustomizeElement(theme, theme.getInteractableBackgroundColor(), "Interactable Background", "interactableBackgroundColor", 4);
|
||||
buildCustomizeElement(theme, theme.getMessageColorChat(), "Messages Chat", "messageColorChat", 5);
|
||||
buildCustomizeElement(theme, theme.getDateColorChat(), "Date Chat", "dateColorCat", 6);
|
||||
buildCustomizeElement(theme, theme.getSelectionColor(), "Selection", "selectionColor", 7);
|
||||
buildCustomizeElement(theme, theme.getTypingMessageColor(), "Typing Message", "typingMessageColor", 8);
|
||||
buildCustomizeElement(theme, theme.getUserNameColor(), "User Names", "userNameColor", 9);
|
||||
}
|
||||
|
||||
private void buildCustomizeElement(Theme theme, Color color, String name, String colorName) {
|
||||
JPanel panel = new JPanel();
|
||||
private void buildCustomizeElement(Theme theme, Color color, String name, String colorName, int gridy) {
|
||||
JButton button = new JButton();
|
||||
JTextPane textPane = new JTextPane();
|
||||
|
||||
@ -222,12 +230,24 @@ public class ThemeCustomizationPanel extends SettingsPanel {
|
||||
}
|
||||
});
|
||||
|
||||
panel.add(textPane);
|
||||
panel.add(button);
|
||||
panel.setBackground(theme.getCellColor());
|
||||
panel.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||
GridBagConstraints gbc_textPane = new GridBagConstraints();
|
||||
gbc_textPane.fill = GridBagConstraints.BOTH;
|
||||
gbc_textPane.gridx = 0;
|
||||
gbc_textPane.gridy = gridy;
|
||||
gbc_textPane.anchor = GridBagConstraints.CENTER;
|
||||
gbc_textPane.insets = insets;
|
||||
|
||||
colorsPanel.add(panel);
|
||||
colorsPanel.add(textPane, gbc_textPane);
|
||||
|
||||
|
||||
GridBagConstraints gbc_button = new GridBagConstraints();
|
||||
gbc_button.fill = GridBagConstraints.BOTH;
|
||||
gbc_button.gridx = 1;
|
||||
gbc_button.gridy = gridy;
|
||||
gbc_button.anchor = GridBagConstraints.CENTER;
|
||||
gbc_button.insets = insets;
|
||||
|
||||
colorsPanel.add(button, gbc_button);
|
||||
}
|
||||
|
||||
private Color getInvertedColor(Color color) { return new Color(255 - color.getRed(), 255 - color.getGreen(), 255 - color.getBlue()); }
|
||||
|
Reference in New Issue
Block a user