要用Java编写一个网管软件,其中有一个功能就是在软件中能telnet到各个网络单元(如交换机或者路由器)中执行命令行方式的操作,请问Java中有没有哪个控件能同时用于输入命令与输出结果,并且所有的输出和输入都将被追加显示在该控件上,但是只有最后一行是可以编辑的,用于输入新的命令。
我现在是使用JTestArea,虽然可以实现内容的输入和输出,但是那些历史内容都是可以编辑的,这是我不想要的,我只希望最后一行也就是命令输入的那行是可以编辑的。也就是如下情况:
----------------------------------------------------------------------------------------
1 reload Halt and perform a cold restart
2 restart Restart Connection
3 resume Resume an active network connection
4 rlogin Open an rlogin connection
5 rsh Execute a remote command
6 sdlc Send SDLC test frames
7 send Send a message to other tty lines
8 setup Run the SETUP command facility
9 show Show running system information
10 slip Start a Serial-line IP (SLIP)
11 start-chat Start a chat-script on a line
12 systat Display information about terminal lines
13 telnet Open a telnet connection
14 terminal Set terminal line parameters
15 traceroute Trace route to destination
16 tunnel Open a tunnel connection
17 udptn Open an updtn connection
18 undebug Disable debugging functions (see also 'debug')
19 verify Verify a file
20 WORD
21 write Write running configuration to memory, network, or terminal
22 x28 Become an X.28 PAD
23 x3 Set X.3 parameters on PAD
24
25 Router#conf t
----------------------------------------------------------------------------------------
这里已经输出的内容从1—24行及25行的“Router#”是不可以被编辑的,之后的部分可以编辑用于让用户输入命令,比如我输入“conf t”命令。
我现在是使用JTestArea,虽然可以实现内容的输入和输出,但是那些历史内容都是可以编辑的,这是我不想要的,我只希望最后一行也就是命令输入的那行是可以编辑的。也就是如下情况:
----------------------------------------------------------------------------------------
1 reload Halt and perform a cold restart
2 restart Restart Connection
3 resume Resume an active network connection
4 rlogin Open an rlogin connection
5 rsh Execute a remote command
6 sdlc Send SDLC test frames
7 send Send a message to other tty lines
8 setup Run the SETUP command facility
9 show Show running system information
10 slip Start a Serial-line IP (SLIP)
11 start-chat Start a chat-script on a line
12 systat Display information about terminal lines
13 telnet Open a telnet connection
14 terminal Set terminal line parameters
15 traceroute Trace route to destination
16 tunnel Open a tunnel connection
17 udptn Open an updtn connection
18 undebug Disable debugging functions (see also 'debug')
19 verify Verify a file
20 WORD
21 write Write running configuration to memory, network, or terminal
22 x28 Become an X.28 PAD
23 x3 Set X.3 parameters on PAD
24
25 Router#conf t
----------------------------------------------------------------------------------------
这里已经输出的内容从1—24行及25行的“Router#”是不可以被编辑的,之后的部分可以编辑用于让用户输入命令,比如我输入“conf t”命令。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货