src/share/classes/javax/swing/text/html/Map.java

Print this page


   1 /*
   2  * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javax.swing.text.html;
  26 
  27 import java.awt.Polygon;
  28 import java.io.Serializable;
  29 import java.util.StringTokenizer;
  30 import java.util.Vector;
  31 import javax.swing.text.AttributeSet;
  32 
  33 /**
  34  * Map is used to represent a map element that is part of an HTML document.
  35  * Once a Map has been created, and any number of areas have been added,
  36  * you can test if a point falls inside the map via the contains method.
  37  *
  38  * @author  Scott Violet
  39  */

  40 class Map implements Serializable {
  41     /** Name of the Map. */
  42     private String           name;
  43     /** An array of AttributeSets. */
  44     private Vector<AttributeSet>           areaAttributes;
  45     /** An array of RegionContainments, will slowly grow to match the
  46      * length of areaAttributes as needed. */
  47     private Vector<RegionContainment>           areas;
  48 
  49     public Map() {
  50     }
  51 
  52     public Map(String name) {
  53         this.name = name;
  54     }
  55 
  56     /**
  57      * Returns the name of the Map.
  58      */
  59     public String getName() {


   1 /*
   2  * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 package javax.swing.text.html;
  26 
  27 import java.awt.Polygon;
  28 import java.io.Serializable;
  29 import java.util.StringTokenizer;
  30 import java.util.Vector;
  31 import javax.swing.text.AttributeSet;
  32 
  33 /**
  34  * Map is used to represent a map element that is part of an HTML document.
  35  * Once a Map has been created, and any number of areas have been added,
  36  * you can test if a point falls inside the map via the contains method.
  37  *
  38  * @author  Scott Violet
  39  */
  40 @SuppressWarnings("serial") // Same-version serialization only
  41 class Map implements Serializable {
  42     /** Name of the Map. */
  43     private String           name;
  44     /** An array of AttributeSets. */
  45     private Vector<AttributeSet>           areaAttributes;
  46     /** An array of RegionContainments, will slowly grow to match the
  47      * length of areaAttributes as needed. */
  48     private Vector<RegionContainment>           areas;
  49 
  50     public Map() {
  51     }
  52 
  53     public Map(String name) {
  54         this.name = name;
  55     }
  56 
  57     /**
  58      * Returns the name of the Map.
  59      */
  60     public String getName() {