📄 aboutdialog.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: AboutDialog.java
package com.sap.mw.jco.util;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.URL;
import java.util.Enumeration;
import java.util.Vector;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class AboutDialog
{
private static class Picture extends Component
{
private Image createImage(Component comp, long ldata[])
{
if(ldata == null)
return null;
byte data[] = new byte[ldata.length * 8];
for(int i = 0; i < data.length; i++)
data[i] = (byte)(int)(ldata[i / 8] >> (7 - i % 8) * 8 & 255L);
MediaTracker tracker = new MediaTracker(comp);
Image image = Toolkit.getDefaultToolkit().createImage(data);
tracker.addImage(image, 0);
try
{
tracker.waitForAll();
}
catch(InterruptedException e)
{
return null;
}
tracker.removeImage(image, 0);
return image;
}
public Dimension getMinimumSize()
{
return new Dimension(m_image.getWidth(null), m_image.getHeight(null));
}
public Dimension getPreferredSize()
{
return getMinimumSize();
}
public void paint(Graphics g)
{
g.setColor(getBackground());
g.fillRect(0, 0, getSize().width, getSize().height);
int x = 0;
int y = 0;
if(m_alignment == 1)
x = (getSize().width - m_image.getWidth(null)) / 2;
else
if(m_alignment == 2)
x = getSize().width - m_image.getWidth(null);
g.drawImage(m_image, x, y, this);
}
public static final byte LEFT = 0;
public static final byte CENTER = 1;
public static final byte RIGHT = 2;
Image m_image;
byte m_alignment;
public Picture(long data[], byte alignment)
{
m_image = createImage(this, data);
m_alignment = alignment;
setSize(m_image.getWidth(null), m_image.getHeight(null));
}
}
public static class Section
{
public void addEntry(String name, String value)
{
m_entries.addElement(new NamedValuePair(name, value));
}
public String getTitle()
{
return m_title == null ? "" : m_title;
}
public int getNumEntries()
{
return m_entries.size();
}
public String getEntryName(int index)
{
return ((NamedValuePair)m_entries.elementAt(index)).getName();
}
public String getEntryValue(int index)
{
return ((NamedValuePair)m_entries.elementAt(index)).getValue();
}
String m_title;
Vector m_entries;
public Section(String title)
{
m_entries = new Vector();
m_title = title;
}
}
protected static class NamedValuePair
{
public String getName()
{
return m_name;
}
public String getValue()
{
return m_value;
}
String m_name;
String m_value;
public NamedValuePair(String name, String value)
{
m_name = name == null ? "" : name;
m_value = value == null ? "" : value;
}
}
public AboutDialog(String product_name)
{
m_sections = new Vector();
m_product_name = "SAP Java Connector";
m_copyright = "Copyright (c) 2000-2005 SAP AG. All rights reserved.";
m_manifest = null;
m_product_name = product_name;
m_manifest = getManifest();
addSection(getJavaVersion());
}
public void addSection(Section section)
{
m_sections.addElement(section);
}
protected static String getFilePathToClass(Class cls)
{
String filepath = null;
try
{
String rsc = cls.getName().replace('.', '/') + ".class";
URL url = cls.getClassLoader().getResource(rsc);
String ptc = url == null ? null : url.getProtocol();
if("jar".equals(ptc) || "file".equals(ptc))
{
filepath = url.getFile();
filepath = filepath.substring(0, filepath.length() - rsc.length() - ("jar".equals(ptc) ? 2 : 1));
if(filepath.startsWith("jar:"))
filepath = filepath.substring(4);
if(filepath.startsWith("file:"))
filepath = filepath.substring(5);
filepath = (new File(filepath)).getCanonicalPath();
}
}
catch(Throwable ex) { }
return filepath;
}
protected Section getManifest()
{
Section section = new Section("Manifest");
try
{
String path = getOwnFilePath();
if(path == null)
return section;
ZipInputStream is = new ZipInputStream(new FileInputStream(path));
ZipEntry entry;
for(entry = null; (entry = is.getNextEntry()) != null;)
{
if(entry.getName().equalsIgnoreCase("META-INF/MANIFEST.MF"))
break;
is.closeEntry();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -