home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / TRIAL / JBUILDER / JSAMPLES.Z / DataServerFrame.java < prev    next >
Encoding:
Java Source  |  1998-05-08  |  4.0 KB  |  102 lines

  1. /*
  2.  * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
  3.  * 
  4.  * This SOURCE CODE FILE, which has been provided by Borland as part
  5.  * of a Borland product for use ONLY by licensed users of the product,
  6.  * includes CONFIDENTIAL and PROPRIETARY information of Borland.  
  7.  *
  8.  * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 
  9.  * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
  10.  * THE PRODUCT.
  11.  *
  12.  * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
  13.  * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
  14.  * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
  15.  * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
  16.  * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
  17.  * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
  18.  * CODE FILE.
  19.  */
  20.  
  21. //Title:        JBuilder Tutorial
  22. //Version:      2.0
  23. //Copyright:    Copyright (c) 1998
  24. //Author:       Jens Ole Lauridsen
  25. //Company:      Borland Int'l
  26. //Description:  Tutorial of Distributed Computing using RMI and DataSetData.
  27.  
  28. package borland.samples.tutorial.dataset.datasetdata;
  29.  
  30. import java.awt.*;
  31. import java.awt.event.*;
  32. import borland.jbcl.layout.*;
  33. import borland.jbcl.control.*;
  34. import java.util.*;
  35.  
  36. // The DataServerFrame is the frame displayed by DataServerApp.
  37. // This file contains nothing relevant to the topic of this tutorial.
  38. //
  39. public class DataServerFrame extends DecoratedFrame {
  40.   ResourceBundle res = Res.getBundle("borland.samples.tutorial.dataset.datasetdata.Res");
  41.   borland.jbcl.control.ButtonControl buttonControl1 = new borland.jbcl.control.ButtonControl();
  42.   borland.jbcl.control.TextControl textControl1 = new borland.jbcl.control.TextControl();
  43.   borland.jbcl.control.TextControl textControl3 = new borland.jbcl.control.TextControl();
  44.   java.awt.GridBagLayout gridBagLayout1 = new java.awt.GridBagLayout();
  45.   
  46.   public DataServerFrame(DataServerApp app) {
  47.     this.app = app;
  48.     try {
  49.       jbInit();
  50.     }
  51.     catch (Exception e) {
  52.       e.printStackTrace();
  53.     }
  54.   }
  55.   private void jbInit() throws Exception{
  56.     this.setResizable(false);
  57.     this.setSize(new Dimension(408, 313));
  58.     this.setTitle(res.getString("RS_ServerTitle"));
  59.     this.addWindowListener(new java.awt.event.WindowAdapter() {
  60.       public void windowClosing(WindowEvent e) {
  61.         this_windowClosing(e);
  62.       }
  63.     });
  64.     buttonControl1.setLabel(res.getString("RS_CloseServer"));
  65.     buttonControl1.addActionListener(new java.awt.event.ActionListener() {
  66.       public void actionPerformed(ActionEvent e) {
  67.         buttonControl1_actionPerformed(e);
  68.       }
  69.     });
  70.     textControl1.setText(res.getString("RS_Requests"));
  71.     textControl3.setAlignment(borland.jbcl.util.Alignment.CENTER | borland.jbcl.util.Alignment.MIDDLE);
  72.     textControl3.setText("0");
  73.     this.setLayout(gridBagLayout1);
  74.     this.add(buttonControl1, new GridBagConstraints2(1, 3, 3, 1, 0.0, 0.0
  75.             ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(20, 20, 20, 20), 0, 0));
  76.     this.add(textControl1, new GridBagConstraints2(1, 1, 3, 1, 1.0, 1.0
  77.             ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(20, 20, 0, 20), 0, 0));
  78.     this.add(textControl3, new GridBagConstraints2(1, 2, 3, 1, 1.0, 1.0
  79.             ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 20, 0, 20), 0, 0));
  80.     this.add(textControl2, new GridBagConstraints2(1, 0, 3, 1, 1.0, 1.0
  81.             ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(20, 20, 5, 20), 0, 0));
  82.   }
  83.   
  84.   void incrementUsage() {
  85.     textControl3.setText(Integer.toString(++usage));
  86.   }
  87.   
  88.   void buttonControl1_actionPerformed(ActionEvent e) {
  89.     app.closing();
  90.     System.exit(1);
  91.   }
  92.  
  93.   void this_windowClosing(WindowEvent e) {
  94.     app.closing();
  95.   }
  96.   
  97.   private DataServerApp app;
  98.   private int usage = 0;
  99.   borland.jbcl.control.TextControl textControl2 = new borland.jbcl.control.TextControl();
  100. }
  101.  
  102.