JList not drawing correctly

I have a JList inside a JScrollPane in my JApplet. What I want to do ist the following: be able to set which items are selected from the outside and then ensure that at least the first selected item is visible.
The important parts of my code look like this:
// length is the number of selected items
int[] sel = new int[length];
// fill "sel" here
list.setSelectedIndices(sel);
list.ensureIndexIsVisible(list.getSelectedIndex());
//  later:
repaint();This works sometimes, but on other times I get a totally screwed up JList.: Large white spaces appear instead of an item or the JList is not drawn correctly at all.
What could be the problem here? Repainting alone doesn't help, so it has to be something deeper in the JList. Any help is appreciated!

untested... but you might try
list.ensureIndexIsVisible(list.getMinSelectedIndex());
don't know if that will help or not.
good luck :)

Similar Messages

  • Jlist not displaying correctly when populated by thread

    Hi, I have this problem when a thread attempts to populat a Jlist, it will only populate sometimes. Othertimes, it doesnt display correctly. The model will have the correct objects in it, but the display on screen will not appear. I have some code below that demonstrates the problem. I renger html in the Jlist just so that its easier to see, but doesnt have to be html.
    import javax.swing.*;
    public class listtest extends javax.swing.JFrame {
    private DefaultListModel model = new DefaultListModel();
    public listtest() {
    initComponents();
    jList1.setModel(model);
    private void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    jList1 = new javax.swing.JList();
    jButton1 = new javax.swing.JButton();
    addWindowListener(new java.awt.event.WindowAdapter() {
    public void windowClosing(java.awt.event.WindowEvent evt) {
    exitForm(evt);
    jScrollPane1.setViewportView(jList1);
    getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
    jButton1.setText("jButton1");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    getContentPane().add(jButton1, java.awt.BorderLayout.SOUTH);
    pack();
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    new myThread().start();
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {
    System.exit(0);
    * @param args the command line arguments
    public static void main(String args[]) {
    new listtest().show();
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JList jList1;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration
    class myThread extends Thread{
    public void run(){
    model.clear();
    String temp;
    for(int i = 0; i < 100; ++i){
    temp = "<html><table><tr><td>" + i + "</td></tr></table></html>";
    model.addElement(temp);
    When you push the button, sometimes the list will come out correctly and sometimes it wont. Anyone know how to get it to display correctly? I tries all sort of things with InvokeLater, validates, repaints, etc. I cant get anything to get it to display properly.

    I think this is closer to what you wanted.
    Your sample code if obviously simple enough not to need it, but this allows you to thread off the work and the use invokeLater only to push the results back to the UI/event thread.
    for( int i = 0; i < 100; ++i )
    final String temp = "<html><table><tr><td>" + i + "</td></tr></table></html>";
    SwingUtilities.invokeLater(
    new Runnable()
        public void run()
            model.addElement(temp);
    }

  • Filter Previews not drawing correctly on MacOS

    FURTHER MENU WOES:(I don't think this is normal)
    USM preview show/hide SPLIT
    also RHS panel empty after USM panel closed (cancelled) and image remains exactly as is i.e. unusable, need to quit and reopned PS

    Thanks for that
    Yes I do have Nik/Google filters . why are they specifically prime suspects, do they have a historty of such problems?
    I'll try disabling those and see if it recurs

  • Perspective shapes not drawing properly

    Illustrator CC 2014 (18.0.0) Mac OS X 10.9.4
    So Illustrator is misbehaving today and it's not just one machine.
    When drawing shapes in perspective mode, shapes are not drawing correctly. They appear to be ok initially, but when I transform them, they stop aligning to the grid as if I used free transform on them.
    Also, when I try to change the stroke of an object, I cannot draw a stroke less than 1 pt and if I change the stroke alignment to inside or out, it looks like a compound shape was applied and doesn't line up (See attached images)
    Stroke applied normally
    Stroke misaligns when stroke is applied to inner
    Stroke misaligns when stroke is applied to outer
    Stroke misaligns when stroke is applied to inner and dropped to a smaller weight.

    I've also noticed that every time I place a symbol or move an object a "Shapes Expanded" box briefly appears on the page.
    I've never seed this before.

  • [svn] 3580: MXMLG-243 - Path does not draw in the correct location when width and height are set

    Revision: 3580
    Author: [email protected]
    Date: 2008-10-10 16:24:50 -0700 (Fri, 10 Oct 2008)
    Log Message:
    MXMLG-243 - Path does not draw in the correct location when width and height are set
    Fixed MatrixUtil.transformBounds to offset the four bound points by the origin
    Bug: MXMLG-243
    QA: Yes
    Doc: No
    Review: Evtim
    Ticket Links:
    http://bugs.adobe.com/jira/browse/MXMLG-243
    http://bugs.adobe.com/jira/browse/MXMLG-243
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/utils/MatrixUtil.as

    Hi,
    For web application problem, please post your thread in
    ASP.NET forum.
    Best Wishes!
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and
    makes it easier for other visitors to find the resolution later.

  • Some fonts are not shown correctly in LabVIEW 2012

    I found a bug related with fonts in LabVIEW2012 f3 KR.
    - When I select NI7SEG in font selection dialog, right font is not shown in the example box.
    - Draw text at point.vi shows same problem for some fonts while other fonts are working.
    I reported it to Korean NI. As far as I know, this was not reported in previous versions and I couldn't find any related documents in Google. 
    So, here I would like to know whether it is related with only Korean version. Please let me know if English version is OK. 
    * OS: Windows 7 32bit KR

    Just now, I installed LabVIEW 2012 f3 (32-bit, English) and checked for the issue. But the font(NI7SEG) was not shown properly in VI either.
    - Both of Korea and English version of LabVIEW 2012 on Win 7 Korea OS shows wrong results. It is same on 64-bit OS.
    - LabVIEW 2010 but on same PC shows correct fonts.
    Is there a limit of number of fonts in LabVIEW? There are more than 100 fonts are shown in the "Selection Font" dialog and I can divide them into 3 groups by sequential order. I find that all fonts in the 3rd group are not applied correctly.
    (1st group)
    Arial Unicode MS...
    Bookshelf Symbol 3....
    Windings 3
    (2nd group)
    @Arial Unicode MS...
    @Terminal
    (3rd group)
    Arial...
    Consolas...
    Courier...  
    Licida Console... 
    NI7SEG...
    Verdana

  • Reader OLE server does not draw PDF-document if paper size is too big

    If PDF document paper size is for example A0 (841 x 1189 mm) OLE object can be created and application shows PDF content correctly. But if application saves it's document and reopens it Reader does not draw content of embedded PDF document any more. Decreasing PDF document size to A1 solves the problem. Embedded object is not corrupted because it is possible to open it to Reader.
    I'm confused why Acrobat Reader OLE server is capable of drawing PDF file content in creation phase but not later on when application opens same file containing embedded PDF objects.
    "Application" means all possible application that has OLE support. I have tried this with three different applications and the behavior is same with all applications. Because of this I assume that application I'm developing does not have bug.

    Hello Sig
    The scanner works with a Windows computer, which proves the device is functional at a cursory level. The drivers are now distributed by Apple and this is an Apple computer. There is no scanning software provided by HP. HP's answer is that Mountain Lion takes care of all of this.  I anticipate that some setting or driver was somehow tweaked since the scanner had been working with Mountain Lion until a few days ago.  The device in question is an Apple product. So, I'm pretty confident that I'm in the right place.
    Regards

  • Acrobat/Indesign does not export correct into the selected output intention (eci_iso_coated_v2_300)

    I use the CS6 suite with Acrobat XI at windows platform.
    When I want to save a file from InDesign as .pdf with output intention eci_iso_coated_v2_300 the result is a .pdf with more than 300% ink coverage.
    I tried to transform the result in Acrobat XI into this standard output intention, but also the result has more than 300 % ink coverage.
    What is the reason of this bug?
    Before with Acrobat X this worked without problems

    Hi Rob,
    I was told the new way to work would be to draw files via Bridge direct into the InDesign file
    and I thought automatically the color would not be changed.
    my colourmanagement setting in bridge for the whole CS6 was  ECI isocoated_V2_300
    The Illustrator file was saved without color profile.
    In this test file I used 3 kinds of black: background of pirate in cmyk 79,34 / 72,78 / 59,38 / 79,88 = ink coverage 291 %
    DÜSSELPIRATEN in “black” (if you would convert this in the file with the cmyk button it would be the same ink-percentage as before
    “e.V.” was set to 100 % k
    I set the preferences for Acrobat from InDesign CS6 as pdf X4 with profile eci isocoatedV2_300 in three ways:
    no color conversion
    convert to profile
    convert to profile keeping existing values
    in all tree files the pirates background has 322 % ink coverage instead of 291 %
    Why does Acrobat convert “black” in the wrong way?  If I click in Illustrator on the 4c button to convert the “black” into 4c it is 291% ink
    Acrobat should come to the same result with all profiles: iso coated V2 and iso coated V2_300
    The same happens also by saving as .pdf X3 or .X1
    The minimum what I expect is, that Acrobat reduces ink coverage for black to 300 %
    I also made test with the new ECI profiles for laminated prints from 2012.
    And with newspaper profiles
    In this case the ink coverage comes below 300 %, but only when I choose convert to profile.
    And then the 100 % k converts to cmyk, what I don’t want to have with text.
    Is there no way to reduce ink coverage below a special percentage without changing Text 100% k
    And is there a bug in Acrobat XI with the ECI IsoCoated_V2_300 Profile? For there is no color reduction below 300 % in all conversion settings.
    I can’t test this with Acrobat X or IX, for my computers with this software don’t run with CS6 64 bit.
    enclosed you find my files
    Kind regards
    Lutz Hanbueckers
    Hanbueckers Werbung GmbH
    Brandsackerstr. 5
    40764 Langenfeld
    P.O. Box 40 02 01
    40242 Düsseldorf
    Tel. +49 02173 1 09 44 - 0
    Fax +49 02173 1 09 44 - 10
    [email protected] <mailto:[email protected]>
    www.hanbueckers.de
    Visit our site
    Steady attractive offers!!!
    HR Düsseldorf B 26 480
    owner Manager: Lutz Hanbueckers
    Von: Rob Day [email protected]
    Gesendet: Samstag, 2. März 2013 04:26
    An: Hanbueckers Werbung
    Betreff: acrobat/Indesign does not export correct into the selected output intention (eci_iso_coated_v2_300)
    Re: acrobat/Indesign does not export correct into the selected output intention (eci_iso_coated_v2_300)
    created by Rob Day <http://forums.adobe.com/people/rob+day> in InDesign - View the full discussion <http://forums.adobe.com/message/5115613#5115613

  • Web page not loading correctly

    This web page does not load correctly in Firefox but is okay in other browsers:
    http://forums.techguy.org/
    Can anyone help please?

    Hi, I don't think it's important to understand the results, it does us no good, other than to know they've made a mistake when designing that page, perhaps just a minor one that affects several thing after that, and that some Browsers can handle or figure out that error.
    A bit like I ask a browser to draw me a map of what's at 1st & James street, and there is no 1st & James, but there is a nearby 1st & Main street, & a 2nd & James, so one browser refuses to draw what's at 1st & James since there is nothing, another draws what's at 1st & Main street, & what's at 2nd & James, figuring that must be what's wanted.
    Bottom line, someone caring for that site needs to fix the error, or you can use a browser that handles that problem.

  • Photoshop Menus/Options not displaying correctly

    I've just installed photoshop cs6 and many of the options are not displaying correctly.  I've included two screenshots as examples.
    I'm running Windows 7 64 bit and Nvidia GeForce GT330M graphics.  I've updated the graphics driver to the latest version which made no difference.
    Any help would be much appreciated as much of the functionality is currently off limits.

    Either you have a bad install of Photoshop, or some other app/utility on your system is messing up basic UI drawing (Windowblinds used to do that).

  • JList not showing images

    Have raised a thread giving details of the problem in Java2D forum
    JList not showing images
    Have anybody experienced this issue? I face this issue only when i use swingworker and only for small images (few kBs). It works fine for large images (More than 1MB files). I use Win 7.
    Regards,
    Sreram

    One, do you say because i set the model each time, sometimes the list is not getting repainted? I didn't say that. It's just good concurrency practice to only manipulate models on the EDT, particularly when SwingWorker easily allows the break up of loading the images in a background thread and updating the model on the EDT through the publish/process methods.
    Will the splitting up of worker as process chunks be of any use? Again it's just a good habit to get into for concurrency reasons.
    As for your repainting issue, try changing this line
    item.setImage(getImagefromFile(f)); to
    item.setImage(new ImageIcon(getImageFromFile(f)).getImage()); The ImageIcon class uses MediaTracker to synchronously load images (you can use your own if you want). If you're getting your images via the Toolkit.createImage# methods, then the images need to be loaded. Usually what happens is the toolkit image will get loaded when first drawn. The component that's doing the drawing gets repainted as more of the image comes in. But in the case of a JList, that component is the cell renderer pane and it doesn't care about repaint() calls. So changing the above line will insure the images are already loaded and ready to draw when first shown. tjacobs01 post reminded me of this.

  • Sorting not working correctly for date field in alv report

    Hi All,
    My report displays many rows also containing date type fields of bldat,budat .
    When I sort the report selecting field of type bldat budat the sorting is not correct for the year.
    Ex:
    Invoice doc dat
    01-25-2011
    01-21-2011
    02-02-2011
    10-25-2010
    11-20-2010
    If I use ascending then it is sorted as :
    Invoice doc dat
    01-21-2011
    01-25-2011
    02-02-2011
    10-20-2010
    10-25-2010
    Why the sorting is not working correct for year.(2010 records should have been first).
    The field wa_tab-bldat is of type char10.
    It is populated as wa_tab-bldat = bsak-bldat.
    Kindly suggest what can be done.

    The field wa_tab-bldat is of type char10
    Then what it does is correct.
    Refer to type datum...it will work

  • 10g exporting to CSV using client_text_io is not working correctly.

    I have an odd issue which i could do with some help with. I run an function that exports to CSV based on an pre defined record group.
    This has been working fine for many months with various customers. Recently a new customer used it and they have 28k rows in his record group and the export is actually not exporting correctly.
    The record group has a record count of 28331.
    The CSV produced has only 3756 in my CSV file. These are the last 3756 records in the Record group so its as if its overwriting the data as it goes yet all smaller datasets work
    FUNCTION fun_export_csv (vgraphid NUMBER, p_filename VARCHAR2)RETURN BOOLEAN IS
      out_file                      client_text_io.file_type; 
         i                                             NUMBER;
      lv_line              VARCHAR2(5000);
    BEGIN
    rg:=populate_group('RG11_EXP');               
    synchronize;
    lv_line:= ('"GIN","Gin Date","PO Num","PO Required Date","Mat Num","Mat Description","Supplier Part No","On Time Delivery(Yes-1, No-0)"');
    client_text_io.put(out_file, lv_line);
    client_text_io.new_line(out_file,1); 
    For i in 1..get_group_row_count('RG11_EXP') Loop--this count is 28331
    lv_line:= ('"'||get_group_number_cell('RG11_EXP.col1', i )                 ||'"'|| ',' ||'"'||
         get_group_date_cell('RG11_EXP.grn_date', i )                 ||'"'|| ',' ||'"'||                                          
         get_group_number_cell('RG11_EXP.po', i )       ||'"'|| ',' ||'"'||
         get_group_date_cell('RG11_EXP.daterqd', i ) ||'"'|| ',' ||'"'||
         get_group_char_cell('RG11_EXP.item_no', i ) ||'"'|| ',' ||'"'||
         get_group_char_cell('RG11_EXP.desc', i )                    ||'"'|| ',' ||'"'||
         get_group_char_cell('RG11_EXP.part_no', i )               ||'"'|| ',' ||'"'||
         get_group_number_cell('RG11_EXP.ontime', i )                    ||'"');
    client_text_io.put(out_file, lv_line);
    client_text_io.new_line(out_file,1); 
    END LOOP;     
    client_text_io.FCLOSE(out_file);
    RETURN TRUE;          

    Hello,
    Try to insert a "synchronize" instruction from time to time:
    i  pls_integer := 1;
    Loop
      If mod(i, 500) = 0 Then
         synchronize;
      End if ;
      i := i + 1 ;
    End loop;
    ...<p>But keep in mind the the CLIENT_TEXT_IO generate a lot of network traffic, so it is better and faster to generate the file on the A.S., then after transfer it to the client machine.</p>
    Francois

  • Microsoft Outlook 2010 The delegates settings were not saved correctly. Cannot activate Send-on-behalf-of list. You do not have sufficient permission to perform this operation on this object.

    I am trying to assign delegation to a user and I receive the following message.
    The delegates settings were not saved correctly.  Cannot activate Send-on-behalf-of list.  You do not have sufficient permission to perform this operation on this object.
    We are using 2010 for the server and client.  There are only specific mailboxes that this is happening for after being migrated from Lotus Notes.  The user can use their mailfile fine however it is just the delegation that appears corrupted somehow. 
    I'm not sure how to fix this.  I have checked the access through the security tab in ad and that looks fine.
    Any help would be appreciated.

    I did some more digging and I solved it.
    This would be the solution:
    In Active Directory Users and Computers
    -Click on VIEW
    -Click on ADVANCE FEATURES  (this is important otherwise you won't see
    the complete list in the next steps)
    -Click on the USERS container
    -Find the problem user's account
    -Right mouse the account and click on PROPERTIES
    -Click on the SECURITY tab
    -In the top box, click on the SELF account
    -In the bottom portion of the screen make sure the READ PERSONAL
    INFORMATION  & WRITE PERSONAL INFORMATION  should both be checked for
    ALLOW
    If you can compare the permissions for 'SELF' with another user you probably should set them accordingly to be safe. I noticed that for the user where setting delegates (SOB) did
    not work, more than those 2 permissions were missing.
    Good luck!
    David

  • Umlauts are not displayed correctly in different programs

    Hello!
    I live in germany, but my locale is set to "en_US.UTF8" because I like to have everything in english.
    I do not have any problems with umlauts on the machine, but when I connect with sFTP oder Samba to it, the umlauts in files are not displayed correctly.
    Look at this example
    The upper word is how it looks in "ssh putty" (=locally on the machine), the bottom one is from "filezilla" (from my windows host)
    This is my locale
    locale
    LANG=en_US.UTF-8
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=
    When I create a file "asd_aöü" locally on the machine (with the help of ssh - putty), it looks fine, but when I connect by samba or filezilla again the umlauts are not displayed correctly.
    Do you understand my problem? What can I do?
    Thanks!
    Last edited by cyberius (2011-02-19 10:12:19)

    Did you check the locale settings on your Windows machine?

Maybe you are looking for

  • Create Chart with Workpoint

    Hi.. sorry I'm newbie here. I'm currently working to develop a chart report for a WorkPoint site. (I'm a bit confused what is the difference between SharePoint and WorkPoint. I assumed, both are same.) What is the best way to create chart report, whe

  • Connect apple tv to mac

    how do i connect my mac to apple tv?

  • Regarding Reporting

    hello, Please tell me the t.codes in FI to see the trial balance , Ageing report for customer and vendor, P&l a/c and b/s point will be given

  • New Computer Cannot Open Old Encrypted Emails

    I have a user that has recently been set up on a new computer copying their .pst from an older system. The previous computer was running Windows 7 32bit w/ Office 10 and the new one is running Windows 7 64 bit w/ Windows 10. The user can open recentl

  • Can't convert PS Album 2 catalog to PSE 8 catalog

    I'm trying to convert a Photoshop Album 2 catalog of about 1,200 items to a Photshop Elements 8 catalog, but in the PSE 8 conversion process the operation stops with the message "The conversion operation failed.  Try repairing the catalog with the so