📄 frmsample.java
字号:
package OaaSaphira.CarrierUnit;
/* Include dependencies */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
The FrmClass is included in the package for testing purposes only.
*/
public class FrmSample extends JFrame {
/*******************************************************************************
* The LibOaa object is the Java Agent Library object which is used to interact
* with the OAA system.
*
* To create an agent, create a new instance of the OAA library, passing some
* communication protocol object to use as the transport layer:
*
* <pre>
* LibOaa myOaa = new LibOaa(new LibCom(new LibComTcpProtocol()));
* </pre>
*
* It takes a communication protocol object which specifies the transport layer
* for communication. The current transport protocol is TCP/IP.
*******************************************************************************/
private Carrier osc_;
public FrmSample() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch (Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
this.setTitle("Carrier Agent");
//this.getContentPane().setLayout(null);
this.setSize(new Dimension(200, 50));
// Connect Button
JButton btnConnect = new JButton("Test");
btnConnect.setBounds(new Rectangle(0, 20, 399, 40));
btnConnect.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
osc_.testSaphira();
}
});
this.getContentPane().add(btnConnect, null);
//instantiate the App
osc_ = new Carrier(null);
}
//Overriden so we can exit on System Close
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
//Main method
public static void main(String[] args)
{
new FrmSample().show();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -