私のプログラムのある時点で、プログラムの実行中に何が起こっているかについての情報を表示するJDialogが開きます。いくつかのラベルとプログレスバーがありますが、ダイアログウィンドウを開いても何も表示されません。
カスタムダイアログとそのコンストラクターは次のとおりです。
public class DataMiner implements ActionListener
{
private Hashtable<Integer, GISNode> nodeTable;
private Hashtable<Integer, GISLink> linkTable;
private int numLinesIgnored;
private int numLinesProcessed;
private int numNodes;
private int numLinks;
private int numDuplicates;
private int numFailedGeoCodingRequests;
private boolean cancelled;
// window objects
private JDialog window;
private JLabel LinesIgnored;
private JLabel LinesProcessed;
private JLabel Nodes;
private JLabel Links;
private JLabel Duplicates; // tracks the number of equivalent data entries found.
private JLabel FailedGeoCodingRequests;
private JProgressBar progressBar;
private JButton cancelButton;
public DataMiner(JFrame parentWindow)
{
nodeTable = new Hashtable<Integer, GISNode>(1000);
linkTable = new Hashtable<Integer, GISLink>(1000);
numLinesIgnored = 0;
numLinesProcessed = 0;
numNodes = 0;
numLinks = 0;
numDuplicates = 0;
numFailedGeoCodingRequests = 0;
cancelled = false;
LinesIgnored = new JLabel();
LinesProcessed = new JLabel();
Nodes = new JLabel();
Links = new JLabel();
Duplicates = new JLabel();
FailedGeoCodingRequests = new JLabel();
cancelButton = new JButton("Cancel");
progressBar = new JProgressBar();
updateLabels(); // assigns a formatted string to each JLabel
cancelButton.addActionListener(this);
// initialize window
window = new JDialog(parentWindow);
window.setResizable(false);
window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
Container content = window.getContentPane();
content.setLayout(new GridLayout(7,1));
content.add(LinesProcessed);
content.add(Nodes);
content.add(Links);
content.add(Duplicates);
content.add(LinesIgnored);
content.add(FailedGeoCodingRequests);
content.add(progressBar);
JPanel p1 = new JPanel();
p1.add(new JLabel("")); // takes up space
p1.add(cancelButton);
content.add(p1);
window.pack();
window.setLocationRelativeTo(parentWindow);
window.setVisible(true);
}
(rest of the class...)
}
このウィンドウが開くと、プログラムの残りの部分は通常どおり実行され続け、このウィンドウだけが空白になります。私は何かが足りないのですか?