当前位置: 首页>>代码示例>>Java>>正文


Java MetalComboBoxUI类代码示例

本文整理汇总了Java中javax.swing.plaf.metal.MetalComboBoxUI的典型用法代码示例。如果您正苦于以下问题:Java MetalComboBoxUI类的具体用法?Java MetalComboBoxUI怎么用?Java MetalComboBoxUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MetalComboBoxUI类属于javax.swing.plaf.metal包,在下文中一共展示了MetalComboBoxUI类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import javax.swing.plaf.metal.MetalComboBoxUI; //导入依赖的package包/类
public static void main(String... args) throws Exception {
    SwingUtilities.invokeAndWait(new Runnable() {

        @Override
        public void run() {

            for (UIManager.LookAndFeelInfo lafInfo
                    : UIManager.getInstalledLookAndFeels()) {
                try {
                    UIManager.setLookAndFeel(lafInfo.getClassName());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
                MetalComboBoxUI ui = new MetalComboBoxUI();
                ui.installUI(new JComboBox());
                ui.getBaseline(new JComboBox(), 0, 0);
                ui.getBaseline(new JComboBox(), 1, 1);
                ui.getBaseline(new JComboBox(), 2, 2);
                ui.getBaseline(new JComboBox(), 3, 3);
                ui.getBaseline(new JComboBox(), 4, 4);
            }
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:bug6632953.java

示例2: main

import javax.swing.plaf.metal.MetalComboBoxUI; //导入依赖的package包/类
public static void main(String... args) throws Exception {
    MetalComboBoxUI ui = new MetalComboBoxUI();
    ui.installUI(new JComboBox());
    ui.getBaseline(new JComboBox(), 0, 0);
    ui.getBaseline(new JComboBox(), 1, 1);
    ui.getBaseline(new JComboBox(), 2, 2);
    ui.getBaseline(new JComboBox(), 3, 3);
    ui.getBaseline(new JComboBox(), 4, 4);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:bug6632953.java

示例3: updateUI

import javax.swing.plaf.metal.MetalComboBoxUI; //导入依赖的package包/类
@Override
public void updateUI() {
    ComboBoxUI cui = (ComboBoxUI) UIManager.getUI(this);
    if (cui instanceof MetalComboBoxUI) {
        cui = new MetalTreeComboBoxUI();
    } else if (cui instanceof MotifComboBoxUI) {
        cui = new MotifTreeComboBoxUI();
    } else if (cui instanceof WindowsComboBoxUI) {
        cui = new WindowsTreeComboBoxUI();
    }
    setUI(cui);
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:13,代码来源:JTreeComboBox.java

示例4: ImageComboBox

import javax.swing.plaf.metal.MetalComboBoxUI; //导入依赖的package包/类
/**
 * Create new image combo box
 * 
 * @param parent
 *            newmodelwindow pare t
 * @param imagesName
 *            names of the imates
 * @param imagesText
 *            texts of the imates
 */
public ImageComboBox(NewModelWindow parent, String[] imagesName, String[] imagesText) {
	super(new BorderLayout());
	this.parent = parent;

	// Load images
	images = new ImageIcon[imagesName.length];
	Integer[] intArray = new Integer[imagesName.length];
	for (int i = 0; i < imagesName.length; i++) {
		intArray[i] = new Integer(i);
		images[i] = UIUtil.loadResourceIcon(imagesName[i]);
		if (images[i] != null) {
			images[i].setDescription(imagesText[i]);
		}
	}

	// create JComboBox
	list = new JComboBox<Integer>(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);
	list.setUI(new MetalComboBoxUI());
	list.setBackground(Color.WHITE);
	ComboBoxRenderer renderer = new ComboBoxRenderer(images, imagesText);
	renderer.setPreferredSize(new Dimension(200, 150));
	list.setRenderer(renderer);
	list.setMaximumRowCount(3);
	list.addActionListener(this);

	// Lay out the demo.
	add(list, BorderLayout.PAGE_START);
	setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}
 
开发者ID:noah95,项目名称:ezrlc,代码行数:44,代码来源:ImageComboBox.java

示例5: setComboBoxProperties

import javax.swing.plaf.metal.MetalComboBoxUI; //导入依赖的package包/类
private static<T> void setComboBoxProperties(JComboBox<T> comboBox, ImageInfoReader imageInfoReader) {
	comboBox.setOpaque(false);
	comboBox.setBackground(ColorPalette.FOREGROUND_COLOR);
	comboBox.setForeground(ColorPalette.FOREGROUND_COLOR);
	comboBox.setFont(Fonts.FONT);
	
	comboBox.setUI(new MetalComboBoxUI() {

		@Override
		protected ComboPopup createPopup() {
			return new TiledImageComboPopup( comboBox, imageInfoReader );
		}
	});
}
 
开发者ID:WorldGrower,项目名称:WorldGrower,代码行数:15,代码来源:JComboBoxFactory.java


注:本文中的javax.swing.plaf.metal.MetalComboBoxUI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。