Sheldonj21
04-07-2002, 01:49 AM
ok I need help this is what I am having a problem with the action listener is not being seen and I do not know why...this is only the end of my GUI
super("File Search : fgrep");
setLocation(200,200);
setSize (500,300);
Container c = getContentPane();
c.setBackground (Color.white);
c.setForeground (Color.black);
pnlLabel.add(lblFileName);
pnlLabel.add(txtFileName);
pnlLabel.add(lblString);
pnlLabel.add(txtString);
c.add(pnlLabel,BorderLayout.NORTH);
scroll.add(txtYourTextArea);
c.add (scroll, BorderLayout.CENTER);
**Suspected problem is thougt to be between here**
pnlButtons.add(btnSearch);
pnlButtons.add(btnCountLines);
pnlButtons.add(btnPrintLineNumbers);
c.add(pnlButtons,BorderLayout.SOUTH);
btnSearch.addActionListener(this);
btnCountLines.addActionListener(this);
btnPrintLineNumbers.addActionListener(this);
setVisible(true);
}
*********************AND HERE**********************
public void actionPerformed(ActionEvent event) {
if (event.getSource() == btnSearch) {
System.out.println("hello");
//txtYourTextArea.setText(this.grep.Sea());
}
if (event.getSource() == btnCountLines) {
txtYourTextArea.setText(this.grep.Cou());
}
if (event.getSource() == btnPrintLineNumbers) {
txtYourTextArea.setText(this.grep.Pri());
}
}
public static void main(String args[]) {
new GrepGUI(); }
}
super("File Search : fgrep");
setLocation(200,200);
setSize (500,300);
Container c = getContentPane();
c.setBackground (Color.white);
c.setForeground (Color.black);
pnlLabel.add(lblFileName);
pnlLabel.add(txtFileName);
pnlLabel.add(lblString);
pnlLabel.add(txtString);
c.add(pnlLabel,BorderLayout.NORTH);
scroll.add(txtYourTextArea);
c.add (scroll, BorderLayout.CENTER);
**Suspected problem is thougt to be between here**
pnlButtons.add(btnSearch);
pnlButtons.add(btnCountLines);
pnlButtons.add(btnPrintLineNumbers);
c.add(pnlButtons,BorderLayout.SOUTH);
btnSearch.addActionListener(this);
btnCountLines.addActionListener(this);
btnPrintLineNumbers.addActionListener(this);
setVisible(true);
}
*********************AND HERE**********************
public void actionPerformed(ActionEvent event) {
if (event.getSource() == btnSearch) {
System.out.println("hello");
//txtYourTextArea.setText(this.grep.Sea());
}
if (event.getSource() == btnCountLines) {
txtYourTextArea.setText(this.grep.Cou());
}
if (event.getSource() == btnPrintLineNumbers) {
txtYourTextArea.setText(this.grep.Pri());
}
}
public static void main(String args[]) {
new GrepGUI(); }
}