NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.awt.event.ActionEvent;

public class Adds_Department extends JFrame {

private JPanel contentPane;
private JTextField texter;
private JTextField lect;
private JTextField tyree_type;
private JTextField address_tyres;

/**
* Launch the application.
*/
public static void main(String[] args) {


try {
Adds_Department punch = new Adds_Department();
punch.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}



public Adds_Department() {

setBounds(100, 100, 526, 415);
JPanel punch = new JPanel();
punch.setBackground(Color.GREEN);//backgorund clolor set to pink
setContentPane(punch);//setcontent pane panel
punch.setLayout(null);//set layout null




JLabel lblAddDepartmentForm = new JLabel("Add Department Form");
lblAddDepartmentForm.setBounds(178, 34, 166, 16);
punch.add(lblAddDepartmentForm);

JLabel depu = new JLabel("Department-ID");
depu.setBounds(301, 89, 111, 16);
punch.add(depu);

texter = new JTextField();
texter.setBounds(100, 86, 116, 22);
punch.add(texter);
texter.setColumns(10);

JLabel lectuerxe = new JLabel("Lecturer name");
lectuerxe.setBounds(311, 161, 89, 16);
punch.add(lectuerxe);

lect = new JTextField();
lect.setBounds(100, 158, 116, 22);
punch.add(lect);
lect.setColumns(10);

JLabel deptyype = new JLabel("Department -Type");
deptyype.setBounds(311, 228, 111, 16);
punch.add(deptyype);

tyree_type = new JTextField();
tyree_type.setBounds(100, 225, 116, 22);
punch.add(tyree_type);
tyree_type.setColumns(10);

JLabel webbu = new JLabel("Web -address");
webbu.setBounds(311, 281, 101, 16);
punch.add(webbu);

address_tyres = new JTextField();
address_tyres.setBounds(100, 278, 116, 22);
punch.add(address_tyres);
address_tyres.setColumns(10);
Object[] row1 = new Object[4];
DefaultTableModel rear = new DefaultTableModel(); //model operated



JButton submites = new JButton("Click Add");
submites.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
row1[0] = texter.getText(); //rows are set
row1[1]= lect.getText(); //rows are set
row1[2]= tyree_type.getText(); //rows are set
row1[3]= address_tyres.getText(); //rows are set
rear.addRow(row1); //rows are set

/* fileWriter is called */
FileWriter nibesterio;
//try operation is performed
try {
nibesterio = new FileWriter("C://nibesh//n.dat",true); //data location is given
PrintWriter raut = new PrintWriter(nibesterio); // new object is called
raut.println( row1[0] + "," + row1[1]+","+ row1[2]+","+row1[3] ); // data is printed
raut.close(); // end operation

raut.close(); // end operation
nibesterio.close(); // end operation


}

//catch operaiton is called
catch (IOException e1) {
e1.printStackTrace(); //printStack is called
}

JOptionPane.showMessageDialog(null, "Sucessfully added "); //mesaage is displayed
}
});

submites.setBounds(343, 330, 97, 25);
punch.add(submites);

JButton viewres = new JButton("View-Department");
viewres.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Viewing.main(null);
dispose();
}
});
viewres.setBounds(170, 330, 133, 25);
punch.add(viewres);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//for close operation


JButton haus = new JButton("secreatry assign");
haus.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

}
});
haus.setBounds(20, 330, 133, 25);
punch.add(haus);
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.