001/* ---------------------------------------------------------------------------- 002 The Kiwi Toolkit - A Java Class Library 003 Copyright (C) 1998-2004 Mark A. Lindner 004 005 This library is free software; you can redistribute it and/or 006 modify it under the terms of the GNU General Public License as 007 published by the Free Software Foundation; either version 2 of the 008 License, or (at your option) any later version. 009 010 This library is distributed in the hope that it will be useful, 011 but WITHOUT ANY WARRANTY; without even the implied warranty of 012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 General Public License for more details. 014 015 You should have received a copy of the GNU General Public License 016 along with this library; if not, write to the Free Software 017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 018 02111-1307, USA. 019 020 The author may be contacted at: mark_a_lindner@yahoo.com 021 ---------------------------------------------------------------------------- 022 $Log: KScrollPane.java,v $ 023 Revision 1.6 2004/05/12 19:15:25 markl 024 comment block updates 025 026 Revision 1.5 2004/03/15 05:44:26 markl 027 don't make the viewport transparent 028 029 Revision 1.4 2004/01/22 23:58:33 markl 030 added missing constructor 031 032 Revision 1.3 2003/01/19 09:50:53 markl 033 Javadoc & comment header updates. 034 035 Revision 1.2 2002/03/08 22:48:09 markl 036 Bug fix. 037 038 Revision 1.1 2001/06/26 06:08:06 markl 039 New class. 040 ---------------------------------------------------------------------------- 041*/ 042 043package kiwi.ui; 044 045import java.awt.*; 046import javax.swing.*; 047 048/** A trivial extension of <code>JScrollPane</code> that renders its contents 049 * with a transparent background. 050 * 051 * @author Mark Lindner 052 */ 053 054public class KScrollPane extends JScrollPane 055 { 056 /** Construct a new <code>KScrollPane</code>. */ 057 058 public KScrollPane() 059 { 060 super(); 061 062 _init(); 063 } 064 065 /** Construct a new <code>KScrollPane</code> for the given component. 066 * 067 * @param view The component to display in the scroll pane. 068 */ 069 070 public KScrollPane(Component view) 071 { 072 super(view); 073 074 _init(); 075 } 076 077 /** Construct a new <code>KScrollPane</code> for the given component and 078 * scrollbar policies. 079 * 080 * @param view THe component to display in the scroll pane. 081 * @param vsbPolicy The vertical scrollbar policy. 082 * @param hsbPolicy The horizontal scrollbar policy. 083 * 084 * @since Kiwi 2.0 085 */ 086 087 public KScrollPane(Component view, int vsbPolicy, int hsbPolicy) 088 { 089 super(view, vsbPolicy, hsbPolicy); 090 091 _init(); 092 } 093 094 /* common initialization */ 095 096 private void _init() 097 { 098 setBackground(Color.white); 099 getViewport().setBackground(Color.white); 100 101 setOpaque(false); 102 103 JScrollBar sb = getHorizontalScrollBar(); 104 if(sb != null) 105 sb.setOpaque(false); 106 107 sb = getVerticalScrollBar(); 108 if(sb != null) 109 sb.setOpaque(false); 110 } 111 112 } 113 114/* end of source file */