@Override protected Dimension getDefaultSize() { Component rend = new SubstanceDefaultComboBoxRenderer(this.comboBox) .getListCellRendererComponent(listBox, " ", -1, false, false); rend.setFont(this.comboBox.getFont()); return rend.getPreferredSize(); }
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Component res = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); setValue(value); return res; }
/** * Simple constructor. * * @param combo * The associated combo box. */ public SubstanceDefaultComboBoxRenderer(JComboBox combo) { super(); this.combo = combo; // this.setOpaque(true); Insets ins = SubstanceSizeUtils .getListCellRendererInsets(SubstanceSizeUtils .getComponentFontSize(combo)); this .setBorder(new EmptyBorder(ins.top, ins.left, ins.bottom, ins.right)); // // Insets i = b.getBorderInsets(combo); // System.out.println("Combo inner - " + combo.getFont().getSize() +" : // " // + i.top + ", " + i.left + ", " + i.bottom + ", " + i.right); }
ComponentState currState = listUI.getCellState(index, result); if (modelStateInfo == null) { SubstanceColorScheme scheme = getColorSchemeForState(list, index, listUI, currState); Map<ComponentState, StateContributionInfo> activeStates = modelStateInfo .getStateContributionMap(); SubstanceColorScheme colorScheme = getColorSchemeForState( list, index, listUI, currState); if (currState.isDisabled() || (activeStates == null) continue; SubstanceColorScheme scheme = getColorSchemeForState( list, index, listUI, activeState);
/** * Simple constructor. * * @param combo * The associated combo box. */ public SubstanceDefaultComboBoxRenderer(JComboBox combo) { super(); this.combo = combo; // this.setOpaque(true); Insets ins = SubstanceSizeUtils .getListCellRendererInsets(SubstanceSizeUtils .getComponentFontSize(combo)); this .setBorder(new EmptyBorder(ins.top, ins.left, ins.bottom, ins.right)); // // Insets i = b.getBorderInsets(combo); // System.out.println("Combo inner - " + combo.getFont().getSize() +" : // " // + i.top + ", " + i.left + ", " + i.bottom + ", " + i.right); }
ComponentState currState = listUI.getCellState(index, result); if (modelStateInfo == null) { SubstanceColorScheme scheme = getColorSchemeForState(list, index, listUI, currState); Map<ComponentState, StateContributionInfo> activeStates = modelStateInfo .getStateContributionMap(); SubstanceColorScheme colorScheme = getColorSchemeForState( list, index, listUI, currState); if (currState.isDisabled() || (activeStates == null) continue; SubstanceColorScheme scheme = getColorSchemeForState( list, index, listUI, activeState);
@Override protected Dimension getDefaultSize() { Component rend = new SubstanceDefaultComboBoxRenderer(this.comboBox) .getListCellRendererComponent(listBox, " ", -1, false, false); rend.setFont(this.comboBox.getFont()); return rend.getPreferredSize(); }