home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Button;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Frame;
- import java.awt.Insets;
- import java.awt.List;
- import java.awt.Rectangle;
- import java.awt.Window;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.WindowEvent;
- import java.awt.event.WindowListener;
- import java.util.Enumeration;
- import java.util.EventObject;
- import java.util.Properties;
- import powersoft.powerj.event.AWTEvent;
- import powersoft.powerj.ui.ResizePercentLayout;
-
- class Form_Application extends Frame implements WindowListener, ActionListener {
- boolean __mainForm;
- private List lb_systemProperties = new List();
- private Button cb_showSystemProperties = new Button();
- private Properties _systemProperties;
-
- public Rectangle DURectangle(int var1, int var2, int var3, int var4) {
- String var5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
- FontMetrics var6 = ((Component)this).getFontMetrics(((Component)this).getFont());
- double var7 = (double)(var6 != null ? var6.stringWidth(var5) / var5.length() : 0);
- double var9 = var6 != null ? (double)var6.getHeight() / (double)2.0F : (double)0.0F;
- return new Rectangle((int)Math.round(var7 * (double)var1 / (double)4.0F), (int)Math.round(var9 * (double)var2 / (double)4.0F), (int)Math.round(var7 * (double)var3 / (double)4.0F), (int)Math.round(var9 * (double)var4 / (double)4.0F));
- }
-
- public void DUPositionComponent(Component var1, int var2, int var3, int var4, int var5, Insets var6) {
- Rectangle var7 = this.DURectangle(var2, var3, var4, var5);
- if (var1 != this && var6 != null) {
- var7.x += var6.left;
- var7.y += var6.top;
- }
-
- if (var1 == this && var6 != null && var6.bottom > 0) {
- var7.height += var6.bottom;
- }
-
- var1.setBounds(var7);
- }
-
- public void setMainForm(boolean var1) {
- this.__mainForm = var1;
- }
-
- public boolean isMainForm() {
- return this.__mainForm;
- }
-
- public boolean create() throws Exception {
- ((Frame)this).setTitle("Application");
- ((Frame)this).setResizable(true);
- Container var1 = this.getContentPane();
- Font var2 = new Font("Dialog", 0, 12);
- ((Component)this).setFont(var2);
- boolean var3 = true;
- ((Frame)this).addNotify();
- Insets var4 = (Insets)var1.getInsets().clone();
- ((Component)var1).setBackground(Color.lightGray);
- ((Component)var1).setForeground(Color.black);
- ResizePercentLayout var5 = new ResizePercentLayout();
- var1.setLayout(var5);
- var1.add(this.lb_systemProperties);
- var1.add(this.cb_showSystemProperties);
- this.DUPositionComponent(this, 74, 13, 262, 240, var4);
- ((Window)this).addWindowListener(this);
- this.DUPositionComponent(this.lb_systemProperties, 5, 25, 246, 195, var4);
- this.lb_systemProperties.setFont(var2);
- this.lb_systemProperties.setBackground(Color.white);
- this.lb_systemProperties.setForeground(Color.black);
- this.lb_systemProperties.setEnabled(true);
- this.lb_systemProperties.setVisible(true);
- this.cb_showSystemProperties.addActionListener(this);
- this.DUPositionComponent(this.cb_showSystemProperties, 5, 5, 110, 15, var4);
- this.cb_showSystemProperties.setFont(var2);
- this.cb_showSystemProperties.setBackground(Color.lightGray);
- this.cb_showSystemProperties.setForeground(Color.black);
- this.cb_showSystemProperties.setEnabled(true);
- this.cb_showSystemProperties.setVisible(true);
- this.cb_showSystemProperties.setLabel("Show System Properties");
- var5.setResizePercent(this.lb_systemProperties, new Rectangle(0, 0, 100, 100));
- var5.setResizePercent(this.cb_showSystemProperties, new Rectangle(0, 0, 0, 0));
- ((Component)this).setVisible(true);
- return var3;
- }
-
- public synchronized boolean destroy() {
- if (this instanceof Window) {
- ((Window)this).dispose();
- } else {
- ((Container)this).removeNotify();
- }
-
- if (this.isMainForm()) {
- System.gc();
- System.runFinalization();
- System.exit(0);
- }
-
- return true;
- }
-
- public boolean defaultHandleEvent(Event var1) {
- this.defaultProcessEvent(new AWTEvent(var1));
- return false;
- }
-
- public void defaultProcessEvent(java.awt.AWTEvent var1) {
- super.processEvent(var1);
- }
-
- public void windowClosed(WindowEvent var1) {
- }
-
- public void windowOpened(WindowEvent var1) {
- }
-
- public void windowClosing(WindowEvent var1) {
- Object var2 = ((EventObject)var1).getSource();
- if (var2 == this) {
- this.Form_Application_windowClosing(var1);
- } else {
- this.unhandledEvent("java.awt.event.WindowListener", "windowClosing", var1);
- }
-
- }
-
- public void windowIconified(WindowEvent var1) {
- }
-
- public void windowActivated(WindowEvent var1) {
- }
-
- public void windowDeiconified(WindowEvent var1) {
- }
-
- public void windowDeactivated(WindowEvent var1) {
- }
-
- public void actionPerformed(ActionEvent var1) {
- Object var2 = ((EventObject)var1).getSource();
- if (var2 == this.cb_showSystemProperties) {
- this.cb_showSystemProperties_actionPerformed(var1);
- } else {
- this.unhandledEvent("java.awt.event.ActionListener", "actionPerformed", var1);
- }
-
- }
-
- public Form_Application() {
- }
-
- public boolean handleEvent(Event var1) {
- return this.defaultHandleEvent(var1);
- }
-
- public void unhandledEvent(String var1, String var2, Object var3) {
- }
-
- public void processEvent(java.awt.AWTEvent var1) {
- this.defaultProcessEvent(var1);
- }
-
- public Container getContentPane() {
- return this;
- }
-
- public boolean Form_Application_windowClosing(WindowEvent var1) {
- ((Component)this).hide();
- this.destroy();
- return false;
- }
-
- public boolean cb_showSystemProperties_actionPerformed(ActionEvent var1) {
- this._systemProperties = System.getProperties();
- Enumeration var2 = this._systemProperties.propertyNames();
-
- while(var2.hasMoreElements()) {
- String var3 = new String((String)var2.nextElement());
- String var4 = new String(this._systemProperties.getProperty(var3));
- this.lb_systemProperties.addItem("[ " + var3 + " ] " + var4);
- }
-
- return false;
- }
- }
-