Write a simple GUI-based Java program that may be used to control a washing machine. Use suitable Swing components to allow the washing machine operator to perform the following functions:
1) Switch the machine on.
2) Choose a temperature from a list.
3) Spin speed selection buttons - can be 600, 800 or 1200 RPM.
4) Display the current status of the wash cycle.
Show the top-level design of the GUI, including any Panels and related Layout Manager objects that you propose to use. For each of the components you’ve chosen above, write the code to construct the component, add the component to a container and then set up simple event handling for the component (for those that generate events). The event handlers need only print out a message indicating that they have been called.
WashingMachine.java
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class WashingMachine implements ActionListener{
JFrame frame;
JButton btn1, btn2, btn3;
JLabel label;
public WashingMachine(){
frame = new JFrame();
frame.setSize(600, 300);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLayout(new
FlowLayout(FlowLayout.CENTER));
btn1 = new JButton("600");
btn1.setSize(60, 40);
btn2 = new JButton("800");
btn2.setSize(60, 40);
btn3 = new JButton("1200");
btn3.setSize(60, 40);
label = new JLabel("Current Cycles:
None");
label.setSize(200, 40);
frame.add(btn1);
frame.add(btn2);
frame.add(btn3);
frame.add(label);
btn1.addActionListener(this);
btn2.addActionListener(this);
btn3.addActionListener(this);
}
public static void main(String args[]){
new WashingMachine();
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("600")){
label.setText("Current Cycles: 600");
System.out.println("600 Cycles selected");
}else
if(e.getActionCommand().equals("800")){
label.setText("Current Cycles: 800");
System.out.println("800 Cycles selected");
}else
if(e.getActionCommand().equals("1200")){
label.setText("Current Cycles: 1200");
System.out.println("1200 Cycles selected");
}
}
}
Write a simple GUI-based Java program that may be used to control a washing machine. Use...
Nork individually or in pairs to write a simple "timer" dialog in Java. The dialog shall consist of three GUI components: a text field co display the elapse time in the hh:mm:ss format and start/stop puttons to start and stop the timer (see the lecture notes for sample screenshots). As suggested in the lecture notes, separate the model (TimerModel) From the view and control (TimerDialog) to make the model reusable. Ir Eact, you will reuse the model class when you...
10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated sludge operation that adversely affect effluent quality with origins in the engineering, hydraulic and microbiological components of the process. The real "heart" of the activated sludge system is the development and maintenance of a mixed microbial culture (activated sludge) that treats wastewater and which can be managed. One definition of a wastewater treatment plant operator is a "bug farmer", one who controls the aeration...