I would like to know if we are provided with a decimal to binary to hexadecimal to octadecimal calculator like the one provided with the windows operating system for the exam.All MCP papers are allowed to use the windows calculator.
Also I have a problem with the following code on java.awt,please refer below,the line: label.setText(s)
import java.awt.*;
import java.awt.event.*;
public class ButtonApp extends Frame {
Label label=new Label("Default Label");
Button b1=new Button("one");
Button b2=new Button("two");
Button b3=new Button("three");
Panel p1=new Panel();
Panel p2=new Panel();
public static void main(
String[] args) {
ButtonApp obj=new ButtonApp();
}
public ButtonApp() {
super("ButtonApp");
p1.add(label);
b1.addActionListener(new ButtonHandler());
b2.addActionListener(new ButtonHandler());
b3.addActionListener(new ButtonHandler());
p1.add(b1);
p1.add(b2);
p1.add(b3);
add("North",p1);
add("Center",p2);
addWindowListener(new WindowEventHandler());
pack();
show();
}
}
class ButtonHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {
String s=e.getActionCommand();
/*here my compilor gives me an error saying that 'label' is an undefined variable or class name,please help! */
label.setText(s);
}
}
class WindowEventHandler extends WindowAdapter {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}