View Javadoc

1   /**
2    * Copyright 2007 Sejal Patel
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.inigma.iniglet;
18  
19  import java.io.IOException;
20  import java.util.Properties;
21  
22  import org.eclipse.swt.events.PaintEvent;
23  import org.eclipse.swt.events.PaintListener;
24  import org.eclipse.swt.graphics.Color;
25  import org.eclipse.swt.graphics.Image;
26  import org.eclipse.swt.widgets.Display;
27  
28  class LogoImage implements PaintListener {
29      private Color white;
30      private Image image;
31  
32      public LogoImage() {
33          Display display = Display.getDefault();
34          white = new Color(display, 255, 255, 255);
35          image = new Image(display, getClass().getResourceAsStream("/images/inigma-logo.png"));
36      }
37  
38      public void paintControl(PaintEvent e) {
39          Properties config = new Properties();
40          try {
41              config.load(Splash.class.getResourceAsStream("/config.properties"));
42          } catch (IOException ignore) {
43          }
44          e.gc.drawImage(image, 0, 0);
45  
46          e.gc.setForeground(white);
47  
48          String version = config.getProperty("version", "");
49          e.gc.drawText(version, 15, 155, true);
50  
51  //        e.gc.setFont(new Font(e.display, "Sans", 24, SWT.BOLD));
52  //        e.gc.drawString("Iniglets", 10, 135, true);
53      }
54  }