| 1 6 7 package com.quikj.application.web.talk.client; 8 9 import java.applet.*; 10 import java.awt.*; 11 import java.awt.event.*; 12 import java.util.*; 13 import java.net.*; 14 import java.io.*; 15 import com.quikj.client.beans.*; 16 17 21 public class AboutAceOperatorFrame extends java.awt.Frame  22 { 23 24 25 public AboutAceOperatorFrame(Frame parent, Locale locale, Applet applet) 26 { 27 this.locale = locale; 28 this.applet = applet; 29 initComponents(); 30 31 InputStream istream = AboutAceOperatorFrame.class.getResourceAsStream("quik.jpg"); 32 if (istream != null) 33 { 34 ByteArrayOutputStream bos = new ByteArrayOutputStream(); 35 36 byte[] buffer = new byte[1000]; 37 38 try 39 { 40 while (true) 41 { 42 int count = istream.read(buffer); 43 if (count == -1) { 45 break; 46 } 47 48 bos.write(buffer, 0, count); 49 } 50 51 image = Toolkit.getDefaultToolkit().createImage(bos.toByteArray()); 52 ImageButton i_button = new ImageButton(); 53 i_button.setImage(image); 54 55 i_button.addActionListener(new AboutAceOperatorFrame.ButtonClickedActionListener()); 56 imagePane.add(i_button); 57 i_button.invalidate(); 58 59 } 60 catch (IOException ex) 61 { 62 imagePane.setBackground(Color.white); 63 } 64 } 65 else 66 { 67 imagePane.setBackground(Color.white); 68 } 69 70 88 if (parent == null) 90 { 91 Dimension pbounds = Toolkit.getDefaultToolkit().getScreenSize(); 92 Point mid = new Point(pbounds.width/2, pbounds.height/2); 93 Rectangle bounds = getBounds(); 94 int x = mid.x - (bounds.width/2); 95 int y = mid.y - (bounds.height/2); 96 if (x < 0) x = 0; 97 if (y < 0) y = 0; 98 setBounds(x, y, bounds.width, bounds.height); 99 } 100 else 101 { 102 Rectangle pbounds = parent.getBounds(); 103 Point mid = new Point(pbounds.x + (pbounds.width/2), pbounds.y + (pbounds.height/2)); 104 Rectangle bounds = getBounds(); 105 int x = mid.x - (bounds.width/2); 106 int y = mid.y - (bounds.height/2); 107 if (x < 0) x = pbounds.x; 108 if (y < 0) y = pbounds.y; 109 setBounds(x, y, bounds.width, bounds.height); 110 } 111 112 show(); 113 114 } 115 116 121 private void initComponents() { 123 java.awt.GridBagConstraints gridBagConstraints; 124 125 panel2 = new java.awt.Panel (); 126 imagePane = new ScrollPane(ScrollPane.SCROLLBARS_NEVER); 127 imagePane.setSize(175, 100); 128 label1 = new java.awt.Label (); 129 panel1 = new java.awt.Panel (); 130 button1 = new java.awt.Button (); 131 132 setLayout(new java.awt.GridBagLayout ()); 133 134 setBackground(java.awt.Color.white); 135 setTitle(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.client.language", locale).getString("Powered_by")); 136 addWindowListener(new java.awt.event.WindowAdapter () 137 { 138 public void windowClosing(java.awt.event.WindowEvent evt) 139 { 140 exitForm(evt); 141 } 142 }); 143 144 panel2.setLayout(new java.awt.GridBagLayout ()); 145 146 gridBagConstraints = new java.awt.GridBagConstraints (); 147 gridBagConstraints.gridx = 0; 148 gridBagConstraints.gridy = 0; 149 panel2.add(imagePane, gridBagConstraints); 150 151 label1.setFont(new java.awt.Font ("Dialog", 1, 12)); 152 label1.setText(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.client.language", locale).getString("Ace_Operator_is_powered_by_QUIK_Computing_http_www_quik-j_com")); 153 gridBagConstraints = new java.awt.GridBagConstraints (); 154 gridBagConstraints.gridx = 1; 155 gridBagConstraints.gridy = 0; 156 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 157 gridBagConstraints.weightx = 100.0; 158 gridBagConstraints.insets = new java.awt.Insets (0, 5, 0, 0); 159 panel2.add(label1, gridBagConstraints); 160 161 gridBagConstraints = new java.awt.GridBagConstraints (); 162 gridBagConstraints.gridx = 0; 163 gridBagConstraints.gridy = 0; 164 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 165 gridBagConstraints.weightx = 100.0; 166 gridBagConstraints.weighty = 100.0; 167 gridBagConstraints.insets = new java.awt.Insets (10, 10, 10, 10); 168 add(panel2, gridBagConstraints); 169 170 panel1.setLayout(new java.awt.GridBagLayout ()); 171 172 button1.setLabel(java.util.ResourceBundle.getBundle("com.quikj.application.web.talk.client.language", locale).getString("_Close_")); 173 button1.addActionListener(new java.awt.event.ActionListener () 174 { 175 public void actionPerformed(java.awt.event.ActionEvent evt) 176 { 177 button1ActionPerformed(evt); 178 } 179 }); 180 181 gridBagConstraints = new java.awt.GridBagConstraints (); 182 gridBagConstraints.gridx = 0; 183 gridBagConstraints.gridy = 0; 184 panel1.add(button1, gridBagConstraints); 185 186 gridBagConstraints = new java.awt.GridBagConstraints (); 187 gridBagConstraints.gridx = 0; 188 gridBagConstraints.gridy = 1; 189 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 190 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 191 gridBagConstraints.weightx = 100.0; 192 gridBagConstraints.insets = new java.awt.Insets (0, 10, 10, 10); 193 add(panel1, gridBagConstraints); 194 195 pack(); 196 } 198 private void button1ActionPerformed(java.awt.event.ActionEvent evt) { dispose(); 202 } 204 205 private void exitForm(java.awt.event.WindowEvent evt) 206 { dispose(); 208 } 210 213 public static void main(String args[]) 214 { 215 new AboutAceOperatorFrame(null, Locale.getDefault(), null).show(); 216 } 217 218 class ButtonClickedActionListener implements ActionListener 219 { 220 public void actionPerformed(java.awt.event.ActionEvent actionEvent) 221 { 222 handleButtonClick(); 223 } 224 } 225 226 private void handleButtonClick() 227 { 228 if (applet != null) 229 { 230 try 231 { 232 applet.getAppletContext().showDocument(new URL("http://www.quik-computing.com"), 233 "_blank"); 234 } 235 catch (MalformedURLException ex) 236 { 237 ; 238 } 239 } 240 } 241 242 243 private java.awt.Label label1; 245 private java.awt.ScrollPane imagePane; 246 private java.awt.Panel panel2; 247 private java.awt.Panel panel1; 248 private java.awt.Button button1; 249 251 private Locale locale; 252 private Image image; 253 private Applet applet = null; 254 } 255 | Popular Tags |