Java Reference
In-Depth Information
increaseButton.addActionListener(increaseActionListener);
frame.add(increaseButton);
// Define Automatic Increase Button
// Start Timer to increase progress by 3 every 250 ms
JButton autoIncreaseButton = new JButton ("Automatic Increase");
ActionListener autoIncreaseActionListener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
if (monitor != null) {
if (timer == null) {
timer = new Timer(250, new ProgressMonitorHandler());
}
timer.start();
}
}
};
autoIncreaseButton.addActionListener(autoIncreaseActionListener);
frame.add(autoIncreaseButton);
frame.setSize(300, 200);
frame.setVisible(true);
}
};
EventQueue.invokeLater(runner);
}
}
ProgressMonitor Properties
Table 9-6 shows the eight properties of ProgressMonitor .
Table 9-6. ProgressMonitor Properties
Property Name
Data Type
Access
accessibleContext
AccessibleContext
Read-only
canceled
boolean
Read-only
maximum
int
Read-write
millisToDecideToPopup
int
Read-write
millisToPopup
int
Read-write
minimum
int
Read-write
note
String
Read-write
progress
int
Write-only
 
Search WWH ::




Custom Search