1 package sellwin.gui; 2 3 import sellwin.domain.*; 4 import java.util.*; 5 import java.rmi.*; 6 import javax.swing.*; 7 import javax.swing.border.*; 8 import java.awt.*; 9 import java.awt.event.*; 10 11 15 23 public class PrefsDialog extends JDialog { 24 private PrefsPanel prefsPanel = new PrefsPanel(); 25 private JButton applyButton = new JButton("Apply"); 26 private JButton closeButton = new JButton("Cancel"); 27 private JLabel statusLabel = new JLabel(""); 28 private Whiteboard wb; 29 30 33 public PrefsDialog() { 34 super(); 35 36 wb = MainWindow.getWhiteboard(); 37 38 setLang(); 39 setSize(650, 272); 40 setFonts(); 41 setColors(); 42 43 prefsPanel.setBorder(new EtchedBorder()); 44 getContentPane().setLayout(new BorderLayout()); 45 46 getContentPane().add(prefsPanel, BorderLayout.CENTER); 47 JPanel buttonPanel = new JPanel(); 48 buttonPanel.add(applyButton); 49 buttonPanel.add(closeButton); 50 getContentPane().add(buttonPanel, BorderLayout.SOUTH); 51 52 WindowListener l = new WindowAdapter() { 53 public void windowClosed(WindowEvent e) { 54 } 55 56 public void windowClosing(WindowEvent e) { 57 hide(); 58 } 59 }; 60 61 addWindowListener(l); 62 63 getRootPane().setDefaultButton(applyButton); 64 65 closeButton.addActionListener( 66 new ActionListener() { 67 public void actionPerformed(ActionEvent e) { 68 hide(); 69 } 70 }); 71 72 applyButton.addActionListener( 73 new ActionListener() { 74 public void actionPerformed(ActionEvent e) { 75 prefsPanel.storeProps(); 76 wb.setLang(prefsPanel.getLang()); 77 wb.getMainWindow().setLang(); 78 setLang(); 79 } 80 }); 81 82 getRootPane().setDefaultButton(applyButton); 83 84 } 85 86 89 public final void setFonts() { 90 applyButton.setFont(MainWindow.LABEL_FONT); 91 closeButton.setFont(MainWindow.LABEL_FONT); 92 } 93 94 public final void setColors() {} 95 96 99 public final void setLang() { 100 prefsPanel.setLang(); 101 setTitle(wb.getLang().getString("prefs")); 102 applyButton.setText(wb.getLang().getString("apply")); 103 closeButton.setText(wb.getLang().getString("close")); 104 } 105 } 106 | Popular Tags |