Improved code style and formatting

This commit is contained in:
2019-12-15 16:26:11 +01:00
parent 4f777412f3
commit adb5c417c5
2 changed files with 48 additions and 68 deletions

View File

@ -49,22 +49,22 @@ public class ChatWindow extends JFrame {
private static final long serialVersionUID = 6865098428255463649L;
// user specific objects
// User specific objects
private Client client;
private LocalDB localDB;
// GUI components
private JPanel contentPane = new JPanel();
private PrimaryTextArea messageEnterTextArea = new PrimaryTextArea(space);
private JList<User> userList = new JList<>();
private JPanel contentPane = new JPanel();
private PrimaryTextArea messageEnterTextArea = new PrimaryTextArea(space);
private JList<User> userList = new JList<>();
private Chat currentChat;
private JList<Message> messageList = new JList<>();
private JScrollPane scrollPane = new JScrollPane();
private JTextPane textPane = new JTextPane();
// private JCheckBox jCbChangeMode;
private PrimaryButton postButton = new PrimaryButton("Post");
private PrimaryButton settingsButton = new PrimaryButton("Settings");
private JList<Message> messageList = new JList<>();
private JScrollPane scrollPane = new JScrollPane();
private int verticalScrollBarMaximumValue = scrollPane.getVerticalScrollBar().getMaximum();
private boolean chatOpened = false;
private JTextPane textPane = new JTextPane();
private PrimaryButton postButton = new PrimaryButton("Post");
private PrimaryButton settingsButton = new PrimaryButton("Settings");
private static int space = 4;
@ -239,7 +239,7 @@ public class ChatWindow extends JFrame {
/**
* Used to immediately reload the ChatWindow when settings were changed.
*
*
* @since Envoy v0.1-alpha
*/
public void changeChatWindowColors(String key) {
@ -260,8 +260,7 @@ public class ChatWindow extends JFrame {
// Scroll Bar Styling
scrollPane.getVerticalScrollBar().setBackground(theme.getCellColor());
scrollPane.getVerticalScrollBar()
.setUI(new PrimaryScrollBar(5, theme.getInteractableBackgroundColor(),
new Color(theme.getInteractableBackgroundColor().getRGB() - 50),
.setUI(new PrimaryScrollBar(5, theme.getInteractableBackgroundColor(), new Color(theme.getInteractableBackgroundColor().getRGB() - 50),
new Color(theme.getInteractableBackgroundColor().getRGB() + 170), true));
scrollPane.getHorizontalScrollBar().setBackground(theme.getCellColor());
scrollPane.getHorizontalScrollBar()
@ -270,9 +269,7 @@ public class ChatWindow extends JFrame {
// Autoscroll
scrollPane.getVerticalScrollBar().addAdjustmentListener(e -> {
if ((verticalScrollBarMaximumValue - e.getAdjustable().getMaximum()) == 0) {
return;
}
if ((verticalScrollBarMaximumValue - e.getAdjustable().getMaximum()) == 0) { return; }
if (chatOpened == true) {
e.getAdjustable().setValue(e.getAdjustable().getMaximum());
@ -280,8 +277,8 @@ public class ChatWindow extends JFrame {
chatOpened = false;
return;
}
if (scrollPane.getVerticalScrollBar().getValue()
+ scrollPane.getVerticalScrollBar().getVisibleAmount() + 100 >= scrollPane.getVerticalScrollBar().getMaximum()) {
if (scrollPane.getVerticalScrollBar().getValue() + scrollPane.getVerticalScrollBar().getVisibleAmount()
+ 100 >= scrollPane.getVerticalScrollBar().getMaximum()) {
e.getAdjustable().setValue(e.getAdjustable().getMaximum());
verticalScrollBarMaximumValue = scrollPane.getVerticalScrollBar().getMaximum();
}