Package javax.swing

Examples of javax.swing.ListCellRenderer


    removeAll();
    if ((o != null) && (o.getClass().isArray())) {
      Class elementClass = o.getClass().getComponentType();   
      PropertyEditor editor = PropertyEditorManager.findEditor(elementClass);
      Component view = null;
      ListCellRenderer lcr = new DefaultListCellRenderer();
      if (editor != null) {
  if (editor instanceof GenericObjectEditor) {
    ((GenericObjectEditor) editor).setClassType(elementClass);
  }
View Full Code Here


                maybeUpdateLayoutState();
            } catch (Exception e) {
                logger.error(e, e);
            }

            ListCellRenderer renderer = list.getCellRenderer();
            ListModel dataModel = list.getModel();
            ListSelectionModel selModel = list.getSelectionModel();
            if ((renderer == null) || (dataModel.getSize() == 0))
                return;
View Full Code Here

            // if they're not set already.
            if ((fixedCellWidth == -1) || (fixedCellHeight == -1)) {
       
                ListModel dataModel = list.getModel();
                int dataModelSize = dataModel.getSize();
                ListCellRenderer renderer = list.getCellRenderer();
       
                if (renderer != null) {
                    for(int index = 0; index < dataModelSize; index++) {
                        Object value = dataModel.getElementAt(index);
                        Component c = renderer.getListCellRendererComponent(list, value, index, false, false);
                        rendererPane.add(c);
                        Dimension cellSize = c.getPreferredSize();
                        int column = index%columnsPerRow;
                        int row    = index/columnsPerRow;
                        if (fixedCellWidth == -1)
View Full Code Here

            if (fixedCellWidth != -1) {
                maxColumns = width/fixedCellWidth;
            } else {
                ListModel dataModel = list.getModel();
                int nItems = dataModel.getSize();
                ListCellRenderer renderer = list.getCellRenderer();
       
                if (renderer != null) {
                    Dimension[] cellDims = new Dimension[nItems];
                    for(int index = 0; index < nItems; index++) {
                        Object value = dataModel.getElementAt(index);
                        Component c = renderer.getListCellRendererComponent(list, value, index, false, false);
                        rendererPane.add(c);
                        cellDims[index] = c.getPreferredSize();
                    }
   
                    //Reduce until all widhts on all rows fit
View Full Code Here

      if (idx==0) {
        beditmapper.setEnabled(false);
        bdelmapper.setEnabled(false);
      }
     
      cbxmapper.setRenderer(new ListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
          String s = value.toString();
          if (s.length()>18) s = s.substring(0,15) + "...";
          return new JLabel(s);
        }
View Full Code Here

    cbxmapper.setSelectedIndex(0);
    beditmapper.setEnabled(false);
    bdelmapper.setEnabled(false);
    bduplicatemapper.setEnabled(false);
   
    cbxmapper.setRenderer(new ListCellRenderer() {
      public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        String s = value.toString();
        if (s.length()>18) s = s.substring(0,15) + "...";
        return new JLabel(s);
      }
View Full Code Here

        if (idx == 0) {
            beditmapper.setEnabled(false);
            bdelmapper.setEnabled(false);
            bduplicateMapper.setEnabled(false);
        }
        cbxmapper.setRenderer(new ListCellRenderer() {
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                    boolean cellHasFocus) {
                String s = value.toString();
                if (s.length() > 18) {
                    s = s.substring(0, 15) + "...";
View Full Code Here

    public PartitionPanel() {
        initComponents();
        setMinimumSize(new Dimension(50, 90));

        //List renderer
        final ListCellRenderer renderer = new DefaultListCellRenderer() {

            @Override
            public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {

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

  {
    final ComboBoxModel    model      = getComboBoxModel();
    final ComboBoxModel    emptyCBM    = new DefaultComboBoxModel();
    final MultiStateButton  button      = b;
    final JComboBox      ggBlend      = new JComboBox(); // ( pcbm );
    final ListCellRenderer  blendRenderer  = getComboBoxRenderer();
   
    ggBlend.setEditable( true );
    ggBlend.setEditor( new ComboBoxEditor() {
      public Component getEditorComponent() { return button; }
View Full Code Here

  }

  @RunsInCurrentThread
  private @Nullable Component cellRendererComponent(@Nonnull JComboBox comboBox, int index) {
    Object item = comboBox.getItemAt(index);
    ListCellRenderer renderer = comboBox.getRenderer();
    return renderer.getListCellRendererComponent(REFERENCE_JLIST, item, index, true, true);
  }
View Full Code Here

TOP

Related Classes of javax.swing.ListCellRenderer

Copyright © 2018 www.massapicom. 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.