1 6 7 package com.quikj.application.web.talk.client; 8 9 import java.awt.*; 10 import java.util.*; 11 12 16 public class AudioControlDialog extends java.awt.Dialog 17 { 18 19 20 public AudioControlDialog(java.awt.Frame parent, Locale locale) 21 { 22 super(parent, true); 23 this.locale = locale; 24 initComponents(); 25 26 muteBuzzButton.setState(muteBuzz); 27 muteChimeButton.setState(muteChime); 28 muteRingingButton.setState(muteRinging); 29 muteLogNotificationButton.setState(muteLogNotification); 30 31 Rectangle pbounds = parent.getBounds(); 32 Point mid = new Point(pbounds.x + (pbounds.width/2), pbounds.y + (pbounds.height/2)); 33 Rectangle bounds = getBounds(); 34 int x = mid.x - (bounds.width/2); 35 int y = mid.y - (bounds.height/2); 36 if (x < 0) x = pbounds.x; 37 if (y < 0) y = pbounds.y; 38 setBounds(x, y, bounds.width, bounds.height); 39 show(); 40 } 41 42 47 private void initComponents() { 49 java.awt.GridBagConstraints gridBagConstraints; 50 51 panel1 = new java.awt.Panel (); 52 muteBuzzButton = new java.awt.Checkbox (); 53 muteChimeButton = new java.awt.Checkbox (); 54 muteRingingButton = new java.awt.Checkbox (); 55 muteLogNotificationButton = new java.awt.Checkbox (); 56 panel2 = new java.awt.Panel (); 57 closeButton = new java.awt.Button (); 58 cancelButton = new java.awt.Button (); 59 60 setLayout(new java.awt.GridBagLayout ()); 61 62 setBackground(java.awt.Color.white); 63 setModal(true); 64 setTitle(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.client.language", locale).getString("Audio_Control")); 65 addWindowListener(new java.awt.event.WindowAdapter () 66 { 67 public void windowClosing(java.awt.event.WindowEvent evt) 68 { 69 closeDialog(evt); 70 } 71 }); 72 73 panel1.setLayout(new java.awt.GridBagLayout ()); 74 75 panel1.setBackground(new java.awt.Color (255, 255, 255)); 76 muteBuzzButton.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.client.language", locale).getString("Mute_buzz")); 77 gridBagConstraints = new java.awt.GridBagConstraints (); 78 gridBagConstraints.gridx = 0; 79 gridBagConstraints.gridy = 0; 80 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 81 gridBagConstraints.insets = new java.awt.Insets (10, 10, 0, 10); 82 panel1.add(muteBuzzButton, gridBagConstraints); 83 84 muteChimeButton.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.client.language", locale).getString("Mute_chime")); 85 gridBagConstraints = new java.awt.GridBagConstraints (); 86 gridBagConstraints.gridx = 0; 87 gridBagConstraints.gridy = 1; 88 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 89 gridBagConstraints.insets = new java.awt.Insets (10, 10, 0, 10); 90 panel1.add(muteChimeButton, gridBagConstraints); 91 92 muteRingingButton.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.client.language", locale).getString("Mute_ringing")); 93 gridBagConstraints = new java.awt.GridBagConstraints (); 94 gridBagConstraints.gridx = 0; 95 gridBagConstraints.gridy = 2; 96 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 97 gridBagConstraints.insets = new java.awt.Insets (10, 10, 0, 10); 98 panel1.add(muteRingingButton, gridBagConstraints); 99 100 muteLogNotificationButton.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.client.language", locale).getString("Mute_login_slash_logout_notification")); 101 gridBagConstraints = new java.awt.GridBagConstraints (); 102 gridBagConstraints.gridx = 0; 103 gridBagConstraints.gridy = 3; 104 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 105 gridBagConstraints.insets = new java.awt.Insets (10, 10, 0, 10); 106 panel1.add(muteLogNotificationButton, gridBagConstraints); 107 108 gridBagConstraints = new java.awt.GridBagConstraints (); 109 gridBagConstraints.gridx = 0; 110 gridBagConstraints.gridy = 0; 111 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 112 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 113 gridBagConstraints.weightx = 100.0; 114 gridBagConstraints.weighty = 100.0; 115 add(panel1, gridBagConstraints); 116 117 panel2.setLayout(new java.awt.GridBagLayout ()); 118 119 panel2.setBackground(new java.awt.Color (255, 255, 255)); 120 closeButton.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.client.language", locale).getString("Apply")); 121 closeButton.addActionListener(new java.awt.event.ActionListener () 122 { 123 public void actionPerformed(java.awt.event.ActionEvent evt) 124 { 125 closeButtonActionPerformed(evt); 126 } 127 }); 128 129 gridBagConstraints = new java.awt.GridBagConstraints (); 130 gridBagConstraints.insets = new java.awt.Insets (10, 10, 10, 0); 131 panel2.add(closeButton, gridBagConstraints); 132 133 cancelButton.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.client.language", locale).getString("Cancel")); 134 cancelButton.addActionListener(new java.awt.event.ActionListener () 135 { 136 public void actionPerformed(java.awt.event.ActionEvent evt) 137 { 138 cancelButtonActionPerformed(evt); 139 } 140 }); 141 142 gridBagConstraints = new java.awt.GridBagConstraints (); 143 gridBagConstraints.gridx = 1; 144 gridBagConstraints.gridy = 0; 145 gridBagConstraints.insets = new java.awt.Insets (0, 100, 0, 10); 146 panel2.add(cancelButton, gridBagConstraints); 147 148 gridBagConstraints = new java.awt.GridBagConstraints (); 149 gridBagConstraints.gridx = 0; 150 gridBagConstraints.gridy = 1; 151 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 152 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 153 gridBagConstraints.insets = new java.awt.Insets (10, 0, 0, 0); 154 add(panel2, gridBagConstraints); 155 156 pack(); 157 } 159 private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) { setVisible(false); 163 dispose(); 164 } 166 private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) { muteBuzz = muteBuzzButton.getState(); 170 muteChime = muteChimeButton.getState(); 171 muteRinging = muteRingingButton.getState(); 172 muteLogNotification = muteLogNotificationButton.getState(); 173 setVisible(false); 174 dispose(); 175 } 177 178 private void closeDialog(java.awt.event.WindowEvent evt) { setVisible(false); 180 dispose(); 181 } 183 public static boolean getMuteBuzz() 184 { 185 return muteBuzz; 186 } 187 188 public static boolean getMuteChime() 189 { 190 return muteChime; 191 } 192 193 public static boolean getMuteRinging() 194 { 195 return muteRinging; 196 } 197 198 public static boolean getMuteLogNotification() 199 { 200 return muteLogNotification; 201 } 202 203 public static void reset() 204 { 205 muteBuzz = false; 206 muteChime = false; 207 muteRinging = false; 208 muteLogNotification = false; 209 } 210 211 214 public static void main(String args[]) 215 { 216 new AudioControlDialog(new java.awt.Frame (), Locale.getDefault()).show(); 217 } 218 219 220 private java.awt.Button closeButton; 222 private java.awt.Button cancelButton; 223 private java.awt.Panel panel2; 224 private java.awt.Panel panel1; 225 private java.awt.Checkbox muteLogNotificationButton; 226 private java.awt.Checkbox muteBuzzButton; 227 private java.awt.Checkbox muteChimeButton; 228 private java.awt.Checkbox muteRingingButton; 229 231 private static boolean muteBuzz = false; 232 private static boolean muteChime = false; 233 private static boolean muteRinging = false; 234 private static boolean muteLogNotification = false; 235 private Locale locale = null; 236 } 237 | Popular Tags |