public class LoadPanel extends JPanel {
private JTextField dictionaryTextField; // text field for dictionary
private JTextField documentTextField; // text field for document
private JButton loadButton; // the load button
private JLabel dictionaryLabel; // label for dictionary text field
private JLabel documentLabel; // label for document text field
/** Creates a new LoadPanel with empty text fields.
*/
public LoadPanel() {
dictionaryLabel = new JLabel("Dictionary:", JLabel.RIGHT);
add(dictionaryLabel);
dictionaryTextField = new JTextField("",12);
add(dictionaryTextField);
documentLabel = new JLabel("Document:", JLabel.RIGHT);
add(documentLabel);
documentTextField = new JTextField("",12);
add(documentTextField);
loadButton = new JButton("Load");
add(loadButton);
}
然后这个是另外一个文件:
public class SpellCheckerView extends JFrame {
private SpellChecker sc; // the spell checker
// the panel for loading dictionary and documents
private LoadPanel loadPanel;
// the panel for displaying results and user errors
private OutputPanel outputPanel;
// the panel for correcting errors in the document
private CorrectionPanel correctionPanel;
// the panel for saving a corrected document
private SavePanel savePanel;
public SpellCheckerView(SpellChecker sc) {
this.sc = sc;
setTitle("Spell Checker");
setBounds(250,50,700,700);
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container c = getContentPane();
addLoadPanel(c);
//addButtons(c);
}
public void addLoadPanel(LoadPanel lp){
}
我想在public void addLoadPanel(LoadPanel lp)里调用那些textfield什么的,
要怎么做呀?
求人帮忙~!!!!
感激!!!
private JTextField dictionaryTextField; // text field for dictionary
private JTextField documentTextField; // text field for document
private JButton loadButton; // the load button
private JLabel dictionaryLabel; // label for dictionary text field
private JLabel documentLabel; // label for document text field
/** Creates a new LoadPanel with empty text fields.
*/
public LoadPanel() {
dictionaryLabel = new JLabel("Dictionary:", JLabel.RIGHT);
add(dictionaryLabel);
dictionaryTextField = new JTextField("",12);
add(dictionaryTextField);
documentLabel = new JLabel("Document:", JLabel.RIGHT);
add(documentLabel);
documentTextField = new JTextField("",12);
add(documentTextField);
loadButton = new JButton("Load");
add(loadButton);
}
然后这个是另外一个文件:
public class SpellCheckerView extends JFrame {
private SpellChecker sc; // the spell checker
// the panel for loading dictionary and documents
private LoadPanel loadPanel;
// the panel for displaying results and user errors
private OutputPanel outputPanel;
// the panel for correcting errors in the document
private CorrectionPanel correctionPanel;
// the panel for saving a corrected document
private SavePanel savePanel;
public SpellCheckerView(SpellChecker sc) {
this.sc = sc;
setTitle("Spell Checker");
setBounds(250,50,700,700);
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container c = getContentPane();
addLoadPanel(c);
//addButtons(c);
}
public void addLoadPanel(LoadPanel lp){
}
我想在public void addLoadPanel(LoadPanel lp)里调用那些textfield什么的,
要怎么做呀?
求人帮忙~!!!!
感激!!!










