Ask Question Forum:
Model Library:2025-02-08 Updated:A.I. model is online for auto reply question page
C
O
M
P
U
T
E
R
2
8
Show
#
ASK
RECENT
←
- Underline
- Bold
- Italic
- Indent
- Step
- Bullet
- Quote
- Cut
- Copy
- Paste
- Table
- Spelling
- Find & Replace
- Undo
- Redo
- Link
- Attach
- Clear
- Code
Below area will not be traslated by Google,you can input code or other languages
Hint:If find spelling error, You need to correct it,1 by 1 or ignore it (code area won't be checked).
X-position of the mouse cursor
Y-position of the mouse cursor
Y-position of the mouse cursor
Testcursor
caretPos
Attachment:===
Asked by duncanb7
at 2024-07-07 07:06:33
Point:500 Replies:19 POST_ID:828562USER_ID:11059
Topic:
Java Programming Language;PHP Scripting Language;JavaScript
Dear Experts,
I would like to complier java exmple(about direct I/O test on window)
at comand line instead of using Eclipse that will help understand more Java through
the compliering process.
I downloaded three files from http://www.zealsoftstudio.com/ntport/ only need for
the example demonstration and save it in the same directory. But I cannot complier the Frame1.java because
its error is could NOt find the symbol of NTportJava , it seems import
NTPortjava.* is not working. And the step-3 report such error.
Step-1
The comand to create class file for NTportJava.java:
D:javajdk1.7.0_05injavac NTPortJava.java
Step-2
The comand to create jar file for NTportJava.class:
D:javajdk1.7.0_05injavac cf NTPortJava.jar NTPortJava.class
Step-3
The command is for Complie Frame1.java with package porttest consideration :
D:javajdk1.7.0_05injavac -d . -classpath NTportJava.jar Frame1.java
Just simple example, but simple command line comand takes a lot of time
If possible, could you donwload those three files to complier at your sides,
I think that will be easier for your guys
Please advse
Duncan
I would like to complier java exmple(about direct I/O test on window)
at comand line instead of using Eclipse that will help understand more Java through
the compliering process.
I downloaded three files from http://www.zealsoftstudio.com/ntport/ only need for
the example demonstration and save it in the same directory. But I cannot complier the Frame1.java because
its error is could NOt find the symbol of NTportJava , it seems import
NTPortjava.* is not working. And the step-3 report such error.
Step-1
The comand to create class file for NTportJava.java:
D:javajdk1.7.0_05injavac NTPortJava.java
Step-2
The comand to create jar file for NTportJava.class:
D:javajdk1.7.0_05injavac cf NTPortJava.jar NTPortJava.class
Step-3
The command is for Complie Frame1.java with package porttest consideration :
D:javajdk1.7.0_05injavac -d . -classpath NTportJava.jar Frame1.java
Just simple example, but simple command line comand takes a lot of time
If possible, could you donwload those three files to complier at your sides,
I think that will be easier for your guys
Please advse
Duncan
Attachment:NTPortJava.javaFrame1.javaPortTest.java
Author: duncanb7 replied at 2024-07-09 08:23:52
For my memo only
at D:......PortTEstsrc>java porttest.PorTest, app window will comes out
at D:......PortTEstsrc>java porttest.PorTest, app window will comes out
Expert: CEHJ replied at 2024-07-08 10:51:19
:)
Author: duncanb7 replied at 2024-07-08 04:46:07
Thanks for your reply and it is good practise for java tuturial before using
too friendly Java tool
too friendly Java tool
Accepted Solution
Expert: CEHJ replied at 2024-07-08 01:11:23
250 points GOOD
I've no idea what it's for and can't run it - i don't have Windows
Author: duncanb7 replied at 2024-07-07 14:48:00
I think the tools is for direct access I/O serial port, RIght not for Internat Network card
port access ?
Duncan
port access ?
Duncan
Author: duncanb7 replied at 2024-07-07 14:27:40
Did you run the PortTest window,
it need us to specifiy Address(hex) value,
If I want to read port 10000 and just type
2710 (Decimall 10000) and let Value is empty to read
Right ?
it need us to specifiy Address(hex) value,
If I want to read port 10000 and just type
2710 (Decimall 10000) and let Value is empty to read
Right ?
Author: duncanb7 replied at 2024-07-07 14:21:34
it run suddenly but the window of NTport need to register copy?
Could you use it for I/O port read and wirte?
Could you use it for I/O port read and wirte?
Expert: CEHJ replied at 2024-07-07 14:19:24
Which one is correct ?
All are correct. Use the command i originally gave you. That will put it in C:Windows probably
will tell you which
How about include the NTPortjava.dll at command line, javac, with -classpath, Is it okay?
No, use the javac i gave you , which is without typos. I'm off for the night now Author: duncanb7 replied at 2024-07-07 14:14:02
D:xampphtdocsdataC>java Props java.library.path
C:Windowssystem32;C:WindowsSunJavain;C:Windowssystem32;C:Windows;C:Wi
ndowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPo
werShellv1.0;C:Program FilesATI TechnologiesATI.ACECore-Static;c:Program
FilesMicrosoft SQL Server100ToolsBinn;c:Program FilesMicrosoft SQL Server
100DTSBinn;c:program filesmicrosoft visual studio 10.0vcin;c:Program
FilesMicrosoft SDKsWindowsv7.0Ain;c:program filesmicrosoft visual studio
10.0vcin;c:Program FilesMicrosoft SDKsWindowsv7.0AInclude;d:wkwsummary
e-hftradeexe;c:Program FilesMicrosoft SDKsWindowsv7.0ALib;d:javajdk1.
7.0_05in;;.
There is a lot of java ibrary path. Which one is correct ? How about include the NTPortjava.dll at command line, javac, with -classpath, Is it okay?
C:Windowssystem32;C:WindowsSunJavain;C:Windowssystem32;C:Windows;C:Wi
ndowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPo
werShellv1.0;C:Program FilesATI TechnologiesATI.ACECore-Static;c:Program
FilesMicrosoft SQL Server100ToolsBinn;c:Program FilesMicrosoft SQL Server
100DTSBinn;c:program filesmicrosoft visual studio 10.0vcin;c:Program
FilesMicrosoft SDKsWindowsv7.0Ain;c:program filesmicrosoft visual studio
10.0vcin;c:Program FilesMicrosoft SDKsWindowsv7.0AInclude;d:wkwsummary
e-hftradeexe;c:Program FilesMicrosoft SDKsWindowsv7.0ALib;d:javajdk1.
7.0_05in;;.
There is a lot of java ibrary path. Which one is correct ? How about include the NTPortjava.dll at command line, javac, with -classpath, Is it okay?
Expert: CEHJ replied at 2024-07-07 13:54:05
Your command is wrong,
Sorry - didn't notice the typo. Get rid of one of the java words
Really you should run that class with
or it will abbreviate the output.
(As i warned you) Open cmd.exe as Administrator and then do
No right to access
(As i warned you) Open cmd.exe as Administrator and then do
It might not work if it's a 32bit dll and you're running 64
Author: duncanb7 replied at 2024-07-07 13:36:20
copy NTPortJava.dll %WINDIR%
No right to access
And run your Props ,give me the result as follows
-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=D:Javajre7in
java.vm.version=23.1-b03
java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.script=
user.country=TW
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=
java.vm.specification.name=Java Virtual Machine Specification
user.dir=D:xampphtdocsdataC
java.runtime.version=1.7.0_05-b05
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=D:Javajre7libendorsed
os.arch=x86
java.io.tmpdir=C:UsersabcAppDataLocalTemp
line.separator=
java.vm.specification.vendor=Oracle Corporation
user.variant=
os.name=Windows 7
sun.jnu.encoding=MS950
java.library.path=C:Windowssystem32;C:WindowsSunJa...java.specification.name=Java Platform API Specification
java.class.version=51.0
sun.management.compiler=HotSpot Client Compiler
os.version=6.1
user.home=C:Usersabc
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=MS950
java.specification.version=1.7
user.name=abc
java.class.path=.
java.vm.specification.version=1.7
sun.arch.data.model=32
java.home=D:Javajre7
sun.java.command=Props
java.specification.vendor=Oracle Corporation
user.language=zh
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode, sharing
java.version=1.7.0_05
java.ext.dirs=D:Javajre7libext;C:WindowsSunJ...
sun.boot.class.path=D:Javajre7lib esources.jar;D:Jav...
java.vendor=Oracle Corporation
file.separator=
java.vendor.url.bug=http://bugreport.sun.com/bugreport/
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.desktop=windows
sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+m...
Where I should put the NTPortJava.dll in my directory ?
So when You use Elicipse, it create other syntax to be remember.I don't know why they will create such more package or directory for so called such as nonesense system manner or directory handling .Lanauge is similar to the C but the operation is more complicate to C . it intends wants users not to use java like Ie browser or windows.
No right to access
And run your Props ,give me the result as follows
-- listing properties --
java.runtime.name=Java(TM) SE Runtime Environment
sun.boot.library.path=D:Javajre7in
java.vm.version=23.1-b03
java.vm.vendor=Oracle Corporation
java.vendor.url=http://java.oracle.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.script=
user.country=TW
sun.java.launcher=SUN_STANDARD
sun.os.patch.level=
java.vm.specification.name=Java Virtual Machine Specification
user.dir=D:xampphtdocsdataC
java.runtime.version=1.7.0_05-b05
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=D:Javajre7libendorsed
os.arch=x86
java.io.tmpdir=C:UsersabcAppDataLocalTemp
line.separator=
java.vm.specification.vendor=Oracle Corporation
user.variant=
os.name=Windows 7
sun.jnu.encoding=MS950
java.library.path=C:Windowssystem32;C:WindowsSunJa...java.specification.name=Java Platform API Specification
java.class.version=51.0
sun.management.compiler=HotSpot Client Compiler
os.version=6.1
user.home=C:Usersabc
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=MS950
java.specification.version=1.7
user.name=abc
java.class.path=.
java.vm.specification.version=1.7
sun.arch.data.model=32
java.home=D:Javajre7
sun.java.command=Props
java.specification.vendor=Oracle Corporation
user.language=zh
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode, sharing
java.version=1.7.0_05
java.ext.dirs=D:Javajre7libext;C:WindowsSunJ...
sun.boot.class.path=D:Javajre7lib esources.jar;D:Jav...
java.vendor=Oracle Corporation
file.separator=
java.vendor.url.bug=http://bugreport.sun.com/bugreport/
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.desktop=windows
sun.cpu.isalist=pentium_pro+mmx pentium_pro pentium+m...
Where I should put the NTPortJava.dll in my directory ?
So when You use Elicipse, it create other syntax to be remember.I don't know why they will create such more package or directory for so called such as nonesense system manner or directory handling .Lanauge is similar to the C but the operation is more complicate to C . it intends wants users not to use java like Ie browser or windows.
Author: duncanb7 replied at 2024-07-07 13:26:11
java java porttest.PortTest
Your command is wrong, What is java java ?please advise, just three files spend
a lot time.
Your command is wrong, What is java java ?please advise, just three files spend
a lot time.
Expert: CEHJ replied at 2024-07-07 09:34:58
Find out what your java.library.path is with
http://technojeeves.com/joomla/index.php/free/54-javasystemproperties
and put the dll in one of those directories
http://technojeeves.com/joomla/index.php/free/54-javasystemproperties
and put the dll in one of those directories
will usually be safe if you have the rights
I've given you the correct commands for compiling and running above
Author: duncanb7 replied at 2024-07-07 08:33:28
I found the NTPortJava.Dll ?
But how to include it on java
is it ?
javac -d . -classpath NTPortJava.dll Frame1.java
But it is still not working, and report the same could find the symbol
Duncan
But how to include it on java
is it ?
javac -d . -classpath NTPortJava.dll Frame1.java
But it is still not working, and report the same could find the symbol
Duncan
Expert: CEHJ replied at 2024-07-07 08:00:01
That means I need jar file or .dll file, please advise?
Neither, but you certainly need the dll loaded by the app. Get it wherever you got the code from if you can Expert: CEHJ replied at 2024-07-07 07:57:38
Author: duncanb7 replied at 2024-07-07 07:57:13
Dear CEJI,
import NTPortJava.*;
That means I need jar file or .dll file, please advise ?
How to make dll if so
Duncan
import NTPortJava.*;
That means I need jar file or .dll file, please advise ?
How to make dll if so
Duncan
Author: duncanb7 replied at 2024-07-07 07:55:19
Dear CEJi,
it is not working, the NTPortJava could not be found
package porttest;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import NTPortJava.*;
/**
* <p>Title: PortTest Sample</p>
* <p>Description: This sample illustrates how to use NTPort Library to read or write PC I/O ports.</p>
* <p>Copyright: Copyright (c) 2004 Zeal SoftStudio</p>
* <p>Company: Zeal SoftStudio</p>
* @author Hai Li
* @version 1.0
*/
public class Frame1 extends JFrame {
JPanel contentPane;
JLabel jLabel1 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel2 = new JLabel();
JTextField jTextField2 = new JTextField();
JButton btnRead = new JButton();
JButton btnWrite = new JButton();
JPanel jPanel1 = new JPanel();
Border border1;
JRadioButton jRadioButton1 = new JRadioButton();
JRadioButton jRadioButton2 = new JRadioButton();
JRadioButton jRadioButton3 = new JRadioButton();
JLabel jLabel3 = new JLabel();
GridLayout gridLayout1 = new GridLayout();
ButtonGroup buttonGroup1 = new ButtonGroup();
DefaultListModel model = new DefaultListModel();
JScrollPane jScrollPane1 = new JScrollPane();
JList jList1 = new JList();
//Construct the frame
public Frame1() {
// After register NTPort Library,
// place your registration information here.
NTPortJava.LicenseInfo("Your Name", 0);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel) this.getContentPane();
border1 = BorderFactory.createBevelBorder(BevelBorder.LOWERED,Color.white,Color.white,new Color(115, 114, 105),new Color(165, 163, 151));
jLabel1.setText("Address(Hex):");
jLabel1.setBounds(new Rectangle(9, 13, 84, 17));
contentPane.setLayout(null);
this.setSize(new Dimension(400, 300));
this.setTitle("PortTest Sample");
jTextField1.setText("61");
jTextField1.setBounds(new Rectangle(82, 11, 49, 21));
jTextField1.addActionListener(new Frame1_jTextField1_actionAdapter(this));
jLabel2.setBounds(new Rectangle(147, 15, 84, 17));
jLabel2.setText("Value:");
jTextField2.setText("0");
jTextField2.setBounds(new Rectangle(190, 11, 49, 21));
btnRead.setBounds(new Rectangle(303, 12, 73, 25));
btnRead.setText("Input");
btnRead.addActionListener(new Frame1_btnRead_actionAdapter(this));
btnWrite.setText("Output");
btnWrite.addActionListener(new Frame1_btnWrite_actionAdapter(this));
btnWrite.setBounds(new Rectangle(303, 46, 73, 25));
jPanel1.setBorder(border1);
jPanel1.setBounds(new Rectangle(10, 194, 275, 32));
jPanel1.setLayout(gridLayout1);
jRadioButton1.setSelected(true);
jRadioButton1.setText("Byte");
jRadioButton1.addActionListener(new Frame1_jRadioButton1_actionAdapter(this));
jRadioButton2.setText("Word");
jRadioButton2.addActionListener(new Frame1_jRadioButton2_actionAdapter(this));
jRadioButton3.setText("DWord");
jLabel3.setText("Copyright (c) 1997-2004 Hai Li, Zeal SoftStudio.");
jLabel3.setBounds(new Rectangle(8, 232, 381, 23));
jScrollPane1.setBounds(new Rectangle(9, 38, 275, 148));
jList1.setMinimumSize(new Dimension(0, 0));
jList1.setModel(model);
jList1.setVisibleRowCount(8);
contentPane.add(jLabel1, null);
contentPane.add(jTextField1, null);
contentPane.add(jLabel2, null);
contentPane.add(jTextField2, null);
contentPane.add(btnRead, null);
contentPane.add(btnWrite, null);
jPanel1.add(jRadioButton1, null);
jPanel1.add(jRadioButton2, null);
jPanel1.add(jRadioButton3, null);
contentPane.add(jScrollPane1, null);
jScrollPane1.getViewport().add(jList1, null);
contentPane.add(jLabel3, null);
contentPane.add(jPanel1, null);
buttonGroup1.add(jRadioButton1);
buttonGroup1.add(jRadioButton2);
buttonGroup1.add(jRadioButton3);
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
void jTextField1_actionPerformed(ActionEvent e) {
}
void btnWrite_actionPerformed(ActionEvent e) {
int outNum;
short portAdd;
portAdd = Integer.valueOf(jTextField1.getText(), 16).shortValue();
outNum = Integer.valueOf(jTextField2.getText(), 16).intValue();
if(jRadioButton1.isSelected())
{
NTPortJava.Outport(portAdd, (short)outNum);
}
else if(jRadioButton2.isSelected())
{
NTPortJava.OutportW(portAdd, (short)outNum);
}
else
{
NTPortJava.OutportD(portAdd, (int)outNum);
}
model.addElement("Out 0x" + Integer.toHexString(portAdd)
+ ", 0x" + Integer.toHexString(outNum));
StringBuffer sError = new StringBuffer(255);
NTPortJava.GetLastState(sError);
model.addElement(sError.toString());
jList1.ensureIndexIsVisible(model.getSize());
}
void jRadioButton2_actionPerformed(ActionEvent e) {
}
void jRadioButton1_actionPerformed(ActionEvent e) {
}
void btnRead_actionPerformed(ActionEvent e) {
int inNum;
short portAdd;
portAdd = Integer.valueOf(jTextField1.getText(), 16).shortValue();
if(jRadioButton1.isSelected())
{
inNum = (int)NTPortJava.Inport(portAdd);
}
else if(jRadioButton2.isSelected())
{
inNum = (int)NTPortJava.InportW(portAdd);
}
else
{
inNum = NTPortJava.InportD(portAdd);
}
model.addElement("In 0x" + Integer.toHexString(portAdd)
+ ", 0x" + Integer.toHexString(inNum));
StringBuffer sError = new StringBuffer(255);
NTPortJava.GetLastState(sError);
model.addElement(sError.toString());
jList1.ensureIndexIsVisible(model.getSize() - 1);
}
}
class Frame1_jTextField1_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jTextField1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jTextField1_actionPerformed(e);
}
}
class Frame1_btnWrite_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_btnWrite_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnWrite_actionPerformed(e);
}
}
class Frame1_jRadioButton2_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jRadioButton2_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jRadioButton2_actionPerformed(e);
}
}
class Frame1_jRadioButton1_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jRadioButton1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jRadioButton1_actionPerformed(e);
}
}
class Frame1_btnRead_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_btnRead_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnRead_actionPerformed(e);
}
}
it is not working, the NTPortJava could not be found
package porttest;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import NTPortJava.*;
/**
* <p>Title: PortTest Sample</p>
* <p>Description: This sample illustrates how to use NTPort Library to read or write PC I/O ports.</p>
* <p>Copyright: Copyright (c) 2004 Zeal SoftStudio</p>
* <p>Company: Zeal SoftStudio</p>
* @author Hai Li
* @version 1.0
*/
public class Frame1 extends JFrame {
JPanel contentPane;
JLabel jLabel1 = new JLabel();
JTextField jTextField1 = new JTextField();
JLabel jLabel2 = new JLabel();
JTextField jTextField2 = new JTextField();
JButton btnRead = new JButton();
JButton btnWrite = new JButton();
JPanel jPanel1 = new JPanel();
Border border1;
JRadioButton jRadioButton1 = new JRadioButton();
JRadioButton jRadioButton2 = new JRadioButton();
JRadioButton jRadioButton3 = new JRadioButton();
JLabel jLabel3 = new JLabel();
GridLayout gridLayout1 = new GridLayout();
ButtonGroup buttonGroup1 = new ButtonGroup();
DefaultListModel model = new DefaultListModel();
JScrollPane jScrollPane1 = new JScrollPane();
JList jList1 = new JList();
//Construct the frame
public Frame1() {
// After register NTPort Library,
// place your registration information here.
NTPortJava.LicenseInfo("Your Name", 0);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel) this.getContentPane();
border1 = BorderFactory.createBevelBorder(BevelBorder.LOWERED,Color.white,Color.white,new Color(115, 114, 105),new Color(165, 163, 151));
jLabel1.setText("Address(Hex):");
jLabel1.setBounds(new Rectangle(9, 13, 84, 17));
contentPane.setLayout(null);
this.setSize(new Dimension(400, 300));
this.setTitle("PortTest Sample");
jTextField1.setText("61");
jTextField1.setBounds(new Rectangle(82, 11, 49, 21));
jTextField1.addActionListener(new Frame1_jTextField1_actionAdapter(this));
jLabel2.setBounds(new Rectangle(147, 15, 84, 17));
jLabel2.setText("Value:");
jTextField2.setText("0");
jTextField2.setBounds(new Rectangle(190, 11, 49, 21));
btnRead.setBounds(new Rectangle(303, 12, 73, 25));
btnRead.setText("Input");
btnRead.addActionListener(new Frame1_btnRead_actionAdapter(this));
btnWrite.setText("Output");
btnWrite.addActionListener(new Frame1_btnWrite_actionAdapter(this));
btnWrite.setBounds(new Rectangle(303, 46, 73, 25));
jPanel1.setBorder(border1);
jPanel1.setBounds(new Rectangle(10, 194, 275, 32));
jPanel1.setLayout(gridLayout1);
jRadioButton1.setSelected(true);
jRadioButton1.setText("Byte");
jRadioButton1.addActionListener(new Frame1_jRadioButton1_actionAdapter(this));
jRadioButton2.setText("Word");
jRadioButton2.addActionListener(new Frame1_jRadioButton2_actionAdapter(this));
jRadioButton3.setText("DWord");
jLabel3.setText("Copyright (c) 1997-2004 Hai Li, Zeal SoftStudio.");
jLabel3.setBounds(new Rectangle(8, 232, 381, 23));
jScrollPane1.setBounds(new Rectangle(9, 38, 275, 148));
jList1.setMinimumSize(new Dimension(0, 0));
jList1.setModel(model);
jList1.setVisibleRowCount(8);
contentPane.add(jLabel1, null);
contentPane.add(jTextField1, null);
contentPane.add(jLabel2, null);
contentPane.add(jTextField2, null);
contentPane.add(btnRead, null);
contentPane.add(btnWrite, null);
jPanel1.add(jRadioButton1, null);
jPanel1.add(jRadioButton2, null);
jPanel1.add(jRadioButton3, null);
contentPane.add(jScrollPane1, null);
jScrollPane1.getViewport().add(jList1, null);
contentPane.add(jLabel3, null);
contentPane.add(jPanel1, null);
buttonGroup1.add(jRadioButton1);
buttonGroup1.add(jRadioButton2);
buttonGroup1.add(jRadioButton3);
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
void jTextField1_actionPerformed(ActionEvent e) {
}
void btnWrite_actionPerformed(ActionEvent e) {
int outNum;
short portAdd;
portAdd = Integer.valueOf(jTextField1.getText(), 16).shortValue();
outNum = Integer.valueOf(jTextField2.getText(), 16).intValue();
if(jRadioButton1.isSelected())
{
NTPortJava.Outport(portAdd, (short)outNum);
}
else if(jRadioButton2.isSelected())
{
NTPortJava.OutportW(portAdd, (short)outNum);
}
else
{
NTPortJava.OutportD(portAdd, (int)outNum);
}
model.addElement("Out 0x" + Integer.toHexString(portAdd)
+ ", 0x" + Integer.toHexString(outNum));
StringBuffer sError = new StringBuffer(255);
NTPortJava.GetLastState(sError);
model.addElement(sError.toString());
jList1.ensureIndexIsVisible(model.getSize());
}
void jRadioButton2_actionPerformed(ActionEvent e) {
}
void jRadioButton1_actionPerformed(ActionEvent e) {
}
void btnRead_actionPerformed(ActionEvent e) {
int inNum;
short portAdd;
portAdd = Integer.valueOf(jTextField1.getText(), 16).shortValue();
if(jRadioButton1.isSelected())
{
inNum = (int)NTPortJava.Inport(portAdd);
}
else if(jRadioButton2.isSelected())
{
inNum = (int)NTPortJava.InportW(portAdd);
}
else
{
inNum = NTPortJava.InportD(portAdd);
}
model.addElement("In 0x" + Integer.toHexString(portAdd)
+ ", 0x" + Integer.toHexString(inNum));
StringBuffer sError = new StringBuffer(255);
NTPortJava.GetLastState(sError);
model.addElement(sError.toString());
jList1.ensureIndexIsVisible(model.getSize() - 1);
}
}
class Frame1_jTextField1_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jTextField1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jTextField1_actionPerformed(e);
}
}
class Frame1_btnWrite_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_btnWrite_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnWrite_actionPerformed(e);
}
}
class Frame1_jRadioButton2_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jRadioButton2_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jRadioButton2_actionPerformed(e);
}
}
class Frame1_jRadioButton1_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jRadioButton1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jRadioButton1_actionPerformed(e);
}
}
class Frame1_btnRead_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_btnRead_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.btnRead_actionPerformed(e);
}
}
Assisted Solution
Expert: CEHJ replied at 2024-07-07 07:36:58
250 points GOOD
is what you need (assuming all three files in same directory). Don't compile from a jdk directory though
Run
Run
You'll need NTPortJava.dll in java.library.path