Strange Problem: MenuItem icon is displayed twice

I have a simplest menu with icons. The problem is that when menu item is  clicked, the icon gets displayed twice(one on top of the other).
i.e: The SubMenuItem A1 icon is displayed twice( along the top and left  side)
Any ideas about how to prevent this??

TeotiGraphix wrote:
Hi,
Are you using a custom menu item renderer? If not and you are using the stock Menu, this seems like a bug. It really shouldn't since a whole bunch of other people would get it as well.
Are you using icon fields or functions?
Mike
No, it's the simplest menu from adobe documentation!!
No Renderers, embeded icons.
The code is bellow. Any ideas?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Script>
        <![CDATA[
            import mx.controls.Menu;
             [Bindable]
             [Embed(source="./assets/forward.png")]
                  public var iconEdit:Class;  
                  [Bindable]
             [Embed(source="./assets/bank.png")]
                  public var iconEdit2:Class;  
            private function createAndShow():void {
                var myMenu:Menu = Menu.createMenu(null, menuData, true);
                myMenu.show(10, 10);
            [Bindable]
            public var menuData:Array = [
                {label: "MenuItem A", children: [
                    {label: "SubMenuItem A-1", icon: "iconEdit"},
                    {label: "SubMenuItem A-2", icon: "iconEdit2"}
        ]]>
    </mx:Script>
    <!-- Button control to create and open the menu. -->
    <mx:Button x="300" y="10"
        label="Open Menu"
        click="createAndShow();"/>
</mx:Application>
</mx:Application>

Similar Messages

  • Problems with JSF&Tiles (displaying twice one inserted page in tiles)

    I'm using Tiles framework withih Dynamic Web Project in Websphere (WSAD 5.1.1), the project is based on JSF.
    - included tiles.jar in WEB-INF/lib directory
    - in web.xml defined servlet action as: <servlet>
              <servlet-name>action</servlet-name>
              <display-name>TilesServlet</display-name>
              <servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class>
              <init-param>
                   <param-name>definitions-parser-validate</param-name>
                   <param-value>false</param-value>
              </init-param>
              <load-on-startup>2</load-on-startup>
         </servlet> - also to Faces Servlet set value "load on startup" on 1
    - added struts-tiles.tld to WEB-INF folder
    - then I created index.jsp: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
    <%@ page
    language="java"
    contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
    %>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <META name="GENERATOR" content="IBM WebSphere Studio">
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="theme/Master.css" rel="stylesheet"
         type="text/css">
    <TITLE>index.jsp</TITLE>
    <%-- jsf:codeBehind language="java" location="/JavaSource/codebehind/index.java" --%><%-- /jsf:codeBehind --%>
    </HEAD>
    <f:use_faces>
         <BODY>
         <TABLE border="1">
              <TBODY>
                   <TR>
                        <TD>
                             <tiles:insert page="/menu.jsp" flush="false"/>
                        </TD>
                        <TD>
                             <tiles:insert page="/content.jsp" flush="false"/>
                        </TD>
                   </TR>
              </TBODY>
         </TABLE>
         </BODY>
    </f:use_faces>
    </HTML> - menu.jsp and content.jsp inserted in index.jsp are not the same, and here is code for menu.jsp: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <HTML>
    <HEAD>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ page
    language="java"
    contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
    %>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <META name="GENERATOR" content="IBM WebSphere Studio">
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="theme/Master.css" rel="stylesheet"
         type="text/css">
    <TITLE>menu.jsp</TITLE>
    <SCRIPT type="text/JavaScript" language="JavaScript"
         src=".ibmjsfres/hxclient.js"></SCRIPT>
    <LINK rel="stylesheet" type="text/css"
         href=".ibmjsfres/css/stylesheet.css" title="Style">
    <%-- jsf:codeBehind language="java" location="/JavaSource/codebehind/menu.java" --%><%-- /jsf:codeBehind --%>
    </HEAD>
    <f:use_faces>
         <BODY><hx:script_collector>
         <h:form formName="form1" id="form1"><P><hx:panel_actionbar
                        id="actionbar1"><hx:panel_actionbar nestedTitleText="Sub-Panel Label" id="actionbar2"><hx:command_buttonex label="Command Label" id="button1" action="go_page01"></hx:command_buttonex><hx:command_buttonex label="Command Label" id="button2"></hx:command_buttonex></hx:panel_actionbar><hx:panel_actionbar nestedTitleText="Sub-Panel Label" id="actionbar3"><hx:command_buttonex label="Command Label" id="button3"></hx:command_buttonex><hx:command_buttonex label="Command Label" id="button4"></hx:command_buttonex></hx:panel_actionbar></hx:panel_actionbar></P></h:form>
         </hx:script_collector></BODY>
    </f:use_faces>
    </HTML>The problem is when I run application on server and go to index.jsp the resulting page is containing two times menu.jsp, instead once menu.jsp and once content.jsp.
    Also when you click on buttons in "second" menu.jsp it's like it was clicked on the "first and the original one". When you click navigation rules do apply.
    Can anyone help on this?
    Message was edited by:
    DeYo

    I haven't solved problem yet but so far I realised this:
    - the problem is that both menu.jsp and content.jsp have forms, with tags: <h:form formName="form1" id="form1">.
    I've tried renaming form and id, but it didn't worked, alo tried changing scope of managed beans for the two inserted jsp pages - still nothing.
    - also if the content.jsp is not containing form but other JSF components like Image or Hyperlink, that components are not being shown/rendered.

  • Strange Problems With Display and Permissions Since 10.5.1 update.

    Since I've done the 10.5.1 update I have been having a strange problem with my desktop and dock displays. On my desktop I have these strange lines that appear any time I log in or open any application, the lines never go away and change locations on the screen once I open an application or move a window. My dock has the reflective shelf for about half of it, the rest is a dull grey. I've also had problems with verifying and repairing my permissions. I can never actually complete either permissions task. I've used some third party apps, they always fail as well. The only time I can actually repair my permissions is by booting in to single user mode and doing a fsck -f command. When I boot back in to Leopard and try to use the Disk Utility to repair, it continues to fail.
    I'm not sure if the video problem I am having stems from a permissions issue or possibly a corrupt video driver. Either way, I've done a lot research and haven't found anyone with the same problems I have been having so I thought I would give these forums a shot.
    I am using a PowerMac G4 Quicksilver with dual 800Mhz, 1.5gb RAM, and a GeForce4 Ti 4600 128mb video card.
    Here is a screen shot of the line and dock problem.
    Here is a screen shot of my "About This Mac.
    If anyone could lend some light on this issue, I would greatly appreciate it.
    Thanks
    Jeff

    you can pile it on this: http://discussions.apple.com/thread.jspa?threadID=1246649&tstart=0
    btw - no solution yet.

  • C3-00 strange icon on display

    Hallo everyone, I need Your help about a strange problem on my C3-00. Near the silent's mode icon I can see another icon. It seems a ring with a little triangle on the right side. What is that? I can't find nothing on my manual.
    Thanks a lot.

    uploading a snapshot of the screen showing the icon will let others help you out in a much better way...
    blitZkid
    Nokia C7: Running on Nokia Belle
    "If I'm helpful in anyway, a click of appreciation on the star would be nice"

  • 10.4.4 Strange Problem – Menu Bar Icons

    I installed the OS X 10.4.4 update through Software Update this morning, repairing permissions before and afterwards. Although the installation seemed to work fine, there is now a strange problem which has happened since I first re-started the Mac.
    The left side of the menu bar is working normally, with the curved corner and apple/application menus, but all the icons, the clock, and even Spotlight have disappeared from the right.
    Even stranger, the top-right corner is not curved, but is square and extends right to the corner of the monitor.
    I did use ShapeShifter, but I doubt this has caused the error as I disabled it before the update, and have not re-enabled it since.
    Does anyone have any idea what's happened, or what I should do about it?

    I had the same problem.
    I updated to 10.4.4 a few days ago. After restarting, the entire top right of the menu bar disappeared, went missing.
    The corner of the screen became square rather than the usual rounded effect. the clock disappeared, as well as all the items up there .. battery, airport, bluetooth, etc. It all just disappeared.
    It made no difference at all if you went to the control panel and turned on the items again ... the whole top-right area of the menu bar was messed up.
    Based on the info in the previous - THANKS - here is how I fixed the problem.
    I got my other laptop (I guess if you're an OSX user, it's good to have two laptops!) which still had a working menu bar. I copied the folder
    /System/Library/CoreServices/Search.bundle
    from my working powerbook to the powerbook with the missing menu bar. You will have to be able to log in as root on the target machine to do this.
    I simply restarted and then everythying was fine. I did NOT have to resinstall 10.4.4 or anything.
    Why does it happen?
    I too had got rid of the spotlight search field at the top right of the menu bar by dsoing the usual hack to get rid of it. It appears this interacts badly with the updates.
    Since a large percentage of users want to get rid of the spotlight search field in the menu bar, this will probably be an ongoing problem with each new upgrade...

  • HT201415 actually i am use iphone5 in bangladesh. But i am facing some problem , when i am useing the internet over cellular data network. when i am open the cellular data on but no icon E display but when Enable 3G on-of then E is aviable.its a device pr

    actually i am use iphone5 in bangladesh. But i am facing some problem , when i am useing the internet over cellular data network. when i am open the cellular data on but no icon E display but when Enable 3G on-of then E is aviable.its a device problem or Carrier ?

    Hafizur Rahman wrote:
    when i am open the cellular data on but no icon E display but when Enable 3G on-of then E is aviable.its a device problem or Carrier ?
    Problem? I'm not even sure what your problem is, much less whether it's a problem with the phone or the carrier.

  • FileMaker Pro icons not displaying correctly

    After updating to Yosemite, all of my FileMaker Pro document icons are displayed as generic icons (juts the outline of a piece of paper). This occurs both in Finder and on the Dock.
    Other document icons seem okay. If I do a Get Info on a document, the icon seems okay in the Get Info window.
    Does anyone know how to correct this behavior?
    Thanks!

    Thanks, coreworksnet.
    I was also seeing this problem with FM 13. I was able to get around it, but it was a headache. I had to go into each individual DB file and do a Get Info. That dialog shows the icon for the document (which, strangely enough, showed the correct icon). I then copied the icon over from the FM app (which visually did nothing). But once I closed the Get Info dialog, the icon for the DB file was correct.
    Repeat a few dozen times for all of my DB files, and it seems okay now.

  • Portal Screens are displayed twice

    Hi,
    I came across a strange problem with the EP7 today. All the screens in the EP are displayed twice in the browser(IE6). The page is split horizontally and what ever i open in the first half, gets opened in the second half as well.
    Any one has come across this problem? Any solution to solve this?
    Thanks,
    Venkat

    also see...
    Reverting to default settings
    Use the Restore Defaults button to reset the content and layout of the page to the default settings defined by the content administrator.
    at
    http://help.sap.com/saphelp_nw04s/helpdata/en/a8/65e93b3a612d52e10000000a11402f/frameset.htm

  • Strange problem with JOptionPane.showInputDialog

    I have a strange problem with JOptionPane.showInputDialog in that when I run a program anything that is typed in is displayed backwards, for example: I type this character > and this < is what is displayed.
    I've uninstalled the sdk and reinstalled it twice but that hasn't solved my problem and the java plug-in in the control panel is displaying the same symptoms.
    I did a search before posting this but all I got really was posts from people who wanted to reverse their text.
    Thanks for your help on this.

    Is it just the < and > characters?

  • Menu toolbar icons not displayed in colour when deployed on the Web

    Hello!
    We are developing an application using Forms6i on Windows NT.
    Our problem is that menu toolbar icons are not displayed in colour when the application is deployed on the Web using lookAndFeel = generic. This is the case both when using Microsoft IE5 and Netscape 4.5. When lookAndFeel = oracle, however, the icons are displayed in colour.
    The icons are stored as *.gif files in the same directory as the application *.html file. It does not help to create a virtual path /web_icons/ in the www listener and edit the parameter default.icons.iconpath in the file Registry.dat.
    When running the application as client/server, the menu toolbar icons are displayed in colour as expected.
    Any ideas on how to solve this problem?
    Regards,
    Kjell Pedersen
    Nera SatCom AS
    Norway
    null

    Hi,
    I got the same problem and I didn't figure out, how to solve this problem.
    But did you try to printout the form anyway? I guess you will see the icons on the printout, won't you?
    Regards
    Dirk

  • Problem with repaint of display after a click event

    Hi,
    I have a problem with repaint of display. In particular in method keyPressed() i inserted a statement that, after i clicked bottom 2 of phone, must draw a string. But this string doesn't drawing.
    Instead if i reduce to icon the window, which emulate my application, and then i enlarge it, i see display repainted with the string.
    I don't know why.
    Any suggestions?
    Please help me.

    modified your code little
    don't draw in keyPressed
    import java.io.IOException;
    import javax.microedition.lcdui.Canvas;
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    public class PlayerCanvas extends Canvas implements CommandListener{
         Display display;
         Displayable dsp11;
    private Image play, pause, stop, next, previous = null;
    private int gamcode;
    private Command quitCmd = new Command("Back", Command.ITEM, 1);
    public PlayerCanvas(Display display,Displayable dsp11){
         this.display =display;
         this.dsp11 =dsp11;
         addCommand(quitCmd);
         createController();
         setCommandListener(this);
         display.setCurrent(this);
              protected void paint(Graphics g)
              g.setColor(255,200,150);
              g.fillRect(0, 0, getWidth(), getHeight());
              if (play != null){
              g.drawImage(play, getWidth()/5, getHeight()-50, Graphics.BOTTOM | Graphics.HCENTER);
              if (stop != null){
              g.drawImage(stop, getWidth()/5, getHeight()-10, Graphics.BOTTOM | Graphics.HCENTER);
              if (next != null){
              g.drawImage(next, (getWidth()/5)+10, getHeight()-30, Graphics.BOTTOM | Graphics.LEFT);
              if (previous != null){
              g.drawImage(previous, (getWidth()/5)-30, getHeight()-30, Graphics.BOTTOM | Graphics.LEFT);
                   /////this will draw on key UP
                   g.setColor(0,0,0);
                   System.out.print(gamcode);
                   if(gamcode==Canvas.UP){
                        g.drawString("PROVA",10, 0, 0);
                   }else if(gamcode==Canvas.DOWN){
                        g.drawString("DIFFERENT",10, 30, 0);     
    private void createController()
    try {
    play = Image.createImage("/icon3.png");//replace your original images plz
    pause = Image.createImage("/icon3.png");
    stop = Image.createImage("/icon3.png");
    next = Image.createImage("/icon3.png");
    previous = Image.createImage("/icon3.png");
    } catch (IOException e) {
    play = null;
    pause = null;
    stop = null;
    next = null;
    previous = null;
    if (play == null){
    System.out.println("cannot load play.png");
    if (pause == null){
    System.out.println("cannot load pause.png");
    if (stop == null){
    System.out.println("cannot load stop.png");
    if (next == null){
    System.out.println("cannot load next.png");
    if (previous == null){
    System.out.println("cannot load previous.png");
              protected void keyPressed(int keyCode)
                   repaint();
                   if ( (keyCode == 2) || (UP == getGameAction(keyCode)) ){
                        gamcode = UP;
                        repaint();
                        else if ( (keyCode == 8) || (DOWN == getGameAction(keyCode)) ){
                             gamcode =DOWN;
                             repaint();
              else if ( (keyCode == 4) || (LEFT == getGameAction(keyCode)) ){
              else if ( (keyCode == 6) || (RIGHT == getGameAction(keyCode)) ){
              public void commandAction(Command arg0, Displayable arg1) {
                   // TODO Auto-generated method stub
                   if(arg0==quitCmd){
                        display.setCurrent(dsp11);
    }

  • I have a Samsung HD TV and I purchased a Mini Display port to HDMI Adapter today. For some strange reason I get no display on my HD tv. I even tried switching a few HDMI cables and nothing popped up. I made sure my computer was updated. Help pls

    I have a Samsung HD TV and I purchased a Mini Display port to HDMI Adapter today. For some strange reason I get no display on my HD tv. I even tried switching a few HDMI cables and nothing popped up. I made sure my computer performed all software updates, and I even tried calling Apple Support. They just told me to keep trying different hdmi cables and see if anything pops up. Does anybody know what the problem is? My HDMI cable is from "rocketfish" also my display port is too.

    You may have the screen refresh rate set higher than the TV is generally able to track reliably. It may be able to get there most times, but occasionally loses sync because it is out of its nominal range.
    I suggest you sit down with the manual for the TV and find out what resolutions at what refresh rates it intends to support through VGA, and make sure your screen settings are near (or below) those limits.

  • Strange behaviour in alv output display for a date column!

    hi friends,
    my alv output list display contains a column for budat (posting date), if this field has no value, then it displays a blank cell (space) in the output in my user login...but when the same report is run in another user login, even though the value of the column is null, it displays 00000000 (8 zeroes) rather than displaying a blank cell...i have set the field catalog property NO_ZERO = 'X'; is this property has anything to do with authorization to achieve its funcionality? am not sure...this is strange, as it is the same report, same field catalog that is being used..need some inputs on this
    thanks in advance
    Sathish

    There are 2 solutions for an adhoc solution you can change the field to a char10 field, this will solve your immediate problem of the 0 display. For a permanent solution you can check the user profile setting for the date for you as well as the concerned user. 
    Hope That Helps
    Anirban M.

  • Double clicking on an Icon to display a frame....

    Hi! I have an icon whereby when double clicked on should display a frame. To display the icon, I have it as an ImageIcon placed on a label, which works fine. But my problem now is what kind of listener can I add to this label, if any that will cause this frame to be displayed? OR if you have an idea of going about or around this, I'll really appreciate it!! Thanks a lot in advance!!
    Cheers,
    Bolo

    Thanks a lot again Radish! It worked fine. I got another question, which I hope you'll be willing to answer. Hope I'm not being a pain in the butt?
    After the user double clicks on an icon to display a window(step by step wizard), the panel on the frame contains "back" and "next" buttons. And of course the button on the last panel will say finish instead of next. All of this is working fine. My problem is that whenever I re-launch the wizard, it displays the last panel which contains the finish button instead of the first panel. Do you have any ideas of how I can fix this? Thanks a lot in advance!!
    Cheers,
    Bolo

  • Short code causes a strange problem - About the list again -- please read!

    Hi again people. Maybe you remember my project - has a list, that you can search thru using a text field. During the work I got stuck on a strange problem ( Again :-( ) My app has one text field, one combo box, one list and a text field once more. The code should do the following ->
    *1. Load the list, no problem with that.*
    *2. Show the elements of the list, that match the selected group in the combo box,no problem.*
    *3. Search thru the list using the text field,no problem.*
    4. When the user selects an element from the list, it should display its info in the second text field. This also works fine, but when after looking at info of one of the elements the things on numbers 2 and 3 ( look up! ) stop working. I must say that everything works fine until user selects an element from the list. I couldnt understand this kind of behavior so I am asking you to help me please.
    The code is very simple:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    class the_window extends JFrame implements DocumentListener, ItemListener, ListSelectionListener {
        FileReader reader;
        String data_base[][];
        String first_pass[];
        int number_of_elements;
        DefaultListModel dflm = new DefaultListModel();
        JList list;
        JTextField text_field = new JTextField();
        JTextField info_field = new JTextField();
        String groups[] = {"1. group" , "2. group"};
        JComboBox groups_cmbx = new JComboBox(groups);
        the_window(){
            super("the Window!");
            JPanel panel = new JPanel(null);
            Container c = this.getContentPane();
            c.add(panel);
            text_field.setBounds(10,10,170,25);
            text_field.getDocument().addDocumentListener(this);
            panel.add(text_field);
            groups_cmbx.setBounds(10,45,170,25);
            groups_cmbx.addItemListener(this);
            panel.add(groups_cmbx);
            list = new JList(dflm);
            list.setBounds(10,90,170,190);
            list.setFixedCellHeight(20);
            list.addListSelectionListener(this);
            panel.add(list);
            info_field.setBounds(10,280,170,25);
            panel.add(info_field);
            load_the_base();
            refresh();
            this.setSize(190,350);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setResizable(false);
            this.setVisible(true);
        public void itemStateChanged(ItemEvent e){
            refresh();
        public void valueChanged(ListSelectionEvent e){
            String str = (String) dflm.getElementAt(list.getSelectedIndex());
            int index = 0;
            for(int i = 0; i < number_of_elements; i++){
                if(str.equals(data_base[0])){
    index = i;
    break;
    info_field.setText(data_base[index][1]);
    private void load_the_base(){
    String data = "";
    try{
    reader = new FileReader("data.txt";);
    int r = 0;
    while((r = reader.read()) != -1){
    char c = (char) r;
    data += c;
    reader.close();
    }catch(IOException e){}
    first_pass = data.split(";");
    number_of_elements = first_pass.length;
    data_base = new String[number_of_elements][];
    for(int i = 0; i<number_of_elements; i++){
    data_base[i] = first_pass[i].split("#");
    private void refresh(){
    String search_str = text_field.getText();
    int selektovano = groups_cmbx.getSelectedIndex();
    dflm.clear();
    for(int i = 0; i < number_of_elements; i++){
    int grupa = Integer.parseInt(data_base[i][2]);
    if(grupa == selektovano){
    String at_the_moment = data_base[i][0]; // if you change this to String at_the_moment = data_base[i][1]; it works perfectly
    if(at_the_moment.startsWith(search_str)){
    dflm.addElement(at_the_moment);
    public void changedUpdate(DocumentEvent e){
    refresh();
    public void removeUpdate(DocumentEvent e){
    refresh();
    public void insertUpdate(DocumentEvent e){
    refresh();
    public class Main {
    public static void main(String[] args) {
    JFrame f = new the_window();
    Now, can you please tell me whats wrong with this?
    For the "data.txt" make a new text file using *notepad* and copy the following line into the document:
    _1. element#1. info#0;2. element#2. info#0;3. element#3. info#1;4. element#4. info#1;5. element#5. info#1;_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Darryl.Burke wrote:
    Keith, thanks for making that readable. So here's the diagnosis -
    In the refresh() method, calling defaultListModel.clear() results in a valueChanged(...) event in which this method calldefaultListModel.getElementAt(list.getSelectedIndex())results in the exception noted, as getSelectedIndex returns -1, the list being empty... you can't getElementAt(-1).
    I haven't analyzed all the code nor checked whether is now works as desired, but this small change to valueChanged counters the exception being thrown.   public void valueChanged(ListSelectionEvent e) {
    infoField.setText(""); // do this unconditionally
    if (list.getSelectedIndex() != -1) {
    String value = (String)defaultListModel.getElementAt(list.getSelectedIndex());
    for(int i = 0; i < numFields; i++){
    if(value.equals(matrix[0])){
    infoField.setText(matrix[i][1]);
    break;
    db
    Yea! You were right! I didnt think that calling *list_model.clear();* will result in calling *valueChanged()* ........
    That was some *clear()* thinking :-) Thank you!
    corlettk wrote:
    I cleaned up some variable & method names (tut tut), imports (very naighty), and some thread stuff... but it remains fundamentally the same codeIs it so important to "clean" the imports? How much does it slow down the loading time? Should I do this on all my projects, because they are all "very naighty"?
    ps. Thanks to all that gave some help to answering this strange question :-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for