optionsdlg.java
来自「此文件为OPC Client IsVJTrend源代码,在VJ++开发环境下调试」· Java 代码 · 共 176 行
JAVA
176 行
/////////////////////////////////////////////////////////////////////////////
//
// OPC Trend VJ Client: OptionsDlg.java
// (Source File)
//
/////////////////////////////////////////////////////////////////////////////
//
// Author: Raphael Imhof
// Initial Date: 11/04/98
// $Workfile: OptionsDlg.java $
// $Revision: 1 $
// $Date: 7/27/99 5:09p $
// Target System: Microsoft Windows NT 4.0
// Environment: Visual J++ 6.0 / OPC DataAccess 2.0
// Remarks:
//
/////////////////////////////////////////////////////////////////////////////
//
// Description: implementation of the options dialog class.
//
//
/////////////////////////////////////////////////////////////////////////////
//
// History of Changes (Please remove very old comments and blank lines!)
// $Log: /IDK/OPCServer/clients/VJ++/ISVjTrend/OptionsDlg.java $
//
// 1 7/27/99 5:09p Imhof
//
// 1 7/27/99 4:39p Imhof
//
// 1 7/27/99 4:33p Imhof
//
// 4 1/20/99 3:17p Imhof
// Updated header
//
//
// $Nokeywords:$ (To avoid useless search while checking in.)
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 1999, Siemens Building Technologies, Inc. Landis Division
//
// SIEMENS BUILDING TECHNOLOGIES, INC. IS PROVIDING THE FOLLOWING EXAMPLES
// OF CODE AS SAMPLE ONLY.
// SIEMENS BUILDING TECHNOLOGIES, INC. MAKES NO REPRESENTATIONS OR WARRANTIES
// OF ANY KIND WITH RESPECT TO THE VALIDTY OF THE CODES OR DESIRED RESULTS
// AND DISCLAIMS ALL SUCH REPRESENTATIONS AND WARRANTIES, INCLUDING FOR EXAMPLE,
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// SIEMENS BUILIDNG TECHNOLOGIES, INC. DOES NOT REPRESENT OR WARRANT THAT
// THE FOLLOWING CODE SAMPLES ARE ACCURATE, VALID, COMPLETE OR CURRENT.
//
/////////////////////////////////////////////////////////////////////////////
import com.ms.wfc.app.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
import com.ms.wfc.html.*;
/**
* This class can take a variable number of parameters on the command
* line. Program execution begins with the main() method. The class
* constructor is not invoked unless an object of type 'OptionsDlg'
* created in the main() method.
*/
public class OptionsDlg extends Form
{
private Integer m_iSamples = new Integer(20);
public OptionsDlg()
{
super();
// Required for Visual J++ Form Designer support
initForm();
// TODO: Add any constructor code after initForm call
}
/**
* OptionsDlg overrides dispose so it can clean up the
* component list.
*/
public void dispose()
{
super.dispose();
components.dispose();
}
private void ok_click(Object source, Event e)
{
//TODO: add check: iSamples must be >= 10
m_iSamples = Integer.valueOf(Samples.getText());
if(m_iSamples.intValue() < 10)
{
MessageBox.show ("Samples must be >= 10.");
//TODO: how to cancel the OK ?
}
}
/**
* NOTE: The following code is required by the Visual J++ form
* designer. It can be modified using the form editor. Do not
* modify it using the code editor.
*/
Container components = new Container();
Edit Samples = new Edit();
Label label1 = new Label();
Button ok = new Button();
Button cancel = new Button();
private void initForm()
{
Samples.setLocation(new Point(80, 16));
Samples.setSize(new Point(72, 23));
Samples.setTabIndex(0);
Samples.setText("10");
label1.setLocation(new Point(8, 16));
label1.setSize(new Point(64, 16));
label1.setTabIndex(1);
label1.setTabStop(false);
label1.setText("Samples:");
ok.setLocation(new Point(168, 16));
ok.setSize(new Point(80, 24));
ok.setTabIndex(3);
ok.setText("&OK");
ok.setDialogResult(DialogResult.OK);
ok.addOnClick(new EventHandler(this.ok_click));
cancel.setLocation(new Point(168, 48));
cancel.setSize(new Point(80, 24));
cancel.setTabIndex(2);
cancel.setText("Cancel");
cancel.setDialogResult(DialogResult.CANCEL);
this.setText("Options");
this.setAcceptButton(ok);
this.setAutoScaleBaseSize(new Point(7, 16));
this.setCancelButton(cancel);
this.setClientSize(new Point(257, 82));
this.setShowInTaskbar(false);
this.setNewControls(new Control[] {
cancel,
ok,
label1,
Samples});
}
/**
* The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void main(String args[])
{
Application.run(new OptionsDlg());
}
public void SetSamples(int iSamples)
{
m_iSamples = new Integer(iSamples);
Samples.setText(String.valueOf(m_iSamples));
}
public int GetSamples()
{
m_iSamples = Integer.valueOf(Samples.getText());
return m_iSamples.intValue();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?