001 /*BEGIN_COPYRIGHT_BLOCK
002 *
003 * Copyright (c) 2001-2010, JavaPLT group at Rice University (drjava@rice.edu)
004 * All rights reserved.
005 *
006 * Redistribution and use in source and binary forms, with or without
007 * modification, are permitted provided that the following conditions are met:
008 * * Redistributions of source code must retain the above copyright
009 * notice, this list of conditions and the following disclaimer.
010 * * Redistributions in binary form must reproduce the above copyright
011 * notice, this list of conditions and the following disclaimer in the
012 * documentation and/or other materials provided with the distribution.
013 * * Neither the names of DrJava, the JavaPLT group, Rice University, nor the
014 * names of its contributors may be used to endorse or promote products
015 * derived from this software without specific prior written permission.
016 *
017 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
018 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
019 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
020 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
021 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
022 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
023 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
024 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
025 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
026 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
027 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
028 *
029 * This software is Open Source Initiative approved Open Source Software.
030 * Open Source Initative Approved is a trademark of the Open Source Initiative.
031 *
032 * This file is part of DrJava. Download the current version of this project
033 * from http://www.drjava.org/ or http://sourceforge.net/projects/drjava/
034 *
035 * END_COPYRIGHT_BLOCK*/
036
037 package edu.rice.cs.javalanglevels.util;
038
039 import javax.swing.*;
040 import javax.swing.border.*;
041 import java.awt.*;
042 /** A JScrollPane without a traditional Swing border. Uses its own
043 * EtchedBorder instead, which improves the appearance of nested panes
044 * on Mac OS X.
045 * @version $Id: BorderlessScrollPane.java 5389 2010-09-17 19:52:54Z rcartwright $
046 */
047 public class BorderlessScrollPane extends JScrollPane {
048 /** The default border for a "borderless" scroll pane.
049 */
050 private static final Border DEFAULT = new EtchedBorder();
051
052 // note, I can't think of a way to guarantee superclass behavior without
053 // overriding each superclass constructor and then calling setBorder().
054
055 public BorderlessScrollPane() {
056 super();
057 setBorder(DEFAULT);
058 }
059 public BorderlessScrollPane(Component view) {
060 super(view);
061 setBorder(DEFAULT);
062 }
063 public BorderlessScrollPane(Component view, int vsbPolicy, int hsbPolicy) {
064 super(view,vsbPolicy,hsbPolicy);
065 setBorder(DEFAULT);
066 }
067 public BorderlessScrollPane(int vsbPolicy, int hsbPolicy) {
068 super(vsbPolicy,hsbPolicy);
069 setBorder(DEFAULT);
070 }
071 }