< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XChoicePeer.java

Print this page


   1 /*
   2  * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 661          * if removable item is non visible and non selected then there is no repaint
 662          */
 663         if (visibled || selected){
 664             repaint();
 665         }
 666     }
 667 
 668     public void removeAll() {
 669         helper.removeAll();
 670         helper.select(-1);
 671         /*
 672          * Fix for 6248016
 673          * After removing the item of the choice we need to reshape unfurled choice
 674          * in order to keep actual bounds of the choice
 675          */
 676         Rectangle r = unfurledChoice.placeOnScreen();
 677         unfurledChoice.reshape(r.x, r.y, r.width, r.height);
 678         repaint();
 679     }
 680 
 681     /**
 682      * DEPRECATED: Replaced by add(String, int).
 683      */
 684     public void addItem(String item, int index) {
 685         add(item, index);
 686     }
 687 
 688     public void setFont(Font font) {
 689         super.setFont(font);
 690         helper.setFont(this.font);
 691     }
 692 
 693     public void setForeground(Color c) {
 694         super.setForeground(c);
 695         helper.updateColors(getGUIcolors());
 696     }
 697 
 698     public void setBackground(Color c) {
 699         super.setBackground(c);
 700         unfurledChoice.setBackground(c);
 701         helper.updateColors(getGUIcolors());
 702         updateMotifColors(c);
 703     }
 704 
 705     public void setDrawSelectedItem(boolean value) {
 706         drawSelectedItem = value;
 707     }


   1 /*
   2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 661          * if removable item is non visible and non selected then there is no repaint
 662          */
 663         if (visibled || selected){
 664             repaint();
 665         }
 666     }
 667 
 668     public void removeAll() {
 669         helper.removeAll();
 670         helper.select(-1);
 671         /*
 672          * Fix for 6248016
 673          * After removing the item of the choice we need to reshape unfurled choice
 674          * in order to keep actual bounds of the choice
 675          */
 676         Rectangle r = unfurledChoice.placeOnScreen();
 677         unfurledChoice.reshape(r.x, r.y, r.width, r.height);
 678         repaint();
 679     }
 680 







 681     public void setFont(Font font) {
 682         super.setFont(font);
 683         helper.setFont(this.font);
 684     }
 685 
 686     public void setForeground(Color c) {
 687         super.setForeground(c);
 688         helper.updateColors(getGUIcolors());
 689     }
 690 
 691     public void setBackground(Color c) {
 692         super.setBackground(c);
 693         unfurledChoice.setBackground(c);
 694         helper.updateColors(getGUIcolors());
 695         updateMotifColors(c);
 696     }
 697 
 698     public void setDrawSelectedItem(boolean value) {
 699         drawSelectedItem = value;
 700     }


< prev index next >