java.lang.Object
|
+--javax.power.monitor.PowerMonitor
public void addPowerMonitorListener(PowerMonitorListener listener)
- See Also:
PowerWarningType
, PowerMonitorListener.powerWarning(int, javax.power.monitor.PowerWarningType)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addPowerMonitorListener(PowerMonitorListener listener,
PowerWarningType warningType)
- See Also:
-
PowerMonitorListener.powerWarning(int, javax.power.monitor.PowerWarningType)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getBatteryLevel()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getEstimatedSecondsRemaining()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1393]Battery Check
By Anonymous on 2005/04/14 12:15:11 Rate
Is anybody able to get it working?
This program always shows the same, useless values:
// > > > > > > > > > > jbattery.JAVA
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
import javax.power.monitor.*;
public class jbattery extends Frame implements ActionListener {
private Label lab1,lab2,lab3;
private Button exitButton, goButton;
private PowerMonitor pMon = null;
public jbattery ( ) {
super ( "Battery Check" ) ;
int remaining, level;
this.addWindowListener (
new WindowAdapter ( ) {
public void windowClosing ( WindowEvent e ) {
System.exit ( 0 ) ;
}
}
) ;
initGui ( ) ;
pMon = PowerMonitor.getInstance ( ) ;
setSize ( 200,280 ) ;
updateInfo ( ) ;
setVisible ( true ) ;
}
private void initGui ( ) {
setLayout ( null ) ;
lab1 = new Label ( "%" ) ;
lab2=new Label ( "secs" ) ;
lab3=new Label ( "-power-" ) ;
exitButton = new Button ( "Exit" ) ;
goButton = new Button ( "Update" ) ;
/
public static PowerMonitor getInstance()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected static PowerMonitor instance
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected PowerMonitor()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removePowerMonitorListener(PowerMonitorListener listener)
- See Also:
PowerWarningType
, PowerMonitorListener.powerWarning(int, javax.power.monitor.PowerWarningType)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removePowerMonitorListener(PowerMonitorListener listener,
PowerWarningType warningType)
- See Also:
-
PowerMonitorListener.powerWarning(int, javax.power.monitor.PowerWarningType)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean usingExternalPowerSource()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples