source: josm/trunk/src/org/openstreetmap/josm/tools/DontShowAgainInfo.java@ 627

Last change on this file since 627 was 627, checked in by framm, 16 years ago
  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.tools;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5
6import java.awt.Container;
7import java.awt.GridBagLayout;
8
9import javax.swing.JCheckBox;
10import javax.swing.JLabel;
11import javax.swing.JOptionPane;
12import javax.swing.JPanel;
13
14import org.openstreetmap.josm.Main;
15
16public class DontShowAgainInfo {
17
18 public static boolean show(String prefKey, String msg) {
19 return show(prefKey, new JLabel(msg));
20 }
21
22 public static boolean show(String prefKey, Container msg) {
23 if (!Main.pref.getBoolean("message."+prefKey)) {
24 JCheckBox dontshowagain = new JCheckBox(tr("Do not show again"));
25 dontshowagain.setSelected(Main.pref.getBoolean("message."+prefKey, true));
26 JPanel all = new JPanel(new GridBagLayout());
27 all.add(msg, GBC.eop());
28 all.add(dontshowagain, GBC.eol());
29 int answer = JOptionPane.showConfirmDialog(Main.parent, all, tr("Information"), JOptionPane.OK_CANCEL_OPTION);
30 if (answer != JOptionPane.OK_OPTION)
31 return false;
32 Main.pref.put("message."+prefKey, dontshowagain.isSelected());
33 }
34 return true;
35 }
36}
Note: See TracBrowser for help on using the repository browser.