Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: novaworx/swing/XComboBox.java


1   /*
2   Novaworx Development Environment
3   Copyright (C) 2000-2003 Mark Soderquist
4   
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 2 of the License, or
8   (at your option) any later version.
9   
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  GNU General Public License for more details.
14  
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to:
17  
18  Free Software Foundation, Inc.
19  59 Temple Place, Suite 330
20  Boston, MA 02111-1307 USA
21  */
22  
23  package novaworx.swing;
24  
25  import java.awt.Graphics;
26  import javax.swing.JTextField;
27  
28  /**
29  The <code>XComboBox</code> class allows backgrounds to be drawn
30  for non-opaque components.  This allows backgrounds that are
31  transparent or semi-transparent.  This one needs to be mostly
32  redone in order to work correctly with transparencies.
33  */
34  public class XComboBox extends JTextField {
35  
36    /**
37    Constructs a new empty <code>XComboBox</code>. A default model is
38    created and the initial string is set to null.
39    */
40    public XComboBox() {
41      super();
42      setOpaque( false );
43    }
44  
45    /**
46    Constructs a new empty <code>XComboBox</code> with the specified number
47    of columns. A default model is created and the initial string is set to
48    null.
49    */
50    public XComboBox( int aiColumns ) {
51      super( aiColumns );
52      setOpaque( false );
53    }
54  
55    /**
56    Construct a new <code>XComboBox</code> initialized with the specified
57    text. A default model is created and the number of columns is zero.
58    */
59    public XComboBox( String asText ) {
60      super( asText );
61      setOpaque( false );
62    }
63  
64    /**
65    Constructs a new empty <code>XComboBox</code> with the specified text
66    and columns. A default model is created.
67    */
68    public XComboBox( String asText, int aiColumns ) {
69      super( asText, aiColumns );
70      setOpaque( false );
71    }
72  
73    /**
74    Add an item to the list.
75    */
76    public void addItem( Object aoItem ) {
77      //
78    }
79  
80    /**
81    Only need to override the paint method.
82    */
83    public void paint( Graphics aoGraphics ) {
84      // Draw the background.
85      aoGraphics.setColor( getBackground() );
86      aoGraphics.fillRect( 0, 0, getWidth(), getHeight() );
87  
88      super.paint( aoGraphics );
89    }
90  
91  }