Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions FirstUI.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import java.awt.*;
import java.awt.event.*;
class FirstUI extends Frame implements WindowListener, ActionListener
{
Button b1;
GridLayout g1;
Label l1, l2;
TextField tf;
FirstUI()
{
setTitle("First UI Interface WIndow");
setSize(500,500);
g1=new GridLayout(2,2); //2 rows 2 columns
setLayout(g1);
l1=new Label("Enter your name");
add(l1);
tf=new TextField();
add(tf);
b1=new Button("OK");
add(b1);
l2=new Label();
add(l2);
b1.addActionListener(this); //this means the window
addWindowListener(this); //to connect FirstUI to WindowListener
show();
}
public void actionPerformed(ActionEvent e1)
{
System.out.println("You clicked on the button");
String str=tf.getText();
l2.setText(str);
System.out.println(str);
}
public static void main(String args[])
{
FirstUI f=new FirstUI();
}
public void windowDeactivated(WindowEvent e)
{
System.out.println("Window Deactivated");
}
public void windowActivated(WindowEvent e)
{
System.out.println("Window Activated");
}
public void windowDeiconified(WindowEvent e)
{
System.out.println("Window Deiconified");
}
public void windowIconified(WindowEvent e)
{
System.out.println("Window Iconified");
}
public void windowOpened(WindowEvent e)
{
System.out.println("Window Opened");
}
public void windowClosed(WindowEvent e)
{
System.out.println("Window Closed");
}
public void windowClosing(WindowEvent e)
{
System.out.println("Window Closing");
System.exit(0);
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# 2feb2022
Demo for bca bscit sem 4
This is the first git jenkins demo
11 changes: 11 additions & 0 deletions Sort.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import java.util.Arrays;
public class Sort{
public static void main(String args[]){
int array[] = {97, 10, 85, 20, 25, 85, 63, 96, 57, 1};
int size = array.length;
Arrays.sort(array);
System.out.println("sorted Array ::"+Arrays.toString(array));
int res = array[size-1];
System.out.println("largest element is ::"+res);
}
}
24 changes: 24 additions & 0 deletions factClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import java.io.*;
import java.net.*;
class factclient{
public static void main(String argv[]) throws Exception
{
String n;
DatagramSocket clientSocket = new DatagramSocket();
byte []send=new byte[102];
byte []resive=new byte[102];
BufferedReader inFromUser = new BufferedReader(new
InputStreamReader(System.in));
System.out.println("\nEnter Number : ");
n=inFromUser.readLine();
InetAddress ipadd= InetAddress.getByName("localhost");
send=n.getBytes();
DatagramPacketsendPck=new DatagramPacket(send,send.length,ipadd,6870);
clientSocket.send(sendPck);
DatagramPacket resPck=new DatagramPacket(resive,resive.length);
clientSocket.receive(resPck);
String fact=new String(resPck.getData());
System.out.println("FROM SERVER: " +n+"! = " +fact);
clientSocket.close();
}
}