C#中怎样输出矩阵数组?
在C#中怎样输出下面这样的矩阵数组,请各位大侠帮忙........123423453456...
在C#中怎样输出下面这样的矩阵数组,请各位大侠帮忙........
1 2 3 4
2 3 4 5
3 4 5 6 展开
1 2 3 4
2 3 4 5
3 4 5 6 展开
2个回答
2006-09-06
展开全部
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
public class GetUrlInfo extends JFrame
{
public GetUrlInfo()
{
Container cp=this.getContentPane();
cp.setLayout(new BorderLayout());
jp=new JPanel();
jl=new JLabel("输入网址",JLabel.LEFT);
jtf=new JTextField(20);
ta=new TextArea(null,10,10,TextArea.SCROLLBARS_BOTH);
jtf.setText("http://www.baidu.com");
jb=new JButton("获取网址信息");
jb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
});
jp.add(jl);
jp.add(jtf);
jp.add(jb);
cp.add(jp,"North");
cp.add(ta,"Center");
setTitle("获取网址信息");
setSize(500,400);
setLocation(300,300);
setVisible(true);
show();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[])
{
GetUrlInfo getUrlInfo=new GetUrlInfo();
System.out.println(Info.inputLine);
try
{
URL url=new URL(jtf.getText());
DataInputStream inputStr;
inputStr=new DataInputStream(url.openStream());
String inputLine;
while((inputLine=inputStr.readLine())!=null)
{
System.out.println(inputLine);//inputLine是输出内容.在dos下输出,我希望它在TextArea中输出..
}
inputStr.close();
}
catch(MalformedURLException e)
{
System.out.println("Error");
}
catch(IOException e)
{
System.out.println(e);
}
}
public static JTextField jtf;
private TextArea ta;
private JPanel jp;
private JButton jb;
private JLabel jl;
}
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
public class GetUrlInfo extends JFrame
{
public GetUrlInfo()
{
Container cp=this.getContentPane();
cp.setLayout(new BorderLayout());
jp=new JPanel();
jl=new JLabel("输入网址",JLabel.LEFT);
jtf=new JTextField(20);
ta=new TextArea(null,10,10,TextArea.SCROLLBARS_BOTH);
jtf.setText("http://www.baidu.com");
jb=new JButton("获取网址信息");
jb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
}
});
jp.add(jl);
jp.add(jtf);
jp.add(jb);
cp.add(jp,"North");
cp.add(ta,"Center");
setTitle("获取网址信息");
setSize(500,400);
setLocation(300,300);
setVisible(true);
show();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[])
{
GetUrlInfo getUrlInfo=new GetUrlInfo();
System.out.println(Info.inputLine);
try
{
URL url=new URL(jtf.getText());
DataInputStream inputStr;
inputStr=new DataInputStream(url.openStream());
String inputLine;
while((inputLine=inputStr.readLine())!=null)
{
System.out.println(inputLine);//inputLine是输出内容.在dos下输出,我希望它在TextArea中输出..
}
inputStr.close();
}
catch(MalformedURLException e)
{
System.out.println("Error");
}
catch(IOException e)
{
System.out.println(e);
}
}
public static JTextField jtf;
private TextArea ta;
private JPanel jp;
private JButton jb;
private JLabel jl;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询