3个回答
展开全部
已把程序文件打包上传了,并附上运算结果图。
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.awt.event.*;
class ShowDataInTheArrary extends JFrame{
String data;
JButton b1;
JLabel l1;
public ShowDataInTheArrary(String a){
data = a;
setTitle("Show Data in the array");
setLayout(new GridLayout(2,1));
b1 = new JButton("show");
l1 = new JLabel();
b1.addActionListener(new Monitor());
add(l1);
add(b1);
pack();
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
}
class Monitor implements ActionListener{
public void actionPerformed(ActionEvent e){
l1.setText(data);
}
}
public static void main(String[] args){
String arrayData ="";
for(int i =0; i<args.length;i++)
arrayData += args[i];
ShowDataInTheArrary b = new ShowDataInTheArrary(arrayData);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询