Java Code Examples for javax.swing.JProgressBar#setBorderPainted()

The following examples show how to use javax.swing.JProgressBar#setBorderPainted() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JComponentBuilders.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void setupInstance(JProgressBar instance) {
    super.setupInstance(instance);
    
    instance.setBorderPainted(paintBorder);
    if (model != null) instance.setModel(model.createInstance());
    if (progressString != null) instance.setString(progressString);
    instance.setStringPainted(paintString);
    instance.setIndeterminate(indeterminate);
}
 
Example 2
Source File: JComponentBuilders.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
protected void setupInstance(JProgressBar instance) {
    super.setupInstance(instance);
    
    instance.setBorderPainted(paintBorder);
    if (model != null) instance.setModel(model.createInstance());
    if (progressString != null) instance.setString(progressString);
    instance.setStringPainted(paintString);
    instance.setIndeterminate(indeterminate);
}
 
Example 3
Source File: Launcher.java    From rscplus with GNU General Public License v3.0 5 votes vote down vote up
/** Renders the launcher progress bar window, then calls {@link #run()}. */
public void init() {
  Logger.start();
  Logger.Info("Starting rscplus");

  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  getContentPane().setBackground(Color.BLACK);

  // Set window icon
  URL iconURL = Settings.getResource("/assets/icon.png");
  if (iconURL != null) {
    icon = new ImageIcon(iconURL);
    setIconImage(icon.getImage());
  }
  iconURL = Settings.getResource("/assets/icon_warn.png");
  if (iconURL != null) {
    icon_warn = new ImageIcon(iconURL);
  }

  // Set size
  getContentPane().setPreferredSize(new Dimension(280, 32));
  setTitle("rscplus Launcher");
  setResizable(false);
  pack();
  setLocationRelativeTo(null);

  // Add progress bar
  m_progressBar = new JProgressBar();
  m_progressBar.setStringPainted(true);
  m_progressBar.setBorderPainted(true);
  m_progressBar.setForeground(Color.GRAY.brighter());
  m_progressBar.setBackground(Color.BLACK);
  m_progressBar.setString("Initializing");
  getContentPane().add(m_progressBar);

  setVisible(true);
  new Thread(this).start();
}
 
Example 4
Source File: TimerFrame.java    From training with MIT License 5 votes vote down vote up
public TimerFrame() {
	setUndecorated(true);
	getContentPane().setBackground(Color.lightGray);
	setShape(new RoundRectangle2D.Double(0, -20, GlobalSettings.WIDTH/2, 44, 20, 20));
	setSize(GlobalSettings.WIDTH/2, 24);
	setLocation(getX(), 0);
	horizontalPositioner.tick();
	setAlwaysOnTop(true);
	setFocusable(false);
	setType(Type.UTILITY);
	setFocusableWindowState(false);

	getContentPane().setLayout(new BorderLayout());
	
	progressBar = new JProgressBar();
	progressBar.setForeground(Color.lightGray);
	progressBar.setBackground(Color.GREEN);
	progressBar.setString("1 min");
	progressBar.setStringPainted(true);
	progressBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
	progressBar.setBorderPainted(false);
	progressBar.setValue(50);
	progressBar.setFont(new Font("Consolas", Font.BOLD, 19));
	progressBar.addMouseListener(new ProgressMouseListener());
	progressBar.setCursor(new Cursor(Cursor.HAND_CURSOR));
	getContentPane().add(progressBar);
}
 
Example 5
Source File: LabeledProgressBar.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
public LabeledProgressBar() {

    setLayout(new OverlayLayout(this));

    label = new JLabel();
    label.setAlignmentX(0.5f);
    label.setFont(label.getFont().deriveFont(11f));
    add(label);

    progressBar = new JProgressBar(0, 100);
    progressBar.setBorderPainted(false);
    add(progressBar);

  }
 
Example 6
Source File: ShowProgressBar.java    From CEC-Automatic-Annotation with Apache License 2.0 5 votes vote down vote up
public ShowProgressBar() {

		// 创建标签,并在标签上放置一张图片
		// label = new JLabel(new ImageIcon("images/background.jpg"));
		label = new JLabel("数据正在处理中,请稍后... ...", SwingConstants.CENTER);
		label.setFont(new Font("华文楷体", Font.ITALIC, 30));
		label.setBounds(0, 0, LOAD_WIDTH, LOAD_HEIGHT - 25);
		label.setBackground(new Color(204, 0, 1));// 背景色设置之后无效,不知道为何
		label.setForeground(new Color(69, 133, 243));
		// 创建进度条
		progressbar = new JProgressBar();
		// 显示当前进度值信息
		progressbar.setStringPainted(true);
		// 设置进度条边框不显示
		progressbar.setBorderPainted(false);
		// 设置进度条的前景色,即进度条的颜色
		progressbar.setForeground(new Color(153, 230, 40));
		// 设置进度条的背景色,即进度条的背景色
		progressbar.setBackground(new Color(27, 27, 24));
		progressbar.setBounds(0, LOAD_HEIGHT - 15, LOAD_WIDTH, 15);
		// 添加组件
		this.add(label);
		this.add(progressbar);
		// 设置布局为空
		this.setLayout(null);
		// 设置窗口初始位置
		this.setLocation((WIDTH - LOAD_WIDTH) / 2, (HEIGHT - LOAD_HEIGHT) / 2);
		// 设置窗口大小
		this.setSize(LOAD_WIDTH, LOAD_HEIGHT);
		// 设置窗口显示
		this.setVisible(true);

	}
 
Example 7
Source File: UpdateIDE.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public ProgressBar() {
     frame = new JFrame("APICloud Studio\u66F4\u65B0\u7BA1\u7406\u5668");
     frame.setBounds(100, 100, 400, 130);
     frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
     frame.setResizable(false);
     Image image= null;
try {
  	InputStream is=UpdateIDE.class.getResourceAsStream("32_32.png");    
	image = ImageIO.read(is);
} catch (IOException e) {
	e.printStackTrace();
}
if(image != null) {
	frame.setIconImage(image);
}

     Container contentPanel = frame.getContentPane();
     JLabel label_txt = new JLabel("\u7A0B\u5E8F\u66F4\u65B0\u4E2D\uFF0C\u8BF7\u4E0D\u8981\u624B\u52A8\u542F\u52A8APICloud Studio\u4EE5\u514D\u66F4\u65B0\u5931\u8D25\uFF01", JLabel.CENTER);
    
     label_txt.setForeground(Color.red);
     label = new JLabel("", JLabel.CENTER);
     progressbar = new JProgressBar();
     progressbar.setOrientation(JProgressBar.HORIZONTAL);
     progressbar.setMinimum(0);
     progressbar.setMaximum(100);
     progressbar.setValue(0);
     progressbar.setStringPainted(true);
     progressbar.addChangeListener(this);
     progressbar.setPreferredSize(new Dimension(300, 20));
     progressbar.setBorderPainted(true);
     progressbar.setBackground(Color.green);

     timer = new Timer(700, this);
     contentPanel.add(label_txt, BorderLayout.NORTH);
     contentPanel.add(label, BorderLayout.CENTER);
     contentPanel.add(progressbar, BorderLayout.SOUTH);
     frame.setVisible(true);
     timer.start();
  }
 
Example 8
Source File: StartupHelper.java    From javamoney-examples with Apache License 2.0 4 votes vote down vote up
/**
 * This method runs the program's startup process.
 */
public
static
void
runStartup()
{
  JFrame splash = createSplash();
  Panel panel = (Panel)splash.getContentPane();
  JProgressBar progress = new JProgressBar(0, 4);
  long timeTaken = System.currentTimeMillis();

  // Build panel.
  panel.add(getProperty("StartupHelper.loading"), 0, 0, 1, 1, 0, 50);

  panel.setFill(GridBagConstraints.HORIZONTAL);
  panel.add(progress, 0, 1, 1, 1, 100, 50);

  panel.setBorder(new SoftBevelBorder(BevelBorder.RAISED));
  panel.setInsets(new Insets(5, 10, 5, 10));

  // Show frame.
  splash.setVisible(true);

  // Do all startup processes and update progress bar after each action.
  progress.setBorderPainted(true);
  progress.setStringPainted(true);

  ApplicationProperties.read();
  progress.setValue(1);

  if(passwordRequired() == true)
  {
    checkPassword(splash);
  }

  if(useDefaultDataFile() == true)
  {
    if(getFileMap().get(DATA).exists() == true)
    {
      DataManager.read();
    }
    else
    {
      createStarterKit();
    }
  }
  else
  {
    DataManager.read(getDataFile(), true, passwordRequired());
  }

  progress.setValue(2);

  doPreStartupProcesses();
  progress.setValue(3);

  // Finish off the progress bar and dispose the splash.
  progress.setValue(4);

  timeTaken = System.currentTimeMillis() - timeTaken;

  try
  {
    // Sleep to see the splash if the time taken is less than 2.5 seconds.
    long sleep = 2500 - timeTaken;

    if(sleep > 0)
    {
      Thread.sleep(sleep);
    }
  }
  catch(InterruptedException interruptedException)
  {
    // Ignored.
  }

  splash.dispose();
}