1010import javax .swing .*;
1111import java .awt .event .MouseAdapter ;
1212import java .awt .event .MouseEvent ;
13+ import java .util .Objects ;
1314
1415/**
1516 * Created by Jamling on 2017/7/11.
1617 */
1718public class GeneralPanel implements Configurable {
18- private JComboBox comboSend ;
19+ private JComboBox < String > comboSend ;
1920 private JCheckBox chkNotify ;
2021 private JCheckBox chkNotifyUnread ;
2122 private JCheckBox chkSendBtn ;
@@ -26,7 +27,7 @@ public class GeneralPanel implements Configurable {
2627 private JLabel linkUpdate ;
2728 private JLabel linkAbout ;
2829 private JCheckBox chkHistory ;
29- private SmartIMSettings settings ;
30+ private final SmartIMSettings settings ;
3031
3132 public GeneralPanel (SmartIMSettings settings ) {
3233 this .settings = settings ;
@@ -56,7 +57,7 @@ public GeneralPanel(SmartIMSettings settings) {
5657 }
5758
5859 @ Override public boolean isModified () {
59- return chkNotify .isSelected () != settings .getState ().NOTIFY_MSG || chkNotifyUnread .isSelected () != settings
60+ return chkNotify .isSelected () != Objects . requireNonNull ( settings .getState () ).NOTIFY_MSG || chkNotifyUnread .isSelected () != settings
6061 .getState ().NOTIFY_UNREAD || chkSendBtn .isSelected () != settings .getState ().SHOW_SEND
6162 || chkNotifyGroupMsg .isSelected () != settings .getState ().NOTIFY_GROUP_MSG
6263 || chkNotifyUnknown .isSelected () != settings .getState ().NOTIFY_UNKNOWN
@@ -65,7 +66,7 @@ public GeneralPanel(SmartIMSettings settings) {
6566 }
6667
6768 @ Override public void apply () throws ConfigurationException {
68- settings .getState ().NOTIFY_MSG = chkNotify .isSelected ();
69+ Objects . requireNonNull ( settings .getState () ).NOTIFY_MSG = chkNotify .isSelected ();
6970 settings .getState ().NOTIFY_UNREAD = chkNotifyUnread .isSelected ();
7071 settings .getState ().SHOW_SEND = chkSendBtn .isSelected ();
7172 settings .getState ().NOTIFY_GROUP_MSG = chkNotifyGroupMsg .isSelected ();
@@ -76,7 +77,7 @@ public GeneralPanel(SmartIMSettings settings) {
7677 }
7778
7879 @ Override public void reset () {
79- chkNotify .setSelected (settings .getState ().NOTIFY_MSG );
80+ chkNotify .setSelected (Objects . requireNonNull ( settings .getState () ).NOTIFY_MSG );
8081 chkNotifyGroupMsg .setSelected (settings .getState ().NOTIFY_GROUP_MSG );
8182 chkSendBtn .setSelected (settings .getState ().SHOW_SEND );
8283 chkNotifyUnread .setSelected (settings .getState ().NOTIFY_UNREAD );
@@ -86,10 +87,6 @@ public GeneralPanel(SmartIMSettings settings) {
8687 comboSend .setSelectedItem (settings .getState ().KEY_SEND );
8788 }
8889
89- @ Override public void disposeUIResources () {
90-
91- }
92-
9390 private void checkUpdate () {
9491 RestUtils .checkUpdate ();
9592 }
0 commit comments