Examples of BasicComboBoxRenderer


Examples of javax.swing.plaf.basic.BasicComboBoxRenderer

        ComboPopup popup = new BasicComboPopup(comboBox);
        ui.setPopup(popup);
        ui.setListBox(popup.getList());
        ui.installListeners();
        comboBox.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
        Dimension listPart = new BasicComboBoxRenderer().getListCellRendererComponent(
                popup.getList(), "", -1, false, false).getPreferredSize();
        Dimension expectedSize = new Dimension(listPart.width + listPart.height + 8,
                listPart.height + 8);
        assertEquals(expectedSize, ui.getMinimumSize(null));
        assertEquals(expectedSize, ui.getCachedMinimumSize());
        ui.setCachedMinimumSize(new Dimension(100, 100));
        assertEquals(ui.getCachedMinimumSize(), ui.getMinimumSize(null));
        comboBox.addItem("aaa");
        listPart = new BasicComboBoxRenderer().getListCellRendererComponent(popup.getList(),
                "aaa", -1, false, false).getPreferredSize();
        expectedSize = new Dimension(listPart.width + listPart.height + 8, listPart.height + 8);
        assertEquals(expectedSize, ui.getMinimumSize(null));
    }
View Full Code Here

Examples of javax.swing.plaf.basic.BasicComboBoxRenderer

                    return false;               

                return !lookAndFeels[selectedIndex].getClassName().equals(MuConfigurations.getPreferences().getVariable(MuPreference.LOOK_AND_FEEL));
      }
        };
        lookAndFeelComboBox.setRenderer(new BasicComboBoxRenderer() {
                @Override
                public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                    JLabel label;

                    label = (JLabel)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
View Full Code Here

Examples of javax.swing.plaf.basic.BasicComboBoxRenderer

        themeComboBox.addActionListener(this);

        // Sets the combobox's renderer.
        lockIcon        = IconManager.getIcon(IconManager.PREFERENCES_ICON_SET, "lock.png");
        transparentIcon = new ImageIcon(new BufferedImage(lockIcon.getIconWidth(), lockIcon.getIconHeight(), BufferedImage.TYPE_INT_ARGB));
        themeComboBox.setRenderer(new BasicComboBoxRenderer() {
                @Override
                public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                    JLabel label;
                    Theme  theme;
View Full Code Here

Examples of javax.swing.plaf.basic.BasicComboBoxRenderer

    fileComboBox.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        sourceFileSelectionChanged();
      }
    });
    fileComboBox.setRenderer(new BasicComboBoxRenderer() {
      private static final long serialVersionUID = -2135703608960229528L;
      public Component getListCellRendererComponent(JList list, Object value,
          int index, boolean isSelected, boolean cellHasFocus) {
        if (isSelected) {
          setBackground(list.getSelectionBackground());
View Full Code Here

Examples of javax.swing.plaf.basic.BasicComboBoxRenderer

     */
    protected ListCellRenderer createRenderer() {
        if (tableCellEditor) {
            return super.createRenderer();
        }
        BasicComboBoxRenderer renderer = new BasicComboBoxRenderer.UIResource();
        renderer.setBorder(UIManager.getBorder("ComboBox.rendererBorder"));
        return renderer;
    }
View Full Code Here

Examples of javax.swing.plaf.basic.BasicComboBoxRenderer

  private final JPanel myPanel = new JPanel(new GridBagLayout());
  private final JComboBox myComboBox = new JComboBox();

  private ComboBoxTableCellEditor() {
    myComboBox.setRenderer(new BasicComboBoxRenderer());
    myComboBox.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        stopCellEditing();
      }
    });
View Full Code Here

Examples of javax.swing.plaf.basic.BasicComboBoxRenderer

        ComboPopup popup = new BasicComboPopup(comboBox);
        ui.setPopup(popup);
        ui.setListBox(popup.getList());
        ui.installListeners();
        comboBox.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
        Dimension listPart = new BasicComboBoxRenderer().getListCellRendererComponent(
                popup.getList(), "", -1, false, false).getPreferredSize();
        Dimension expectedSize = new Dimension(listPart.width + listPart.height + 8,
                listPart.height + 8);
        assertEquals(expectedSize, ui.getMinimumSize(null));
        assertEquals(expectedSize, ui.getCachedMinimumSize());
        ui.setCachedMinimumSize(new Dimension(100, 100));
        assertEquals(ui.getCachedMinimumSize(), ui.getMinimumSize(null));
        comboBox.addItem("aaa");
        listPart = new BasicComboBoxRenderer().getListCellRendererComponent(popup.getList(),
                "aaa", -1, false, false).getPreferredSize();
        expectedSize = new Dimension(listPart.width + listPart.height + 8, listPart.height + 8);
        assertEquals(expectedSize, ui.getMinimumSize(null));
    }
View Full Code Here

Examples of javax.swing.plaf.basic.BasicComboBoxRenderer

    public Object[] getRowForTable() {
        Component component = new TextBoxAndButton(this);
        component.hide();
        // get all the meta data and load the combo
        metaDataCombobox = new JComboBox(filterDomain.getMetaDataNames());
        metaDataCombobox.setRenderer(new BasicComboBoxRenderer() {
            @Override
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                    boolean cellHasFocus) {
                final String displayText = value == null ? "<Please select...>" : value.toString();
                return super.getListCellRendererComponent(list, displayText, index, isSelected, cellHasFocus);
View Full Code Here

Examples of javax.swing.plaf.basic.BasicComboBoxRenderer

      public void actionPerformed(ActionEvent e) {
        sourceFileSelectionChanged();
      }
    });

    fileComboBox.setRenderer(new BasicComboBoxRenderer() {
      public Component getListCellRendererComponent(JList list, Object value,
          int index, boolean isSelected, boolean cellHasFocus) {
        if (isSelected) {
          setBackground(list.getSelectionBackground());
          setForeground(list.getSelectionForeground());
View Full Code Here

Examples of javax.swing.plaf.basic.BasicComboBoxRenderer

  }

  public DisableableComboBox() {
    super();
    setRenderer(new BasicComboBoxRenderer() {
      public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
        if(value != null && !(((Item)value).isEnabled())) {
          component.setEnabled(false);
          component.setForeground(UIManager.getColor("ComboBox.disabledForeground"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.