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


Java BasicProgressBarUI类代码示例

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


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

示例1: ProgressSplashScreen

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
public ProgressSplashScreen() {
	super(Toolkit.getDefaultToolkit().getImage(SplashScreen.class.getResource("/splash.png")));

	this.progressBar.setFont(new Font("Arial", 0, 12));
	this.progressBar.setMaximum(100);
	this.progressBar.setBounds(0, this.icon.getIconHeight(), this.icon.getIconWidth(), 20);
	this.progressBar.setString("Downloading launcher updates...");
	this.progressBar.setStringPainted(true);
	this.progressBar.setBackground(Color.BLACK);
	this.progressBar.setForeground(Color.CYAN);
	this.progressBar.setUI(new BasicProgressBarUI() {
		protected Color getSelectionBackground() {
			return Color.cyan;
		}
		
		protected Color getSelectionForeground() {
			return Color.black;
		}
	});
	getContentPane().add(this.progressBar);
	setVisible(true);
}
 
开发者ID:DivergenceBot,项目名称:Bootstrapper,代码行数:23,代码来源:ProgressSplashScreen.java

示例2: FSProgressBar

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
public FSProgressBar() {
    setBorder(BorderFactory.createEmptyBorder());
    setUI(new BasicProgressBarUI() {
        @Override
        public void paint(Graphics g, JComponent component) {
            super.paint(g, component);
            Graphics2D graphics = (Graphics2D) g;
            int dy = (int) ((component.getHeight() - progressHeight) / 2);
            int x1 = paddingX;
            int y1 = dy;
            int width = (int) ((component.getWidth() - 2 * paddingX) * progress);
            int height = (int) progressHeight;
            graphics.setColor(FSProgressBarUI.GRAY_128);
            graphics.fillRect(x1, y1, width, height);
        }
    });
    setIndeterminate(false);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:19,代码来源:FSProgressBar.java

示例3: ColoredProgressBar

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
public ColoredProgressBar(int start, int end) {
    setMinimum(start);
    setMaximum(end);
    setForeground(SystemColor.window);
    setBackground(SystemColor.window);
    setBorder(new EmptyBorder(3, 5, 3, 5));
    Dimension size = new Dimension(300, 20);
    setPreferredSize(size);
    setMaximumSize(size);
    setMinimumSize(size);
    BasicProgressBarUI ui = new BasicProgressBarUI() {

        protected Color getSelectionForeground() {
            return Color.BLACK;
        }

        protected Color getSelectionBackground() {
            return Color.BLACK;
        }
    };
    setUI(ui);
}
 
开发者ID:Torridity,项目名称:dsworkbench,代码行数:23,代码来源:ColoredProgressBar.java

示例4: changeUI

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
private void changeUI() {
	setOpaque(false);
	setUI(new BasicProgressBarUI() {

		@Override
		public void paint(Graphics g, JComponent c) {
			Insets b = TiledHorizontalImageProgressBar.this.getInsets(); // area for border
	        int barRectWidth = TiledHorizontalImageProgressBar.this.getWidth() - (b.right + b.left);
	        int barRectHeight = TiledHorizontalImageProgressBar.this.getHeight() - (b.top + b.bottom);
	        
	        int amountFull = getAmountFull(b, barRectWidth, barRectHeight);
	        g.clipRect(b.left, b.top, amountFull, barRectHeight);
	        TiledImagePainter.paintComponent(TiledHorizontalImageProgressBar.this, g, tileImage);
			g.setClip(null);
		}
	});
}
 
开发者ID:WorldGrower,项目名称:WorldGrower,代码行数:18,代码来源:TiledHorizontalImageProgressBar.java

示例5: changeUI

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
private void changeUI() {
	setUI(new BasicProgressBarUI() {

		@Override
		public void paint(Graphics g, JComponent c) {
			Insets b = TiledVerticalImageProgressBar.this.getInsets(); // area for border
	        int barRectWidth = TiledVerticalImageProgressBar.this.getWidth() - (b.right + b.left);
	        int barRectHeight = TiledVerticalImageProgressBar.this.getHeight() - (b.top + b.bottom);
	        
	        int amountFull = getAmountFull(b, barRectWidth, barRectHeight);
	        
	        g.clipRect(b.left, b.top + barRectHeight - amountFull, barRectWidth, amountFull);
			TiledImagePainter.paintComponent(TiledVerticalImageProgressBar.this, g, tileImage);
			g.setClip(null);
		}
	});
}
 
开发者ID:WorldGrower,项目名称:WorldGrower,代码行数:18,代码来源:TiledVerticalImageProgressBar.java

示例6: init

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
public void init() {
	UIManager.put("ProgressBar.selectionBackground",Color.BLUE);
	UIManager.put("ProgressBar.selectionForeground",Color.WHITE);
	bar = new JProgressBar();
	panel.setLayout(new BorderLayout());
	JPanel container = new JPanel(new BorderLayout());
	bar.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
	bar.setMinimum(0);
	bar.setMaximum(progress.getMaxIterations());
	bar.setUI(new BasicProgressBarUI());
	bar.setStringPainted(true);

	container.add(bar);
	panel.add(container, BorderLayout.CENTER);

	time = System.nanoTime();

	update("init");
}
 
开发者ID:zpankr,项目名称:SmartBetSystem,代码行数:20,代码来源:StatusBarNovo.java

示例7: initComp

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
/**
 * 初始化组件
 */
private void initComp() {

	progress = new JProgressBar();
	progress.setMinimum(0);
	progress.setMaximum(100);
	progress.setStringPainted(true);
	// 字体设置
	progress.setFont(new Font("微软雅黑", Font.PLAIN, 11));
	// 背景设置
	progress.setBackground(Color.WHITE);
	progress.setForeground(new Color(196, 196, 196));
	// 边框设置
	progress.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, new Color(170, 170, 170)));
	// 字体颜色设置
	progress.setUI(new BasicProgressBarUI() {

		protected Color getSelectionBackground() {

			return Color.BLACK;
		}

		protected Color getSelectionForeground() {

			return Color.BLACK;
		}
	});
	this.add(progress);
}
 
开发者ID:gdcpljh,项目名称:APIManager-Java,代码行数:32,代码来源:Loading.java

示例8: CircledProgressBar

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
/**
 * @param model
 */
public CircledProgressBar(final BoundedRangeModel model) {
    eventSender = new ChangeEventSender();
    tooltipFactory = new TooltipTextDelegateFactory(this);
    installPainer();
    setModel(model);
    BasicProgressBarUI.class.getAnnotations();
    updateUI();
    setIndeterminate(false);

}
 
开发者ID:friedlwo,项目名称:AppWoksUtils,代码行数:14,代码来源:CircledProgressBar.java

示例9: updateUI

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
@Override public void updateUI() {
    super.updateUI();
    setUI(new BasicProgressBarUI());
    setStringPainted(true);
    setString("");
    setOpaque(false);
    setBorder(BorderFactory.createEmptyBorder());
}
 
开发者ID:aterai,项目名称:java-swing-tips,代码行数:9,代码来源:MainPanel.java

示例10: MainPanel

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
private MainPanel() {
    super(new BorderLayout());

    BoundedRangeModel model = new DefaultBoundedRangeModel();
    JProgressBar progressBar0 = new JProgressBar(model);

    UIManager.put("ProgressBar.foreground", Color.RED);
    UIManager.put("ProgressBar.selectionForeground", Color.ORANGE);
    UIManager.put("ProgressBar.background", Color.WHITE);
    UIManager.put("ProgressBar.selectionBackground", Color.RED);
    JProgressBar progressBar1 = new JProgressBar(model);

    JProgressBar progressBar2 = new JProgressBar(model);
    progressBar2.setForeground(Color.BLUE);
    progressBar2.setBackground(Color.CYAN.brighter());
    progressBar2.setUI(new BasicProgressBarUI() {
        @Override protected Color getSelectionForeground() {
            return Color.PINK;
        }
        @Override protected Color getSelectionBackground() {
            return Color.BLUE;
        }
    });

    progressBar0.setStringPainted(true);
    progressBar1.setStringPainted(true);
    progressBar2.setStringPainted(true);

    JPanel p = new JPanel(new GridLayout(5, 1));
    p.add(makePanel(progressBar0));
    p.add(makePanel(progressBar1));
    p.add(makePanel(progressBar2));

    JButton button = new JButton("Test start");
    button.addActionListener(e -> {
        if (Objects.nonNull(worker) && !worker.isDone()) {
            worker.cancel(true);
        }
        worker = new BackgroundTask();
        worker.addPropertyChangeListener(new ProgressListener(progressBar0));
        worker.addPropertyChangeListener(new ProgressListener(progressBar1));
        worker.addPropertyChangeListener(new ProgressListener(progressBar2));
        worker.execute();
    });

    Box box = Box.createHorizontalBox();
    box.add(Box.createHorizontalGlue());
    box.add(button);
    box.add(Box.createHorizontalStrut(5));

    addHierarchyListener(e -> {
        if ((e.getChangeFlags() & HierarchyEvent.DISPLAYABILITY_CHANGED) != 0 && !e.getComponent().isDisplayable() && Objects.nonNull(worker)) {
            System.out.println("DISPOSE_ON_CLOSE");
            worker.cancel(true);
            worker = null;
        }
    });
    add(p);
    add(box, BorderLayout.SOUTH);
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setPreferredSize(new Dimension(320, 240));
}
 
开发者ID:aterai,项目名称:java-swing-tips,代码行数:63,代码来源:MainPanel.java

示例11: CellRendererDownloads

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
public CellRendererDownloads() {
    ja_16 = Icons.ICON_TABELLE_EIN;
    nein_12 = Icons.ICON_TABELLE_AUS;
    film_start_tab = Icons.ICON_TABELLE_FILM_START;
    film_start_sw_tab = Icons.ICON_TABELLE_FILM_START_SW;
    download_stop_tab = Icons.ICON_TABELLE_DOWNOAD_STOP;
    download_stop_sw_tab = Icons.ICON_TABELLE_DOWNOAD_STOP_SW;
    download_start_tab = Icons.ICON_TABELLE_DOWNOAD_START;
    download_start_sw_tab = Icons.ICON_TABELLE_DOWNOAD_START_SW;
    download_clear_tab = Icons.ICON_TABELLE_DOWNOAD_CLEAR;
    download_clear_sw_tab = Icons.ICON_TABELLE_DOWNOAD_CLEAR_SW;
    download_del_tab = Icons.ICON_TABELLE_DOWNOAD_DEL;
    download_del_sw_tab = Icons.ICON_TABELLE_DOWNOAD_DEL_SW;
    geoMelden = Boolean.parseBoolean(MVConfig.get(MVConfig.Configs.SYSTEM_GEO_MELDEN));
    Listener.addListener(new Listener(Listener.EREIGNIS_GEO, CellRendererDownloads.class.getSimpleName()) {
        @Override
        public void ping() {
            geoMelden = Boolean.parseBoolean(MVConfig.get(MVConfig.Configs.SYSTEM_GEO_MELDEN));
        }
    });

    progressBar = new JProgressBar(0, 1000);
    progressBar.setStringPainted(true);
    //on OSX the OS provided progress bar looks much better...
    if (!SystemInfo.isMacOSX()) {
        progressBar.setUI(new BasicProgressBarUI() {
            @Override
            protected Color getSelectionBackground() {
                return UIManager.getDefaults().getColor("Table.foreground");
            }

            @Override
            protected Color getSelectionForeground() {
                return Color.white;
            }
        });
    }

    panel = new JPanel(new BorderLayout());
    panel.add(progressBar);

    senderIconCache = new MVSenderIconCache();
}
 
开发者ID:mediathekview,项目名称:MediathekView,代码行数:44,代码来源:CellRendererDownloads.java

示例12: setup

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
private void setup() {

        this.setLayout(new MigLayout("ins 05, gapx 5, align left, "));
        setBackground(new Color(51, 51, 51));
        setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));

        skillLabel = new JLabel("SKILL:");
        rankLabel = new JLabel("RANK:");
        xpLabel = new JLabel("XP:");
        xpToLevelLabel = new JLabel("XP TO LEVEL:");
        xpToLevelBar = new JProgressBar(0);
        xpToLevelBar.setStringPainted(true);

        skill = new JLabel("");
        rank = new JLabel("");
        xp = new JLabel("");
        xpToLevel = new JLabel("");

        skillLabel.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, skillLabel.getFont().getSize()));
        rankLabel.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, rankLabel.getFont().getSize()));
        xpLabel.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, xpLabel.getFont().getSize()));
        xpToLevelLabel.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, xpToLevelLabel.getFont().getSize()));

        skill.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, skillLabel.getFont().getSize()));
        rank.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, rankLabel.getFont().getSize()));
        xp.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, xpLabel.getFont().getSize()));
        xpToLevel.setFont(new Font(skillLabel.getFont().getFontName(), Font.BOLD, xpToLevelLabel.getFont().getSize()));

        skillLabel.setForeground(Color.white);
        rankLabel.setForeground(Color.white);
        xpLabel.setForeground(Color.white);
        xpToLevelLabel.setForeground(Color.white);

        skill.setForeground(Color.white);
        rank.setForeground(Color.white);
        xp.setForeground(Color.white);
        xpToLevel.setForeground(Color.white);
        
       xpToLevelBar.setForeground(Color.green);
       xpToLevelBar.setBackground(Color.red);
       xpToLevelBar.setBorder(BorderFactory.createLineBorder(Color.black));
       xpToLevelBar.setUI(new BasicProgressBarUI());
       
        add(skillLabel, "cell 0 0,spanx ");
        add(rankLabel, "cell 0 1,spanx ");
        add(xpLabel, "cell 0 2, gap 0,spanx");
        add(xpToLevelLabel, "cell 0 3, gap 0,spanx ");

        add(skill, "cell 1 0,spanx, gap 45");
        add(rank, "cell 1 1, spanx, gap 45");
        add(xp, "cell 1 2,spanx, gap 25");
        add(xpToLevel, "cell 1 3, spanx, gap 100");
        add(xpToLevelBar, "cell 0 4,spanx, width 100%  ");
    }
 
开发者ID:bmoyer,项目名称:osrsclient,代码行数:55,代码来源:LevelInfoPanel.java

示例13: paintString

import javax.swing.plaf.basic.BasicProgressBarUI; //导入依赖的package包/类
/**
 * Paints the progress string.
 *
 * @param g Graphics used for drawing.
 * @param x x location of bounding box
 * @param y y location of bounding box
 * @param width width of bounding box
 * @param height height of bounding box
 * @param fillStart start location, in x or y depending on orientation,
 *        of the filled portion of the progress bar.
 * @param amountFull size of the fill region, either width or height
 *        depending upon orientation.
 * @param b Insets of the progress bar.
 */
private void paintString(Graphics g, int x, int y, int width, int height,
		int fillStart, int amountFull, Insets b) 
{
	//* 由Jack Jiang修改:因父类中的本方法是private(其实完全可以弄成protected),而如果要全部把该方法拷贝过来
	//* 则会因它调用了sun的非公开api而使得在不同的java版本里有兼容性问题(就是SwingUtilities2类,在1.5里
	//* 位于com.sun.swing.**而在1.6及1.7里是放在sun.swing里的,而且以后果的版本它还会不会改位置也说不定),
	//* 所以为了兼容性,此处利用反射来非正常的调用父类私有方法paintString(正常情况下子类是调用不到了父类的私有方法的撒)
	ReflectHelper.invokeMethod(BasicProgressBarUI.class, this, "paintString"
			, new Class[]{Graphics.class, int.class, int.class, int.class, int.class, int.class, int.class, Insets.class}
			, new Object[]{g,x,y,width,height,fillStart,amountFull,b});
}
 
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:26,代码来源:BEProgressBarUI.java


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