NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


package Main_Page;

import java.awt.Color;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.util.Scanner;

import javax.swing.DefaultCellEditor;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JComboBox;


public class Userdepartment {

public static void main(String[] args){


// create JFrame and JTable
JFrame frame = new JFrame();
JTable table = new JTable();
DefaultTableModel model =(DefaultTableModel)table.getModel();
model.addRow(new Object[] {});

frame.getContentPane().setBackground(Color.LIGHT_GRAY);

// create a table model and set a Column Identifiers to this model
Object[] columns= {"Id"," lecturer name","Subject ","Web"};
DefaultTableModel sdd = new DefaultTableModel();
sdd.setColumnIdentifiers(columns);

// set the model to the table

table.setModel(sdd);

//table.setFont(font);
table.setRowHeight(35);//setting the row height
//JScrollPane created
JScrollPane pane = new JScrollPane(table);
pane.setBounds(12, 13, 465, 371);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(pane);

Object[] row = new Object[4];// 4 column created
//button created
JButton btnSeelist = new JButton("SeeListScience");
btnSeelist.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
//view code of file handling of department
//dView.getDelB().setEnabled(true);
DefaultTableModel ssd = new DefaultTableModel(null,columns);
table.setModel(ssd);//table setModel
String finish ="C://Users//HP//eclipse-workspace//Ssd//department.dat";//location of file sstored
File file = new File(finish);//new file
try {
BufferedReader rbc = new BufferedReader(new FileReader(file));// new bufferreader created
//array used
Object[] tBRow = rbc.lines().toArray();
for(int i=0; i < tBRow.length; i++) { //for loop used
String line = tBRow[i].toString().trim();
String[] dRow = line.split("[,n]");
ssd.addRow(dRow);//sdd add row
//dView.getList().setEnabled(false);
}
} catch (FileNotFoundException e1) {
JOptionPane.showMessageDialog(null,"Error in finding file");
}

catch (NullPointerException e1) {
JOptionPane.showMessageDialog(null,e1);
}
}
});
btnSeelist.setBounds(634, 105, 134, 25);
frame.getContentPane().add(btnSeelist);

//JButton created
JButton btnSeelistarts = new JButton("SeeListArts");
btnSeelistarts.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DefaultTableModel ssd = new DefaultTableModel(null,columns);//new Deafult table model
table.setModel(ssd);//table set model
String finish = "C://Users//HP//eclipse-workspace//Ssd//r.dat";//location of file stored
File file = new File(finish);
try {
BufferedReader rbc = new BufferedReader(new FileReader(file));//buffer reader created
Object[] tBRow = rbc.lines().toArray();//array used
for(int i=0; i < tBRow.length; i++) {
String line = tBRow[i].toString().trim();
String[] dRow = line.split("[,n]");
ssd.addRow(dRow);
//dView.getList().setEnabled(false);
}
} catch (FileNotFoundException e1) {
JOptionPane.showMessageDialog(null,"Error in finding file");
}

catch (NullPointerException e1) {
JOptionPane.showMessageDialog(null,e1);
}
}
});
btnSeelistarts.setBounds(638, 238, 130, 25);
frame.getContentPane().add(btnSeelistarts);
//back button created
JButton btnBack = new JButton("Back");
btnBack.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
New_Home.main(null);
frame.dispose();
}
});
btnBack.setBounds(653, 342, 97, 25);
frame.getContentPane().add(btnBack);




//frame created and size set

frame.setSize(856,538);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.setTitle("Northampton Metropolitan University");
}
}
     
 
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.