Issue to code

HuaMin Chen
HuaMin Chen used Ask the Experts™
on
Hi,
How to resolve issue below in Eclipse?
7b.png
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jeffrey Dake Senior Director of Technologyy

Commented:
Looks like show forgot to import some classes. If you go to the eclipse “problems” view, it will give you more information about the problem.
HuaMin ChenProblem resolver

Author

Commented:
Sorry, which packages should be imported to resolve it?

For instance, I see that

ResultSet cannot be resolved to a type

is the error on line below. How to resolve it?

       ResultSet rs = stmt.executeQuery(sql);

Open in new window

Distinguished Expert 2018
Commented:
You should import all of the java.sql.*;
HuaMin ChenProblem resolver

Author

Commented:
How to disallow to edit the textarea below?
public class Main {
      public static void main( String[] args )
      {
            try
            {
                  final JFrame frame = new JFrame( "Information" );
                  final JPanel mainPanel = new JPanel();
                  mainPanel.setPreferredSize ( new Dimension( 800, 700 ) );
                  frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
                  frame.getContentPane().add ( mainPanel );
                  frame.setLocationRelativeTo( null );

                  // JTextArea supports a subset of HTML and with that you
                  // can change fonts within the text.
                  final JTextArea textArea = new JTextArea(
                              "This is an editable JTextArea. "
                                          + "A text area is a \"plain\" text component, "
                                          + "which means that although it can display text "
                                          + "in any font, all of the text is in the same font." );
                  textArea.setFont( new Font( "Serif", Font.BOLD, 12 ) );
                  textArea.setLineWrap( true );
                  textArea.setWrapStyleWord( true );

                  mainPanel.add( textArea );

                  frame.pack();
                  frame.setVisible( true );      // should be last

                  beep();
            }
            catch( final Exception e )
            {
                  final JPanel panel2 = new JPanel();

                  JOptionPane.showMessageDialog( panel2, e, "Error",
                              JOptionPane.ERROR_MESSAGE );
            }

      }

Open in new window

Distinguished Expert 2018

Commented:
This is a different question. Please accept an answer and post a new question for this.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial