package com.company;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ItemEvent;
import java.awt.event.ActionEvent;
import java.awt.event.ItemListener;
import java.awt.event.ActionListener;
import javax.swing.JTable;
public class Main implements ActionListener{
public static void main(String[] args)
{
JFrame frame = new JFrame("Первое окно");
frame.setSize(600, 600);
JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JLabel label = new JLabel("Введите длину и высоту двухмерного массива");
JTextField textField = new JTextField(10);
JTextField textField2 = new JTextField(10);
Integer[][] first_array;
JButton button1 = new JButton("Создать двумерный массив");
button1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
first_array = new Integer[Integer.parseInt(textField.getText())][Integer.parseInt(textField2.getText())];
}
});
frame.add(panel);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e){ }
}
first_array = new Integer[Integer.parseInt(textField.getText())][Integer.parseInt(textField2.getText())];.
int rowSize = Integer.parseInt(textField.getText());
int columnSize = Integer.parseInt(textField2.getText());
if (rowSize>0 && columnSize>0) {
first_array = new Integer[rowSize][columnSize];
}