Results 1 to 3 of 3
  1. #1
    mr_o is offline Member
    Join Date
    Sep 2009
    Posts
    1
    Rep Power
    0

    Default A question about syntax.

    Hello to all :). I've come just across a syntax that I've ever encountered before as I was reading the Sun Web site tutorial on tables (How to Use Tables).

    The source code is located under the "Specifying Tool Tips for Cells" section, and is part of the TableToolTipsDemo.java file. I'll reproduce it here:

    Java Code:
    JTable table = new JTable(new MyTableModel()) {
        //Implement table cell tool tips.
        public String getToolTipText(MouseEvent e) {
            ....
        }
    
        //Implement table header tool tips.
        protected JTableHeader createDefaultTableHeader() {
            ....
        }
    };
    The code block wasn't the anonymous class that I first thought it was and as such, I don't quite see the need for the two braces (and the semicolon on the latter brace) encapsulating getToolTipText() and createDefaultTableHeader().

    Thanks in advance to all who could help.

  2. #2
    devunion is offline Member
    Join Date
    Jun 2008
    Posts
    56
    Rep Power
    0

    Default

    Your anonimous class extends JTable. MyTableModel is NOT anonimous. All is ok.
    Try Controls4J - Advanced Swing Components.

  3. #3
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

Similar Threads

  1. stuck on same syntax error....
    By Moltisanti in forum New To Java
    Replies: 2
    Last Post: 09-01-2009, 04:26 AM
  2. Syntax-Check Your XML
    By gilbertsavier in forum XML
    Replies: 0
    Last Post: 07-17-2009, 07:37 AM
  3. Syntax Colouring
    By Doctor Cactus in forum New To Java
    Replies: 2
    Last Post: 02-16-2009, 04:46 PM
  4. [SOLVED] Looking for web.xml syntax doc
    By Norm in forum Java Servlet
    Replies: 2
    Last Post: 08-21-2008, 07:59 PM
  5. syntax error
    By gabriel in forum New To Java
    Replies: 3
    Last Post: 08-03-2007, 03:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •