1 package com.jsql.view.swing.menubar;
2
3 import com.jsql.model.InjectionModel;
4
5 import javax.swing.*;
6 import java.util.prefs.Preferences;
7
8 public class ModelCheckboxMenu {
9
10 protected final String i18n;
11 protected final String keyPref;
12 protected final Runnable runnableInsertTab;
13 protected final Icon icon;
14 protected final boolean isChecked;
15
16 public ModelCheckboxMenu(String i18n, String keyPref, Runnable runnableInsertTab, Icon icon) {
17 this(i18n, keyPref, runnableInsertTab, icon, true);
18 }
19
20 public ModelCheckboxMenu(String i18n, String keyPref, Runnable runnableInsertTab, Icon icon, boolean isChecked) {
21 Preferences preferences = Preferences.userRoot().node(InjectionModel.class.getName());
22 this.i18n = i18n;
23 this.keyPref = keyPref;
24 this.runnableInsertTab = runnableInsertTab;
25 this.icon = icon;
26 this.isChecked = preferences.getBoolean(keyPref, isChecked);
27 }
28 }