Closed mhiley closed 11 years ago
Some details: McV has an age-old bug where the display list disappears after the user makes any changes to their ViewManager properties (if you click View->Properties and then do Apply or OK). (McV inquiry 268)
Turns out that this is caused by FontSelector not initializing the "sizeChoice" field until the value of the JComboBox for size selection actually gets changed. The IDV happens to be immune from the problem because it has a default font size that is different from the first choice in the size list (default is 12, the first choice in the list is 8). So, sizeChoice properly gets initialized to 12 every time because the JComboBox is always changed to the default font size of 12. McV gets incredibly unlucky though because our default font size is the same as the first choice in the JComboBox list... so when JComboBox.setSelectedItem gets called, the selection doesn't change, so FontSelector.itemStateChanged never gets called, and sizeChoice stays uninitialized (i.e., zero)! (And thus, our display list disappears because the font size is zero!!) See: http://docs.oracle.com/javase/6/docs/api/javax/swing/JComboBox.html#setSelectedItem(java.lang.Object)
Anyway, long story short... setFontName, setFontSize, and setFontStyle should actually explicitly set the fontChoice, sizeChoice, and styleChoice fields in order to avoid this sneaky bug.
Just noting that this one is "on hold" until I've had a chance to test Don's suggestion!
Hi Don - this change looks reasonable and I haven't seen any issues in testing. Let me know if it isn't quite what you had in mind.
Looks good. Thanks.
letting it happen in itemStateChanged (which in the case of size, only gets called in the event that the JComboBox selection actually changes!) This fixes McV inquiry [268]