use of java.util.prefs.BackingStoreException in project triplea by triplea-game.
the class AbstractUiContext method setShowTriggerChanceFailure.
@Override
public void setShowTriggerChanceFailure(final boolean value) {
final Preferences prefs = Preferences.userNodeForPackage(AbstractUiContext.class);
prefs.putBoolean(SHOW_TRIGGERED_CHANCE_FAILURE, value);
try {
prefs.flush();
} catch (final BackingStoreException ex) {
ClientLogger.logQuietly("Failed to flush preferences: " + prefs.absolutePath(), ex);
}
}
use of java.util.prefs.BackingStoreException in project triplea by triplea-game.
the class AbstractUiContext method setShowTriggeredNotifications.
@Override
public void setShowTriggeredNotifications(final boolean value) {
final Preferences prefs = Preferences.userNodeForPackage(AbstractUiContext.class);
prefs.putBoolean(SHOW_TRIGGERED_NOTIFICATIONS, value);
try {
prefs.flush();
} catch (final BackingStoreException ex) {
ex.printStackTrace();
}
}
use of java.util.prefs.BackingStoreException in project triplea by triplea-game.
the class TileImageFactory method setShowMapBlendAlpha.
public static void setShowMapBlendAlpha(final float showMapBlendAlpha) {
TileImageFactory.showMapBlendAlpha = showMapBlendAlpha;
final Preferences prefs = Preferences.userNodeForPackage(TileImageFactory.class);
prefs.putFloat(SHOW_MAP_BLEND_ALPHA, TileImageFactory.showMapBlendAlpha);
try {
prefs.flush();
} catch (final BackingStoreException ex) {
ClientLogger.logQuietly("faild to save value: " + showMapBlendAlpha, ex);
}
}
use of java.util.prefs.BackingStoreException in project triplea by triplea-game.
the class TileImageFactory method setShowMapBlendMode.
public static void setShowMapBlendMode(final String showMapBlendMode) {
TileImageFactory.showMapBlendMode = showMapBlendMode;
final Preferences prefs = Preferences.userNodeForPackage(TileImageFactory.class);
prefs.put(SHOW_MAP_BLEND_MODE, TileImageFactory.showMapBlendMode);
try {
prefs.flush();
} catch (final BackingStoreException ex) {
ClientLogger.logQuietly("faild to save value: " + showMapBlendMode, ex);
}
}
use of java.util.prefs.BackingStoreException in project jvarkit by lindenb.
the class FilePeeker method choose.
public void choose() {
Preferences prefs = Preferences.userNodeForPackage(getClass());
String dirStr = prefs.get("last.directory." + name, null);
File lastDir = null;
if (dirStr != null)
lastDir = new File(dirStr);
JFileChooser chooser = new JFileChooser(lastDir);
if (fileFilter != null)
chooser.setFileFilter(fileFilter);
chooser.setMultiSelectionEnabled(this.multiple);
if (chooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION) {
return;
}
if (multiple) {
DefaultListModel<File> m = (DefaultListModel<File>) fileList.getModel();
for (File f : chooser.getSelectedFiles()) {
if (m.indexOf(f) != -1)
continue;
m.addElement(f);
}
} else {
File f = chooser.getSelectedFile();
setFile(f);
if (this.file.getParentFile() != null) {
prefs.put("last.directory." + name, this.file.getParentFile().getPath());
try {
prefs.sync();
} catch (BackingStoreException err) {
}
}
}
}
Aggregations