import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; public class JavaCommentsChecker extends JFrame implements ActionListener{ private Font demoFont; private JTextArea commentsArea; private JLabel resultLabel; private JButton actionButton; private String comments; private LinkedList s; private boolean finalStateReached = false; public JavaCommentsChecker(){ super( "Multiple-line Comment Syntax Checker" ); demoFont = new Font(Font.SANS_SERIF, Font.BOLD, 20); Container container = getContentPane(); container.setLayout( new FlowLayout() ); commentsArea = new JTextArea("/*** Please type your comments here. ***/"); commentsArea.setRows(10); commentsArea.setColumns(20); commentsArea.setLineWrap(true); commentsArea.setFont(demoFont); container.add( commentsArea ); resultLabel = new JLabel(" "); resultLabel.setOpaque(true); resultLabel.setBackground(Color.yellow); resultLabel.setFont(demoFont); container.add( resultLabel ); actionButton = new JButton( "Check Comments Syntax" ); actionButton.setFont(demoFont); container.add( actionButton ); actionButton.addActionListener( this ); setSize( 460, 400 ); setVisible( true ); } public void actionPerformed( ActionEvent event ){ String comments = commentsArea.getText(); s = new LinkedList(); for(int i=0; i