Question
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Hashtable; import javax.swing.*; import javax.swing.border.Border; import com.sun.glass.events.KeyEvent; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; public class MySite { public static void
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Hashtable;
import javax.swing.*; import javax.swing.border.Border;
import com.sun.glass.events.KeyEvent;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue;
public class MySite {
public static void main(String[] args){
JFrame frame = new JFrame("asdasd");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JTextField b1,b2,b3;
JLabel l1; JLabel l2; JLabel l3,l4,l5; l1=new JLabel("School:"); l1.setBounds(40,100, 100,30);
l2=new JLabel("Grade:"); l2.setBounds(40,150, 100,30);
l3=new JLabel("Degree:"); l3.setBounds(40,200, 100,30);
l4=new JLabel("Favorite TV Shows:"); l4.setBounds(40,250, 100,30);
l5=new JLabel("Courses:"); l5.setBounds(40,300, 100,30); b1=new JTextField("Rensselaer"); b1.setBounds(150,100, 200,30);
b2=new JTextField("Continuing Education"); b2.setBounds(150,150, 200,30);
b3=new JTextField("Undergraduate"); b3.setBounds(150,200, 200,30);
frame.add(l1); frame.add(l2); frame.add(l3); frame.add(l4); frame.add(l5);
frame.add(b1); frame.add(b2); frame.add(b3);
List list=new List(3);
list.setBounds(150,250, 205,35);
list.add("Discovery Channel"); list.add("60 minutes"); list.add("Survivor");
frame.add(list);
List list1=new List(3,false);
String country[]={"Computer Science","Math","Science","History","Art","Biology"};
JComboBox combox=new JComboBox(country);
combox.setBounds(150,300, 205,35); combox.setSelectedIndex(0);
frame.add(combox);
JButton button=new JButton("FINISH");
button.setBounds(50,350,80,30);
frame.add(button);
button.addActionListener (new ActionListener() {
public void actionPerformed( ActionEvent e ) {
JOptionPane.showMessageDialog(frame.getComponent(0), "That's me!"); } });
frame.add(button); frame.setSize(400,500); frame.setLayout(null); frame.setVisible(true); JMenuBar menubar = new JMenuBar(); frame.setJMenuBar(menubar); JMenu student = new JMenu("Student"); student.setMnemonic(KeyEvent.VK_T); menubar.add(student); JMenuItem add = new JMenuItem("Add",KeyEvent.VK_A); student.add(add); JMenuItem search = new JMenuItem("Search",KeyEvent.VK_S); student.add(search); JMenu school = new JMenu("School"); school.setMnemonic(KeyEvent.VK_H); menubar.add(school); JMenuItem add1 = new JMenuItem("Add",KeyEvent.VK_A); school.add(add1); JMenuItem search1 = new JMenuItem("Search",KeyEvent.VK_S); school.add(search1); JMenuItem list3 = new JMenuItem("List",KeyEvent.VK_L); school.add(list3); JMenuItem status = new JMenuItem("Status",KeyEvent.VK_T); school.add(status); JMenu faculty = new JMenu("Faculty"); faculty.setMnemonic(KeyEvent.VK_F); menubar.add(faculty); JMenuItem add2 = new JMenuItem("Add",KeyEvent.VK_A); faculty.add(add2); JMenuItem search2 = new JMenuItem("Search",KeyEvent.VK_S); faculty.add(search2); JMenuItem list2 = new JMenuItem("List",KeyEvent.VK_L); faculty.add(list2); JMenuItem titles = new JMenuItem("Titles",KeyEvent.VK_T); faculty.add(titles); class exitaction implements ActionListener{ public void actionPerformed(ActionEvent e){ System.exit(0); } } add.addActionListener(new exitaction()); JSlider slider= new JSlider(JSlider.HORIZONTAL,10,100,20); slider.setMajorTickSpacing(10); slider.setLabelTable(slider.createStandardLabels(20)); slider.setPaintTicks(true); slider.setPaintLabels(true); slider.setBounds(100,50, 205,35); frame.add(slider); }
}
java
You will now create an Applet to run the MySite class you have built over the past few assignments. You will create a simple HTML file that will run on your local browser, so it not necessary to have a personal web site to complete this assignment. Create a simple HTML file, like the popular "Hello World". There are plenty of web sites that show how to do this, including the tutorial found in the Web Links folder of Module 14. Then add the MySite class as an applet. Do not have the Frame appear automatically, but MySite is triggered by entering their name. That means your initO method will ask for the person's name. If your name is correctly entered, then display the MySite frame. Note that you will need an ActionListener for thatStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started