package ch07_auxiliaryclasses.taxcalculator;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class UPAdvisor extends JFrame implements ActionListener {
JButton displayadvice = new JButton("Displayadvice");
JTextField displayadviceTxt = new JTextField(11);
JSpinner ucasPointSp = new JSpinner(new SpinnerNumberModel(0,0,180,10));
JRadioButton Degree = new JRadioButton("Degree", true);
JRadioButton FoundationDegree = new JRadioButton("Foundation Degree", false);
ButtonGroup bg = new ButtonGroup();
JTextField displayTxt = new JTextField(15);
JButton displayBtn = new JButton("DisplayAdvice");
public static void main(String[] args) {
new UPAdvisor();
}
public UPAdvisor() {
setLayout(new BorderLayout());
setSize(500, 135);
setTitle("University of peckham course chooser");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
JPanel top= new JPanel();
top.setLayout(new FlowLayout());
course.addItem("Software Engineering");
course.addItem("Computer Science");
course.addItem("Information System");
course.addItem("Multimedia Studies");
top.add(course);
add("North", top);
setVisible(true);
JPanel northtop = new JPanel ();
bg.add(Degree);
bg.add(FoundationDegree);
top.add(Degree);
top.add(FoundationDegree);
top.add(ucasPointSp);
JPanel bottom = new JPanel();
bottom.add(displayadvice);
displayadvice.addActionListener(this);
displayadviceTxt.setEditable(false);
displayadviceTxt.setText (" sorry this no course avaiable ");
}
}
package ch07_auxiliaryclasses.taxcalculator;
public class UPAPP {
public void actionPerformed(ActionEvent e) {
if (course.getSelectedItem().equals("software engineering")) {
courseTxt.setText("room100");
} else if (course.getSelectedItem().equals("computer science")) {
courseTxt.setText("room102");
} else if (course.getSelectedItem().equals("information system")) {
courseTxt.setText("room103 ");
} else if
(course.getSelectedItem().equals("multimedia studies")) {
courseTxt.setText(" 104 ");
} else {
displayadviceTxt.setText (" sorry this no course avaiable ");
}
}
}
hadeelh30 -4 Newbie Poster
stultuske 1,116 Posting Maven Featured Poster
NormR1 563 Posting Sage Team Colleague
hadeelh30 -4 Newbie Poster
NormR1 563 Posting Sage Team Colleague
hadeelh30 -4 Newbie Poster
NormR1 563 Posting Sage Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.