Re: setLookAndFeel problem
On Feb 15, 9:02 pm, "John B. Matthews" <nos...@nospam.invalid> wrote:
I don't know how much "much" means, but I've become comfortable using
IDEs like NetBeans or Eclipse to re-factor existing code.
me too using netbeans.
and another thing.
for this code, which extends JFrame, the lookandfeel works.
(contradicting Andrew Thompson's statement)
import javax.swing.*;
import java.awt.*;
/**
*
* @author arshad
*/
public class ProgressMonitor extends JFrame{
JProgressBar current;
JTextArea out;
JButton find;
Thread runner;
int num=0;
public ProgressMonitor() {
super("Progress Monitor");
Dimension
d=java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setSize(d);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLookAndFeel();
// setSize(205,68);
setLayout(new FlowLayout());
current=new JProgressBar(0,2000);
current.setValue(0);
current.setStringPainted(true);
JLabel label=new JLabel("You have been fooled!, Your machine
is being formatted");
JPanel panel=new JPanel();
// panel.add(sld);
panel.add(label);
panel.add(current);
add(panel);
setVisible(true);
///add(current);
// pack();
}
private void setLookAndFeel(){
try{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(this);
}catch(Exception e){
System.out.println("errorrrr");
}
}
public void iterate(){
while(num<2000){
current.setValue(num);
try{
Thread.sleep(1000);
}catch(InterruptedException e){}
num+=95;
}
}
public static void main(String arg[]){
ProgressMonitor frame=new ProgressMonitor();
frame.setVisible(true);
frame.iterate();
}
}