public MainMode() {
        
        setLayout(new java.awt.BorderLayout());
        setFocusable(false);
        
        list = new JList();
        list.setCellRenderer(new KaiListCellRenderer());
        listModel = getListModel();
        list.setModel(listModel);
        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        
        list.addMouseListener(
                new MouseAdapter(){
            public void mouseClicked(MouseEvent me){
                
                // Display menu if right mouse button clicked
                if (SwingUtilities.isRightMouseButton(me)){
                    
//                    System.out.println("mainmode click");
                    
                    JList list = (JList) me.getComponent();
                    
                    // What an ugly way to get MainMode... !
//                    MainMode mode = (MainMode) list.getParent().getParent().getParent();
                    
                    int Index = list.locationToIndex(me.getPoint());
                    if (Index != -1) {
                        list.setSelectedIndex(Index);
                        JPopupMenu popup = getPopupMenu( (KaiObject) list.getSelectedValue());
                        if (popup != null) {
                            popup.show(list, me.getX(), me.getY());
                        }
                    }
                }
                
                // Lets fetch double-click!
                else if(SwingUtilities.isLeftMouseButton(me) && me.getClickCount() == 2){
                    
                    JList list = (JList) me.getComponent();
                    Object obj = list.getSelectedValue();
                    
                    if( obj instanceof User){
                        
                        User user = (User) obj;
                        if(user.isOnline()){
                            
                            JKaiUI.getChatManager().openChat(user);
                        }
                    }
                    if( obj instanceof Arena){
                        // enter arena
                        Arena arena = (Arena) obj;
                        
                        JKaiUI.getManager().enterArena(arena);
                        
                    }
                }
                
                Object selected = JKaiUI.getMainUI().jTabbedPane.getSelectedComponent();
                if(selected instanceof ChatPanel)
                    ((ChatPanel)selected).getInputField().requestFocus();
            }
        }
        );
        
        // Set the preferred row count. This affects the preferredSize
        // of the JList when it's in a scrollpane.
        list.setVisibleRowCount(15);
        list.setFixedCellWidth(WIDTH);
        
        // Add list to a scrollpane
        JScrollPane scrollPane = new JScrollPane(list);
        scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
        add(scrollPane,BorderLayout.CENTER);
        
        setVisible(false);
    }