> Hi
>
> Is it possible to create a horziontal scrollbar in a JComboBox? Any idea
> and
> help will be much appreciated!
You can add your own cell renderer by using the setRenderer()
method on JComboBox(). Here is an example renderer:
import java.awt.*;
import javax.swing.*;
public class BasicListCellRenderer extends JTextField implements ListCellRenderer
{
public BasicListCellRenderer()
{
super(25);
setOpaque(true);
}
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus)
{
if(value == null)
return this;
setText(value.toString());
return this;
}
}
So instead of extending a JTextField you might extend another
component that is a textfield contained in a ScrollPane which
is limited to horizontal scrolling only.
--Corey
>
> Zhichao
>
> ________________________________________________________
> | |
> | Zhichao Hong |
> | Sun Certified Java Programmer (612) 694-2557 (o) |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> | Software Engineer (651) 647-6137 (h) |
> | CES, Inc [EMAIL PROTECTED] |
> _ | | _
> / ) | STAY IN TOUCH | ( \
> _( (_ | _ _ | _) )_
> (((\ \)|_/ )________________________________________________( \_|(/ /)))
> \\\\ \_/ / \ \_/ ////
> \ / \ /
> \ _/ \_ /
> /__/ \__\
>
>
> ----------------------------------------------------------------------
> To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
>
/* Corey Brown (WB0RXQ): 20m, 15m, 2m(146.82) 70cm(443.65) */
/* AT&T NCS | [EMAIL PROTECTED] */
/* Alpharetta, Ga 30005 | [EMAIL PROTECTED] */
/* (770)750-8071 | New rays from an ancient sun (JS) */
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]