so we will create a frame which will have label boxes for first name, last name, and date of birth. Input will be taken from the user and when the user fills the date box it should show calendar from where a user can pick a date. Give the color palette to the user which could have up to 10 colors and the user can choose a background from that color palate.
Once the all is done we have two buttons one for Done and another Cancel. If the user press Done all the information means first name, last name, and date of birth will be stored to any file in your pc.
All should be done in java using swing
***************************************************************
JAVASwingFormExample.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class JAVASwingFormExample extends JFrame{
private JFrame frame;
private JTextField textFieldfname;
private JTextField textFieldlname;
private JColorChooser cc;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
JAVASwingFormExample window = new JAVASwingFormExample();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public JAVASwingFormExample() {
initialize();
textFieldfname = new JTextField();
textFieldfname.setBounds(140, 28, 106, 20);
frame.getContentPane().add(textFieldfname);
textFieldfname.setColumns(10);
JLabel lblfName = new JLabel("First Name");
lblfName.setBounds(65, 31, 75, 14);
frame.getContentPane().add(lblfName);
JLabel lbllName = new JLabel("Last Name");
lbllName.setBounds(65, 68, 75, 14);
frame.getContentPane().add(lbllName);
textFieldlname = new JTextField();
textFieldlname.setBounds(140, 65, 106, 20);
frame.getContentPane().add(textFieldlname);
textFieldlname.setColumns(10);
JButton lblcolor = new JButton("Choose Color");
lblcolor.setBounds(65, 115, 130, 20);
cc = new JColorChooser();
lblcolor.addActionListener( new ColorLauncher() );
frame.getContentPane().add(lblcolor);
JButton btnDone = new JButton("Done");
btnDone.setBounds(65, 166, 75, 20);
btnDone.addActionListener( new ButtonDone() );
frame.getContentPane().add(btnDone);
JButton btnCancel = new JButton("Cancel");
btnCancel.setBounds(150, 166, 75, 20);
btnCancel.addActionListener( new ButtonCancel() );
frame.getContentPane().add(btnCancel);
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 730, 489);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
}
private class ColorLauncher implements ActionListener
{
public void actionPerformed( ActionEvent e )
{
Color newColor = JColorChooser.showDialog( cc, "Color Chooser", frame.getContentPane().getBackground() );
frame.getContentPane().setBackground( newColor );
frame.repaint();
}
}
private class ButtonDone implements ActionListener
{
public void actionPerformed( ActionEvent e )
{
String fname = textFieldfname.getText();
String lname = textFieldlname.getText();
File file = new File("users.txt");
FileWriter fr = null;
try {
fr = new FileWriter(file);
fr.write(fname + " " + lname);
JOptionPane.showMessageDialog(null, "Data Store Successfully");
} catch (IOException exc) {
exc.printStackTrace();
}finally{
try {
fr.close();
} catch (IOException exc) {
exc.printStackTrace();
}
}
}
}
private class ButtonCancel implements ActionListener
{
public void actionPerformed( ActionEvent e )
{
System.exit(0);
}
}
}
*******************************************
Output :
so we will create a frame which will have label boxes for first name, last name,...
I need to create a code based off of what the users first name and last name are along with a random set of numbers no longer than 10 characters as the picture below demonstrate (Java language) Scenario: You have been appointed by the CS department to create a username generator to create CS email accounts automatically. The CS email will have the following format: [email protected]. Your username must have a limit of 10 characters. Your program, will provide three...
Problem: Contact Information Sometimes we need a program that have all the contact information like name, last name, telephone, direction and something we need to know about that person (notes). Write a program in java language with GUI, classes, arrays, files and inheritance that make this possible. In the first layer, the user should see all the contacts and three buttons (add, delete, edit). *Add button: If the user click the button add, a new layer should appear and should...
Consider the Passenger data structure we discussed during the last class. Instead of using "struct", we will use object-oriented "class". Create a hierarchy of 3 classes to support "Party", "Person" and "Passenger", where each inherits from its parent. The attributes that define a Party are: Party Type Code ('P' person, 'O' Address (one larga string) Phone Number (one string organization) The attributes that define a Person are: -Date of Birth First Name -Last Name The attributes that define a Passenger...
create a java prgram that have UniversityDriver Class The UniversityDriver contains the main method. The following commands can be entered: (a) "hire" //to hire a new faculty member (b) "admit" //to admit a new student (c) "find student" //to display information about a specific student: name, date of birth, and major (d)"find faculty" //display information about a specific faculty: name, date of birth, and courses; (e) “list students” // list the first and last names of all students (f) “list...
We have the following relation: First Name Last Name City State Age George Duke Portland OR 44 Thana Harris San Diego CA 31 Tommy Mars New York NY 30 Ruth Underwood San Francisco CA 29 Frank Zappa Los Angeles CA 53 How many records are returned if we supply a query with the conditions State="CA" AND AGE < 50? A. 3 B. 0 C.1 D. 2 E. 5
C++ developing involves ut from a file a person's first name, last name, phone number and birth a menu driven database application. You need to 4) This program accept as input ogram will be menu driven with the following options: 1) Find a person's information 2) Add a person to the database 3) Edit a person's information 4) Display all records to the screen 5) Quit Option 1 allows the user to enter a name after which you will search...
Create a class “Person” which includes first name, last name, age, gender, salary, and haveKids (Boolean) variables. You have to create constructors and properties for the class. Create a “MatchingDemo” class. In the main function, the program reads the number of people in the database from a “PersonInfo.txt” file and creates a dynamic array of the object. It also reads the peoples information from “PersonInfo.txt” file and saves them into the array. In C# Give the user the ability to...
can someone help me with this program ? first name : Tom Last name : Damerji Mother's maiden name : White Town i was born in : Beirut Write a new method that determines your Star Wars name. The method will have 4 parameters, your first name, last name, mothers maiden name, and the town you were born. (1 point) The method will return one String object, your Star Wars name. (1 point) Your Star Wars name is created as per...
Java: student directory GUI You need to implement three classes: Person Student StudentDirectory StudentMain Start by implementing Person and Student classes. Once you are sure you can serialize and deserialize and ArrayList of Students to and from a file, move on to building the GUI application. Person: The Person class should implement serializable interface. It contains the following: Person's first name (String) Person's last name (String) Person's id number Person's date of birth (Date) public String toString(): This method method...
Project 2 Description Create a Visual C# project that when an employee's biweekly sales amount is entered and the Calculate button is pressed, the gross pay, deductions, and net pay will be displayed. Each employee will receive a base pay of $1200 plus a sales commission of 8% of sales. Once the net pay has been calculated, display the budget amount for each category listed below based on the percentages given. base pay = $1200; use a named...