Example usage for javax.swing JComboBox isShowing

List of usage examples for javax.swing JComboBox isShowing

Introduction

In this page you can find the example usage for javax.swing JComboBox isShowing.

Prototype

public boolean isShowing() 

Source Link

Document

Determines whether this component is showing on screen.

Usage

From source file:Main.java

static ImageIcon makeImageIcon(URL url, JComboBox combo, int row) {
    ImageIcon icon = new ImageIcon(url);
    icon.setImageObserver(new ImageObserver() {
        public boolean imageUpdate(Image img, int infoflags, int x, int y, int w, int h) {
            if (combo.isShowing() && (infoflags & (FRAMEBITS | ALLBITS)) != 0) {
                if (combo.getSelectedIndex() == row) {
                    combo.repaint();//  w  w w .j  av  a2 s  .co  m
                }
                BasicComboPopup p = (BasicComboPopup) combo.getAccessibleContext().getAccessibleChild(0);
                JList list = p.getList();
                if (list.isShowing()) {
                    list.repaint(list.getCellBounds(row, row));
                }
            }
            return (infoflags & (ALLBITS | ABORT)) == 0;
        };
    });
    return icon;
}