java - Fixing the maximum size of a JList and changing the look of empty cells -
i'm working on ui stuff jlist can contain @ 8 items. logically have prevented application adding jlist once has reached it's limit, however, wondering if there way perhaps explicitly set limit on jlist itself. next thing want do, repaint empty cells (up 8 cells @ most) indicate empty slots can filled. i'm trying find way (perhaps extending listui) not involve adding placeholder elements jlist represent empty spaces.
i think simple way implement list model (using defaultlistmodel or abstractlistmodel) idea model have 8 items. of them empty message.
if add new item model can replace empty text specific text item. model keep track how many items added model. if try add more max_items can thow exception or that.
implement defaultlistmodel easy , have lot of samples on internet.
Comments
Post a Comment