Package javax.swing

Examples of javax.swing.DefaultListCellRenderer$UIResource


  public GenericCellRenderer()
  {
    tableCellRenderer = new DefaultTableCellRenderer();
    tableCellRenderer.putClientProperty("html.disable", Boolean.TRUE);

    listCellRenderer = new DefaultListCellRenderer();
    listCellRenderer.putClientProperty("html.disable", Boolean.TRUE);
  }
View Full Code Here


  public ComponentListCellRenderer(final Class aComponentType)
  {
    try
    {
      setLayout(new BorderLayout());
      defaultComp = new DefaultListCellRenderer();
      abstractButton = (AbstractButton) aComponentType.newInstance();
      add(abstractButton);
    }
    catch (Exception e)
    {
View Full Code Here

                if (enabled.project == null) {
                    combo.setSelectedIndex(0);
                } else {
                    combo.setSelectedIndex(enabled.project ? 2 : 1);
                }
                combo.setRenderer(new DefaultListCellRenderer() {
                    @Override
                    public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                        if (index == -1) {
                            if (value.equals("DEFAULT")) {
                                value = "Default";
View Full Code Here

        final List<String> userDesignationKeys = I18N.instance().getUserDesignationKeys(true);
        for (final String designation : userDesignationKeys) {
            designationCombo.addItem(I18N.instance().getUserDesignation(designation));
        }
        designationCombo.addItem(null);
        designationCombo.setRenderer(new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                    boolean cellHasFocus) {
                Component real = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                if (value == null) {
View Full Code Here

    public DeviceChooser() {
        initComponents();
        Global g = Global.getGlobal();
       
        serialPortList.setModel(new DefaultComboBoxModel(Global.getGlobal().getPorts().toArray()));
        serialPortList.setRenderer(new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                if(comp instanceof JLabel && value instanceof SerialPort) {
                    JLabel label = (JLabel) comp;
                    SerialPort port = (SerialPort) value;
                    label.setText(port.shortName);
                }
                return comp;
            }
        });
       
        deviceList.setModel(new DefaultComboBoxModel(Global.getGlobal().getDevices().toArray()));
        deviceList.setCellRenderer(new DefaultListCellRenderer(){
            @Override
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                if(comp instanceof JLabel && value instanceof Device) {
                    JLabel label = (JLabel) comp;
View Full Code Here

        KeyboardUtils.setup(pane,actions);
       
       
        List<Device> boards = new ArrayList<>(Global.getGlobal().getDevices());
        boardDropdown.setModel(new DefaultComboBoxModel(boards.toArray()));
        boardDropdown.setRenderer(new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                if(comp instanceof JLabel && value instanceof Device) {
                    JLabel label = (JLabel) comp;
                    Device device = (Device) value;
                    label.setText(device.getName());
                }
                return comp;
            }
        });
        if(actions.sketch.getCurrentDevice() == null) {
            actions.sketch.setCurrentDevice(Global.getGlobal().getDevices().get(0));
        }
        boardDropdown.setSelectedItem(actions.sketch.getCurrentDevice());
       
        List<SerialPort> ports = Global.getGlobal().getPorts();
        portDropdown.setModel(new DefaultComboBoxModel(ports.toArray()));
        portDropdown.setRenderer(new SerialPortComboBoxRenderer());
        if(actions.sketch.getCurrentPort() == null && !Global.getGlobal().getPorts().isEmpty()) {
            actions.sketch.setCurrentPort(Global.getGlobal().getPorts().get(0));
        }
        if(actions.sketch.getCurrentPort() != null) {
            actions.sketch.getCurrentPort().addListener(this);
        }
       
        rebuildWindowMenu();
        //register to listen for changes
        Global.getGlobal().addPropertyChangeListener("sketches", new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                rebuildWindowMenu();
            }
        });
       
        //set sizing so that we can open and close the split pane
        consoleTabPane.setMinimumSize(new Dimension());
        helpScroll.setMinimumSize(new Dimension());
       
        try {
            String helptext = Util.toString(getClass().getResource("resources/cheatsheet.html"));
            helpPane.setText(helptext);
        } catch (IOException ex) {
            Logger.getLogger(EditorWindow.class.getName()).log(Level.SEVERE, null, ex);
        }
       
       

        serialRateCombo.setModel(new DefaultComboBoxModel(Global.SERIAL_RATE_STRINGS));
        try {
        int rate = actions.sketch.getSerialRate();
        int n = Arrays.binarySearch(Global.SERIAL_RATE_INTS, rate);
        serialRateCombo.setSelectedIndex(n);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        autoScroll.setSelected(actions.sketch.isAutoScroll());
       
        examplesList.setCellRenderer(new DefaultListCellRenderer() {
            @Override
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                Component comp = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
                if(value != null && value instanceof Example) {
                    Example ex = (Example) value;
View Full Code Here

public class PlayerCellRenderer implements ListCellRenderer<Player> {

  private final DefaultListCellRenderer renderer;

  public PlayerCellRenderer() {
    renderer = new DefaultListCellRenderer();
  }
View Full Code Here

public class PluginCellRenderer implements ListCellRenderer<PluginInfo> {

  private final DefaultListCellRenderer renderer;

  public PluginCellRenderer() {
    renderer = new DefaultListCellRenderer();
  }
View Full Code Here

        });

        endEntitiesComboBox.setModel(new DefaultComboBoxModel(endEntities));

        endEntitiesComboBox.setRenderer(new DefaultListCellRenderer() {

            @Override
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
                final Component component =
                        super.getListCellRendererComponent(list, value, index,
View Full Code Here

            @Override
            public Object getElementAt(int index) {
                return certificates.get(index);
            }
        });
        chainList.setCellRenderer(new DefaultListCellRenderer() {

            @Override
            public Component getListCellRendererComponent(final JList list, Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
                if (value instanceof X509Certificate) {
                    final X509Certificate cert = (X509Certificate) value;
                    value = cert.getSubjectDN().getName();
                }
                return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            }

        });
        chainList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

            @Override
            public void valueChanged(final ListSelectionEvent evt) {
                if (!evt.getValueIsAdjusting()) {
                    viewCertificate((X509Certificate)
                            chainList.getSelectedValue());
                }
            }
        });

        fieldsList.setCellRenderer(new DefaultListCellRenderer() {

            @Override
            public Component getListCellRendererComponent(final JList list, Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
                if (value instanceof Field) {
                    value = ((Field) value).getName();
View Full Code Here

TOP

Related Classes of javax.swing.DefaultListCellRenderer$UIResource

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.