Separator is not showing up in the JList that is set in the TextField

Hi,
This problem is really weird and I am tired trying to find the problem and so thought i ll ask u guys... i cant see any problem in the code below.. but when i run it the separator that i want if some condition is true it just dsnt come... i did debug it and it does actually go in the if condition but the separator is not showing up... i dont kno y...
I am pasting the code of the JList renderer SearchListCellRenderer that implements ListCellRenderer.......it has only one method....
public Component getListCellRendererComponent(JList list, Object value,
               int     index, boolean isSelected, boolean cellHasFocus) {
          JLabel label = null;
          if (value != null){
               label = new JLabel();/*(JLabel) defaultRenderer.getListCellRendererComponent(list, value, index,
               isSelected, cellHasFocus);*/
               if(!anatomySeparator && anatomyMap.containsKey(value.toString().toLowerCase())){
                    label.setVerticalTextPosition(SwingConstants.BOTTOM);
                    label.setPreferredSize(new Dimension(300, 80));
                    label.setText("<html><body>" + "<p style='color:white;'><b>--------------Anatomy--------------</b></p>" + "<p style='color:white;'><b>" + value.toString() + "</b></p></body></html>");
                    anatomySeparator = true;
                    logger.debug("in anatomy");
               }else if(!diseaseSeparator && diseaseMap.containsKey(value.toString().toLowerCase())){
                    label.setVerticalTextPosition(SwingConstants.BOTTOM);
                    label.setPreferredSize(new Dimension(300, 80));
                    label.setText("<html><body>" + "<p style='color:white;'><b>---------------Diseases----------------</b></p>" + "<p style='color:white;'><b>" + value.toString() + "</b></p></body></html>");
                    diseaseSeparator = true;
                    logger.debug("in disease");
               }else if(!propSeparator && observationMap.containsKey(value.toString().toLowerCase())){
                    label.setVerticalTextPosition(SwingConstants.BOTTOM);
                    label.setPreferredSize(new Dimension(300, 80));
                    label.setText("<html><body>" + "<p style='color:white;'><b>-----------Observations----------------</b></p>" + "<p style='color:white;'><b>" + value.toString() + "</b></p></body></html>");
                    propSeparator = true;
                    logger.debug("in observation");
               }else{
                    label.setPreferredSize(new Dimension(300, 30));
                    label.setText("<html><body><p style='color:white;'><b>" + value.toString() + "</b></p></body></html>");
          return label;
If i see the output the list in the JList is bold also in the condition i have the label size larger so in some values the label is actually large than others... that means it does go in the if condition... but the separator that i have there it just dsnt show up... i dnt kno wat is wrong... can anyone pls help me with this????
This is how i set the autocopleter text field with the Jlist and its renderer... if that is of some help.....
JList list = new JList();
JPopupMenu popup = new JPopupMenu();
JTextComponent textComp;
private static final String AUTOCOMPLETER = "AUTOCOMPLETER"; //NOI18N
public SearchListCellRenderer renderer;
public AutoCompleter(JTextComponent comp){
textComp = comp;
textComp.putClientProperty(AUTOCOMPLETER, this);
JScrollPane scroll = new JScrollPane(list);
scroll.setBorder(null);
list.setFocusable( false );
list.setBackground(Color.DARK_GRAY);
list.setForeground(Color.WHITE);
renderer = new SearchListCellRenderer();
list.setCellRenderer(renderer);
scroll.getVerticalScrollBar().setFocusable( false );
scroll.getHorizontalScrollBar().setFocusable( false );
popup.setBorder(BorderFactory.createLineBorder(Color.black));
popup.add(scroll);
if(textComp instanceof JTextField){
textComp.registerKeyboardAction(showAction, KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), JComponent.WHEN_FOCUSED);
textComp.getDocument().addDocumentListener(documentListener);
}else
textComp.registerKeyboardAction(showAction, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, KeyEvent.CTRL_MASK), JComponent.WHEN_FOCUSED);
textComp.registerKeyboardAction(upAction, KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), JComponent.WHEN_FOCUSED);
textComp.registerKeyboardAction(hidePopupAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_FOCUSED);
popup.addPopupMenuListener(new PopupMenuListener(){
public void popupMenuWillBecomeVisible(PopupMenuEvent e){
public void popupMenuWillBecomeInvisible(PopupMenuEvent e){
textComp.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
public void popupMenuCanceled(PopupMenuEvent e){
list.setRequestFocusEnabled(false);
}

If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.

Similar Messages

Maybe you are looking for

  • IPhone Synchronisation - STOP!!

    Every other day, when I switch on my iPhone, I have the image on screen to connect the iPhone to my PC to synch with iTUne. How do I stop this from happening? thank you,

  • Join two tables to one recordset with nested table?

    Hello all! I want to "de-normalize" two tables into one for presentation reasons. For example: CREATE TABLE foo(id number) CREATE TABLE bar(foo_id number, value varchar2(4)) And with some data: FOO: 1 2 BAR: 1, 'gaz' 1, 'boz' 2, 'blah' Now I want to

  • Computer crashes while using Photoshop

    I have Windows Vista, 3 GB of RAM, and am using CS3. There are times when I use certain tools in Photoshop (as well as Illustrator) that will cause my computer to shut down or crash without warning. The tools that seem to trigger this shut down is th

  • Can we perform Join operation using SQLCall with Datatabae Query

    Hi, I am working on Toplink SQLCall query. I am performing join operation but, it is giving error. so please, any can tell me . we can perform join operation using SQLCall with Database Query Thanking You.

  • XP update wrecks my screen resolution on Qosmio G10-133

    I am running a two years old G10-133. Great and reliable machine. The reason I bought it was because it has great screen resolution/sharpness for MS Word texts and Outlook emails. For various reasons I do not download the MS Windows updates that are