javax.swing.JComboBox.setUI()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(236)

本文整理了Java中javax.swing.JComboBox.setUI()方法的一些代码示例,展示了JComboBox.setUI()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComboBox.setUI()方法的具体详情如下:
包路径:javax.swing.JComboBox
类名称:JComboBox
方法名:setUI

JComboBox.setUI介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

JComboBox combo = new JComboBox();
combo.setUI(ColorArrowUI.createUI(combo));

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** Overridden to set a flag used to block the UI from adding a focus
 * listener, and to use an alternate renderer class on GTK look and feel
 * to work around a painting bug in SynthComboUI (colors not set correctly)*/
@Override
public void setUI(ComboBoxUI ui) {
  inSetUI = true;
  try {
    super.setUI(ui);
  } finally {
    inSetUI = false;
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Overridden to set a flag used to block the UI from adding a focus
 * listener, and to use an alternate renderer class on GTK look and feel
 * to work around a painting bug in SynthComboUI (colors not set correctly)*/
public void setUI(ComboBoxUI ui) {
  inSetUI=true;
  try {
    super.setUI(ui);
  } finally {
    inSetUI=false;
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Overridden to set a flag used to block the UI from adding a focus
 * listener, and to use an alternate renderer class on GTK look and feel
 * to work around a painting bug in SynthComboUI (colors not set correctly)*/
public void setUI(ComboBoxUI ui) {
  inSetUI=true;
  try {
    super.setUI(ui);
  } finally {
    inSetUI=false;
  }
}

代码示例来源:origin: stackoverflow.com

JComboBox jc = new JComboBox();
jc.setUI(new CusutomArrowUI());

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

combo.setUI(new BasicComboBoxUI() {
  @Override protected JButton createArrowButton() {
    JButton button = super.createArrowButton();

代码示例来源:origin: stackoverflow.com

//Create the combo box.
JComboBox petList = new JComboBox(intArray);
Color bg = (Color) UIManager.get("ComboBox.background");
Color fg = (Color) UIManager.get("ComboBox.foreground");
UIManager.put("ComboBox.selectionBackground", bg);
UIManager.put("ComboBox.selectionForeground", fg);
petList.setUI(new MetalComboBoxUI());
ComboBoxRenderer renderer = new ComboBoxRenderer();

....

代码示例来源:origin: Exslims/MercuryTrade

public JComboBox getComboBox(String[] child) {
  JComboBox comboBox = new JComboBox<>(child);
  comboBox.setBackground(AppThemeColor.HEADER);
  comboBox.setForeground(AppThemeColor.TEXT_DEFAULT);
  comboBox.setFont(BOLD_FONT.deriveFont(scale * 16f));
  comboBox.setBorder(BorderFactory.createLineBorder(AppThemeColor.BORDER, 1));
  comboBox.setUI(MercuryComboBoxUI.createUI(comboBox));
  return comboBox;
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** Overridden to use CleanComboUI on Metal L&F to avoid extra borders */
@Override
public void updateUI() {
  LookAndFeel lf = UIManager.getLookAndFeel();
  String id = lf.getID();
  boolean useClean = tableUI && (lf instanceof MetalLookAndFeel 
      || "GTK".equals(id) //NOI18N
      || ("Aqua".equals(id) && "10.5".compareTo(System.getProperty("os.version")) <= 0) //NOI18N
      || PropUtils.isWindowsVistaLaF() //#217957
      || "Kunststoff".equals(id)); //NOI18N
  if (useClean) {
    super.setUI(PropUtils.createComboUI(this, tableUI));
  } else {
    super.updateUI();
  }
  if (tableUI & getEditor().getEditorComponent() instanceof JComponent) {
    ((JComponent) getEditor().getEditorComponent()).setBorder(null);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Overridden to use CleanComboUI on Metal L&F to avoid extra borders */
public void updateUI() {
  LookAndFeel lf = UIManager.getLookAndFeel();
  String id = lf.getID();
  boolean useClean = tableUI &&
    (lf instanceof MetalLookAndFeel || 
    "GTK".equals(id) || "Kunststoff".equals(id)); //NOI18N
  
  if (useClean) {
    super.setUI (PropUtils.createComboUI(this, tableUI));
  } else {
    super.updateUI();
  }
  if (tableUI & getEditor().getEditorComponent() instanceof JComponent) {
    ((JComponent) getEditor().getEditorComponent()).setBorder(null);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Overridden to use CleanComboUI on Metal L&F to avoid extra borders */
public void updateUI() {
  LookAndFeel lf = UIManager.getLookAndFeel();
  String id = lf.getID();
  boolean useClean = tableUI &&
    (lf instanceof MetalLookAndFeel || 
    "GTK".equals(id) || "Kunststoff".equals(id)); //NOI18N
  
  if (useClean) {
    super.setUI (PropUtils.createComboUI(this, tableUI));
  } else {
    super.updateUI();
  }
  if (tableUI & getEditor().getEditorComponent() instanceof JComponent) {
    ((JComponent) getEditor().getEditorComponent()).setBorder(null);
  }
}

代码示例来源:origin: stackoverflow.com

setUI(new BasicComboBoxUI() {
 @Override protected JButton createArrowButton() {
  return new JButton() {
super.updateUI();
UIManager.put("ComboBox.squareButton", Boolean.FALSE);
setUI(new BasicComboBoxUI() {
 @Override protected JButton createArrowButton() {
  JButton b = new JButton();

代码示例来源:origin: stackoverflow.com

c.setLayout(new FlowLayout());
c.add(comboBox);
comboBox.setUI(new MyUI());

代码示例来源:origin: stackoverflow.com

comboBox.setUI(new BasicComboBoxUI() {
  @Override
  protected ComboPopup createPopup() {

代码示例来源:origin: org.gdl-lang.gdl-tools/cds-gui-swing

private static void disable(JComboBox comboBox) {
  comboBox.setFocusable(false);
  comboBox.setUI(new DisabledComboUI());
  comboBox.setFont(comboBox.getFont().deriveFont(Font.PLAIN));
  ComboBoxEditor editor = comboBox.getEditor();
  if (editor != null && editor.getEditorComponent() instanceof JTextComponent) {
    ((JTextComponent) editor.getEditorComponent()).setEditable(false);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

private void prepareCustomEditor( Object customEditorObj ) {
  JComboBox comboBox = null;
  if( customEditorObj instanceof DefaultCellEditor ) {
    if( ((DefaultCellEditor)customEditorObj).getComponent() instanceof JComboBox ) {
      comboBox = ( JComboBox ) ((DefaultCellEditor)customEditorObj).getComponent();
    }
  } else if( customEditorObj instanceof JComboBox ) {
    comboBox = ( JComboBox ) customEditorObj;
  }
  if( null != comboBox ) {
    if( !(comboBox.getUI() instanceof CleanComboUI) ) {
      comboBox.setUI( new CleanComboUI( true ) );
      ComboBoxAutoCompleteSupport.install( comboBox );
    }
  }
}

代码示例来源:origin: stackoverflow.com

combo.setUI(ColorArrowUI.createUI(combo));

代码示例来源:origin: org.gdl-lang.gdl-tools/cds-gui-swing

private static void enable(JComboBox component) {
  component.setFocusable(true);
  component.setUI((ComboBoxUI) UIManager.getUI(component));
  ComboBoxEditor editor = component.getEditor();
  if (editor != null && editor.getEditorComponent() instanceof JTextComponent) {
    ((JTextComponent) editor.getEditorComponent()).setEditable(true);
  }
}

代码示例来源:origin: org.gdl-lang.gdl-tools/openehr-utils-gui-swing

private JComboBox getUnitsComboBox() {
  if (unitsComboBox == null) {
    unitsComboBox = new JComboBox<>();
    unitsComboBox.setPreferredSize(new Dimension(70, 20));
    Units units = archetypeManager.getUnits();
    for (String unit : units.getUnits(getIdTemplate(), getIdElement())) {
      unitsComboBox.addItem(unit);
    }
    if (!enableUnits) {
      unitsComboBox.setFocusable(false);
      unitsComboBox.setUI(new DisabledComboUI());
      ComboBoxEditor editor = unitsComboBox.getEditor();
      if (editor != null && editor.getEditorComponent() instanceof JTextComponent) {
        ((JTextComponent) editor.getEditorComponent()).setEditable(false);
      }
    }
  }
  return unitsComboBox;
}

代码示例来源:origin: com.eas.platypus/platypus-js-scalable-widget

((JComboBox) root).setUI(new ScalableComboUI(((JComboBox) root).getUI()));

相关文章

JComboBox类方法