JFrame repaint(); How to update the JFrame with Thread info? - java

I was trying to set up a simple time ticker on a JFrame. I am able to display the initial value of counter, but any subsequent change doesn't update on the JFrame. Any nudge towards an answer to what I am doing wrong would be appreciated. I think it is a problem of repaint() not getting called, but I either end up with errors, or nothing if I try putting it in.
package com.game.ryan;
import java.awt.Dimension;
import javax.swing.JFrame;
class Screen extends JFrame{
private Dimension d = new Dimension(800,600);
private JFrame f;
public Screen(){
f = new JFrame();
f.setIgnoreRepaint(false);
f.setResizable(false);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setMinimumSize(d);
f.setLocationRelativeTo(null);
f.add(new MyPanel());
f.pack();
f.setVisible(true);
}
public static void main(String[] args){
Screen s = new Screen();
}
}
I also have:
package com.game.ryan;
import java.awt.Graphics;
import javax.swing.JPanel;
public class MyPanel extends JPanel{
private OneThread ot = new OneThread();
private int counter = ot.getThreadCounter();
public MyPanel(){
Thread t1 = new Thread(new OneThread());
t1.start();
}
public void paintComponent(Graphics g){
g.drawString("TIME: ", 10, 20);
g.drawString(Integer.toString(counter), 50, 20);
}
}
and finally
package com.game.ryan;
public class OneThread implements Runnable{
private int counter = 45;
public OneThread(){
}
#Override
public void run() {
for(int x = 0; x >= 0; x++){
try{
Thread.sleep(1000);
counter++;
x++;
System.out.println(counter);
}catch(Exception e){
e.printStackTrace();
}
}
}
public int getThreadCounter(){
return counter;
}
}
I am getting an increasing counter on the console so I guess that part is working correctly.
Expected result was for the counter to display correctly in the JFrame (updating every 1000ms).

I don't see anywhere you tell the UI it should update itself.
You're also going a long way out of your way to replicate what is already available within the APIs.
Swing and threads need careful consideration. Swing uses a single threaded model for managing all the updates to the UI. It is expected that all iterations with the UI will be done within the context of the thread (AKA The Event Dispatching Thread).
This means any time you want to create or update the UI from any other thread, you need to synchronize the calls back to the EDT.
While there are a number of ways to achieve this, the simplest in your case in the use of javax.swing.Timer
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class LabelClock {
public static void main(String[] args) {
new LabelClock();
}
protected static final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm.ss");
private JLabel clock;
public LabelClock() {
EventQueue.invokeLater(new Runnable() {
#Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
}
clock = new JLabel();
tick();
JFrame frame = new JFrame("Testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new GridBagLayout());
frame.add(clock);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Timer timer = new Timer(500, new ActionListener() {
#Override
public void actionPerformed(ActionEvent e) {
tick();
}
});
timer.setRepeats(true);
timer.setCoalesce(true);
timer.start();
}
});
}
protected void tick() {
clock.setText(DATE_FORMAT.format(new Date()));
}
}

You may wish to re-think your design:
A primitive variable holds a value and that's it. If you assign the value held by the primitive to another variable, changing the original variable later will have no effect on the value held by the other variable. For instance, nothing in your code changes value held by the counter variable held by the JPanel.
Note that even if your plan were successful, you have two completely independent OneThread objects, and that changing the state of one will have no effect on the other.
Better to have your GUI listen for changes to a variable and then have your thread change the state of the variable and then notify all listeners of this change. A PropertyChangeListener could work well for this.
Note that a Swing Timer would be much easier to implement then a background thread.

Related

How do I call a method from an action listener without the JFrame freezing and waiting for the action listener to complete?

How do I set the text of a JTextArea while its JFrame is running, and refresh the JFrame to show the change, from another class?
I have a JFrame with a JTextArea which acts as a log, and the string it prints i update periodically with new activity from another class. My JFrame class (EnablePage) looks like this:
package bot;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JButton;
import javax.swing.JLabel;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class EnablePage extends JFrame {
public static String enablePane;
private static JPanel contentPane;
public static JTextArea txtrHello = new JTextArea();
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
EnablePage frame = new EnablePage();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public EnablePage() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 594, 474);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setToolTipText("");
scrollPane.setBounds(6, 89, 582, 357);
contentPane.add(scrollPane);
txtrHello.setEditable(false);
txtrHello.setText(enablePane);
txtrHello.setWrapStyleWord(true);
txtrHello.setLineWrap(true);
scrollPane.setViewportView(txtrHello);
JButton btnNewButton = new JButton("Enable");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
navigator.navigator();
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
btnNewButton.setBounds(59, 29, 117, 29);
contentPane.add(btnNewButton);
}
public static void update(String x) {
txtrHello.setText(enablePane+"\n"+x);
}
}
And from my navigator class I've been trying to use this line of code to update the JtextArea, while it manipulates a website. This code I didn't include, but replaced here with "Thread.sleep(100000);" to illustrate the problem:
package bot;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JOptionPane;
public class navigator {
public static DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy(HH:mm:ss)");
public static void navigator() throws Exception {
Date date1 = new Date();
Thread.sleep(100000);
EnablePage.update("Bot enabled: "+dateFormat.format(date1));
}
}
However this is not updating the JFrame with the new text, because the EnablePage class is stuck waiting for the navigator() method to complete. What ends up happening is the Enable button stays blue because the actionlistener method is never broken from, because the nagivator() method never finished. What can I do to still call navigator() from the enable button but not have the EnablePage class freeze on this line?
Here's a simple example. A clock JTextField is updated from a Thread.
As you can see, there are no update, validate, or invalidate method calls.
Edited to add: The calls to the SwingUtilities invokeLater method are important, to ensure that the Swing components are created and updated on the Event Dispatch thread (EDT).
I also modified the Clock example to stop the Timer thread cleanly before disposing of the JFrame.
package com.ggl.testing;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
public class Clock implements Runnable {
private JFrame frame;
private JTextField clockDisplay;
private Timer timer;
#Override
public void run() {
frame = new JFrame("Clock");
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
#Override
public void windowClosing(WindowEvent event) {
exitProcedure();
}
});
JPanel panel = new JPanel();
clockDisplay = new JTextField(12);
clockDisplay.setEditable(false);
clockDisplay.setHorizontalAlignment(JTextField.CENTER);
panel.add(clockDisplay);
frame.add(panel);
frame.pack();
frame.setLocationByPlatform(true);
frame.setVisible(true);
timer = new Timer(this);
new Thread(timer).start();
}
public void exitProcedure() {
timer.setRunning(false);
frame.dispose();
System.exit(0);
}
public void setText(String text) {
clockDisplay.setText(text);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Clock());
}
public class Timer implements Runnable {
private volatile boolean running;
private Clock clock;
private SimpleDateFormat timeFormat;
public Timer(Clock clock) {
this.clock = clock;
this.running = true;
this.timeFormat = new SimpleDateFormat("h:mm:ss a");
}
#Override
public void run() {
while (running) {
displayTime();
sleep();
}
}
public void displayTime() {
Calendar calendar = Calendar.getInstance();
Date date = calendar.getTime();
final String s = timeFormat.format(date);
SwingUtilities.invokeLater(new Runnable() {
#Override
public void run() {
clock.setText(s);
}
});
}
public void sleep() {
try {
Thread.sleep(200L);
} catch (InterruptedException e) {
}
}
public synchronized void setRunning(boolean running) {
this.running = running;
}
}
}
JTextArea#append will allow you to append text to the JTextArea, both setText and append are bound methods, this means that they will trigger an update when they are called so you shouldn't need to do anything more. If it's not updating then it sounds like you have a reference issue.
You should consider providing a fully runnable example which demonstrates your problem. This will result in less confusion and better responses
You should avoid the use of static, especially when associated with UI components, as this really begins to give you trouble with what you are referencing and what's on the screen. static is NOT a cross communication mechanism for objects and shouldn't be used as such.
If you can, you should define some kind of interface which describes the actions which be executed on your log frame (ie addLog(String)), have your log frame implement this interface and then pass a reference of it to those classes that need it.
Alternatively, you could use a singleton pattern to allow your log window to be accessed from any where in your application, personally, I'd be tempted to devise a queue of some kind, where other classes pushed log events onto this (singleton) queue and you had your frame either poll it or use some kind of blocking queue mechanism to monitor for changes to the queue. This would require you to have a separate Thread (or SwingWorker) which monitored the queue in the background so you don't block the Event Dispatching Thread.
Avoid using null layouts, pixel perfect layouts are an illusion within modern ui design. There are too many factors which affect the individual size of components, none of which you can control. Swing was designed to work with layout managers at the core, discarding these will lead to no end of issues and problems that you will spend more and more time trying to rectify
Updated
Your runnable example works for me, more or less. Your reliance on static is worrying and Thread.sleep(100000); will block the Event Dispatching Thread, making your program look like it's hung (cause it has). The following is reworked version of your example, without null layouts, without static and using a Swing Timer instead of Thread.sleep. The great thing about this, is once you press the "Enable" button, the timer will update the text area every second...
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.Timer;
public class EnablePage extends JFrame {
private JTextArea txtrHello = new JTextArea(10, 20);
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
EnablePage frame = new EnablePage();
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public EnablePage() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new BorderLayout());
JScrollPane scrollPane = new JScrollPane(txtrHello);
scrollPane.setToolTipText("");
add(scrollPane);
txtrHello.setEditable(false);
txtrHello.setWrapStyleWord(true);
txtrHello.setLineWrap(true);
JButton btnNewButton = new JButton("Enable");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Navigator.navigator(EnablePage.this);
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
add(btnNewButton, BorderLayout.NORTH);
}
public void update(String x) {
System.out.println("Update " + x + "\n");
txtrHello.append(x);
}
public static class Navigator {
public static DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy(HH:mm:ss)");
public static void navigator(EnablePage page) throws Exception {
Timer timer = new Timer(1000, new ActionListener() {
#Override
public void actionPerformed(ActionEvent e) {
Date date1 = new Date();
page.update("Bot enabled: " + dateFormat.format(date1));
}
});
timer.start();
}
}
}

Counter on JFrame

I am trying to make a JFrame and see the progress of the counter.
int i = 1;
while (i < 100000){
textField.setText(String.valueOf(i));
System.out.println(i);
i++;
}
When I start it I can see the progress at the console but the value of the textField does not change. It changes to 100000 when the loop ends.
How can I make it show the progress like in console?
There are a number of important differences between and other GUI toolkits like C#.
Firstly, Swing components SHARE a common native peer. In many other GUI frameworks, components have their own native peer, this affects the context in which how you can access these components.
Secondly, because Swing components share a common native peer, there are inherently un-thread safe (they all share the same message queue for example), this means you should never modify a UI component out side of the context of the Event Dispatching Thread.
Thirdly, you should never block the Event Dispatching Thread, this will prevent it from process new events, including paint requests.
In this context, you should should probably use s a javax.swing.Timer, which will allow you to schedule a callback (which will occur within the context of the EDT) at a regular interval, making it safe to use within the context of the Swing framework, for example...
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class Counter {
public static void main(String[] args) {
new Counter();
}
public Counter() {
EventQueue.invokeLater(new Runnable() {
#Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
}
JFrame frame = new JFrame("Testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new BorderLayout());
frame.add(new TestPane());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
public class TestPane extends JPanel {
private JLabel label;
private Timer timer;
private int count;
public TestPane() {
label = new JLabel("...");
setLayout(new GridBagLayout());
add(label);
timer = new Timer(500, new ActionListener() {
#Override
public void actionPerformed(ActionEvent e) {
count++;
if (count < 100000) {
label.setText(Integer.toString(count));
} else {
((Timer)(e.getSource())).stop();
}
}
});
timer.setInitialDelay(0);
timer.start();
}
#Override
public Dimension getPreferredSize() {
return new Dimension(200, 200);
}
}
}
Take a look at Concurreny in Swing and How to Use Swing Timers for more details...

Java Swing JButton Time Delays (Flicker)

I am trying to make my JButton flicker red for this game I am creating. All the solutions on this website suggest using a thread and putting it to sleep or using a timer, however, the pause allays seems to come after the color change
Here is my code:
Color cb = board[Y1][X1].getBackground();
board[Y1][X1].setBackground(Color.RED);
//Pause
board[Y1][X1].setBackground(cb);
If I put a thread and put it to sleep on line 3 and comment out line 4 the pause will come before the JButton is turned red. (Note board is just a 2D array of JButtons)
There are any number reasons why this might be occurring and equally, any number of ways it might be fixed.
Based on your description, it sounds like you're trying to update the UI from outside of the Event Dispatching Thread.
Swing is a single thread environment, it's also not thread safe. Basically what this means is, there is an expectation that all interactions/changes to the UI are carried out within the context of the EDT. Failing to following this rule can lead to all sorts of weird and wonderful behaviour.
The simplest solution is to use a javax.swing.Timer, which allows you to schedule regular timed events which are guaranteed to be executed within the EDT, for example
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class FlashyButton {
public static void main(String[] args) {
new FlashyButton();
}
public FlashyButton() {
EventQueue.invokeLater(new Runnable() {
#Override
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
}
JFrame frame = new JFrame("Testing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new TestPane());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
});
}
public class TestPane extends JPanel {
private JButton button;
private Color[] colors = new Color[]{Color.RED, Color.YELLOW};
public TestPane() {
button = new JButton("Flash Gorden");
button.setContentAreaFilled(false);
button.setBorderPainted(false);
button.setFocusPainted(false);
button.setOpaque(true);
button.setBackground(Color.YELLOW);
setLayout(new GridBagLayout());
add(button);
Timer timer = new Timer(500, new ActionListener() {
private int counter = 0;
#Override
public void actionPerformed(ActionEvent e) {
counter++;
if (counter % 2 == 0) {
button.setBackground(colors[0]);
} else {
button.setBackground(colors[1]);
}
}
});
timer.start();
}
#Override
public Dimension getPreferredSize() {
return new Dimension(200, 200);
}
#Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g.create();
g2d.dispose();
}
}
}
Take a look at Concurrency in Swing and How to Use Swing Timers for more details.
A more complex solution would allow you to use a Thread, but would require to update the UI by using SwingUtilities.invokeLater, which would place an event onto the EDT that would execute a Runnable interface, which you would use to update the UI. This could have synchronisation issues as the Thread you're calling from will have moved on before the actual event is triggered and could cause some dirty updates, unless you control the update process carefully...

how to update a jLabel every time with a while loop with a delay

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int count = jSlider1.getValue();
int delay = jSlider2.getValue();
int valueOfSlider = jSlider2.getValue();
int valueOfSlider2 = jSlider1.getValue();
while (count > 0)
{
count--;
String count2 = ""+count;
jLabel3.setText(count2);
try {Thread.sleep(delay); }
catch (InterruptedException ie) { }
}
It will eventually show the final number on the jLabel but it does not incrementally update the number. any help
Swing is single-threaded. Therefore, long-running tasks should never take place in the EDT. This includes sleeping. Instead, use a javax.swing.Timer. This will delay in a background thread, and then post an action to be executed in the EDT.
See also:
How to Use Swing Timers
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
public final class JLabelUpdateDemo {
public static void main(String[] args){
SwingUtilities.invokeLater(new Runnable(){
#Override
public void run() {
createAndShowGUI();
}
});
}
private static void createAndShowGUI(){
final JFrame frame = new JFrame("Update JLabel Demo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().add(JTimerLabel.getInstance());
frame.setSize(new Dimension(275, 75)); // used for demonstration purposes
//frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Timer t = new Timer(1000, new ActionListener(){
#Override
public void actionPerformed(ActionEvent e) {
int val = Integer.valueOf(JTimerLabel.getInstance().getText());
JTimerLabel.getInstance().setText(String.valueOf(++val));
}
});
t.start();
}
private static final class JTimerLabel extends JLabel{
private static JTimerLabel INSTANCE;
private JTimerLabel(){
super(String.valueOf(0));
setFont(new Font("Courier New", Font.BOLD, 18));
}
public static final JTimerLabel getInstance(){
if(INSTANCE == null){
INSTANCE = new JTimerLabel();
}
return INSTANCE;
}
}
}
This SSCCE imitates a counter that will count up from 0 every second (i.e. update the JLabel instance) until the application is terminated.
Your problem is that your doing something time consuming in an ActionPerformed callback, which executes in the event thread. In callbacks, you should do something quickly and return, even if that "something" is spawning a thread. The GUI can't update while you're occupying the event thread, it will only update after your callback returns.

Swing: does DefaultBoundedRangeModel coalesce multiple events?

I have a JProgressBar displaying a BoundedRangeModel which is extremely fine grained and I was concerned that updating it too often would slow down my computer. So I wrote a quick test program (see below) which has a 10Hz timer but each timer tick makes 10,000 calls to microtick() which in turn increments the BoundedRangeModel. Yet it seems to play nicely with a JProgressBar; my CPU is not working hard to run the program.
How does JProgressBar or DefaultBoundedRangeModel do this? They seem to be smart about how much work it does to update the JProgressBar, so that as a user I don't have to worry about updating the BoundedRangeModel's value.
package com.example.test.gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoundedRangeModel;
import javax.swing.DefaultBoundedRangeModel;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.Timer;
public class BoundedRangeModelTest1 extends JFrame {
final private BoundedRangeModel brm = new DefaultBoundedRangeModel();
final private Timer timer = new Timer(100, new ActionListener()
{
#Override public void actionPerformed(ActionEvent arg0) { tick(); }
});
public BoundedRangeModelTest1(String title) {
super(title);
JPanel p = new JPanel();
p.add(new JProgressBar(this.brm));
getContentPane().add(p);
this.brm.setMaximum(1000000);
this.brm.setMinimum(0);
this.brm.setValue(0);
}
protected void tick() {
for (int i = 0; i < 10000; ++i)
{
microtick();
}
}
private void microtick() {
this.brm.setValue(this.brm.getValue()+1);
}
public void start()
{
this.timer.start();
}
static public void main(String[] args)
{
BoundedRangeModelTest1 f =
new BoundedRangeModelTest1("BoundedRangeModelTest1");
f.pack();
f.setVisible(true);
f.setDefaultCloseOperation(EXIT_ON_CLOSE);
f.start();
}
}
See the nested class DoPostEvent in the class javax.swing.Timer and the comments on the field notify.
Addendum: Events from the DefaultBoundedRangeModel are forwarded to the UI delegate by the fireStateChanged() method of JProgressBar. The events are coalesced in the EventQueue when postEvent() is invoked by repaint().
One way to follow the trail is to set a breakpoint in the UI delegate's paint() method and examine the call stack.
JProgressBar jpb = new JProgressBar(brm);
jpb.setUI(new BasicProgressBarUI());

Categories

Resources