diff --git a/FirstUI.java b/FirstUI.java new file mode 100644 index 0000000..835b32c --- /dev/null +++ b/FirstUI.java @@ -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); + } +} \ No newline at end of file diff --git a/README.md b/README.md index 0e8605c..59bd902 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # 2feb2022 Demo for bca bscit sem 4 +This is the first git jenkins demo diff --git a/Sort.java b/Sort.java new file mode 100644 index 0000000..fa3b9ce --- /dev/null +++ b/Sort.java @@ -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); + } +} \ No newline at end of file diff --git a/factClient.java b/factClient.java new file mode 100644 index 0000000..7cbfc46 --- /dev/null +++ b/factClient.java @@ -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(); + } +} \ No newline at end of file