當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。