我想避免执行其余的代码,直到用户响应 jtable(等到他取消它以显示 JOptionPane
import java.awt.*;
import javax.swing.*;
public class test {
public static void main(String args[]) {
String[][] rows = { { "Sameendra", "MCA","sam", "Old" }, { "vinod", "M.ED","sam", "Old" }, { "Suman", "BIT","sam", "Old" }, { "Amit", "Msc","sam", "Old" }, {"Deepak", "BIT","sam", "Old"}, { "Ravi", "MCA","sam", "Old" },// { "Sameendra", "MCA","sam", "Old" }, { "vinod", "M.ED","sam", "Old" }, };
};
String headers[] = { "Upper", "Lower", "New", "Old" };
JTable table = new JTable(rows, headers);
table.setEnabled(true);
JScrollPane scrollPane = new JScrollPane(table);
JFrame frame = new JFrame("New Table");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(scrollPane, BorderLayout.CENTER);
frame.setLocationRelativeTo(frame);
frame.setLocation(500,325);
frame.setSize(300, 168);
frame.setVisible(true);
frame.setFocusable(true);
JOptionPane.showMessageDialog(null, "Goback?", "return",
JOptionPane.INFORMATION_MESSAGE);
我是一名优秀的程序员,十分优秀!