在对话框中打印矩阵
我在对话框上打印矩阵数组时遇到一些困难。 矩阵是整数,据我了解,我需要将其更改为字符串?
无论如何,这是代码:
public void print_Matrix(int row, int column)
{
for (int i = 0; i <= row; i++)
{
for (int j = 0; j <= column; j++)
{
JOptionPane.showMessageDialog(null, matrix_Of_Life);
}
}
我需要做什么才能将数组打印到对话框中?
谢谢。
I'm having a little difficulty to print a matrix array on dialog box.
The matrix is integer and as far as i understood i need to change it into string?
anyway, here's the code:
public void print_Matrix(int row, int column)
{
for (int i = 0; i <= row; i++)
{
for (int j = 0; j <= column; j++)
{
JOptionPane.showMessageDialog(null, matrix_Of_Life);
}
}
what I need to do in order to print array into dialog box?
thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于小型 2D 数组,这样的操作很方便:
This prints:
This concees control and speed forClarity and constrains.如果您的矩阵更大和/或您想要完全控制每个元素的打印方式(例如右对齐),您可能需要做其他事情。
For small 2D arrays, something like this is convenient:
This prints:
This concedes control and speed for clarity and conciseness. If your matrix is larger and/or you want complete control on how each element is printed (e.g. right alignment), you'd probably have to do something else.