Guest User

chackers

a guest
Mar 28th, 2016
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.06 KB | None | 0 0
  1. // Demonstrate Buttons
  2. import java.awt.*;
  3. import java.awt.event.*;
  4. import java.applet.*;
  5. /*
  6. <applet code="pro12" width=250 height=150>
  7. </applet>
  8. */
  9.  
  10. public class pro12 extends Applet implements AdjustmentListener
  11. {
  12. Color c;
  13. Scrollbar rs,gs,bs;
  14. public void init()
  15. {
  16. rs=new Scrollbar(Scrollbar.HORIZONTAL,255,5,0,255);
  17. gs=new Scrollbar(Scrollbar.HORIZONTAL,255,5,0,255);
  18. bs=new Scrollbar(Scrollbar.HORIZONTAL,255,5,0,255);
  19.  
  20. add(rs);
  21. add(gs);
  22. add(bs);
  23.  
  24. rs.addAdjustmentListener(this);
  25. gs.addAdjustmentListener(this);
  26. bs.addAdjustmentListener(this);
  27. }
  28.  
  29. public void adjustmentValueChanged(AdjustmentEvent ae)
  30. {
  31. int r=rs.getValue();
  32. int g=gs.getValue();
  33. int b=bs.getValue();
  34.  
  35. c=new Color(r,g,b);
  36. repaint();
  37. }
  38.  
  39. public void paint(Graphics g)
  40. {
  41. g.setColor(c);
  42. g.fillRect(100,80,50,50);
  43. }
  44.  
  45. }
  46.  
  47. // Demonstrate Buttons
  48. import java.awt.*;
  49. import java.awt.event.*;
  50. import java.applet.*;
  51. /*
  52. <applet code="pro7" width=250 height=150>
  53. </applet>
  54. */
  55.  
  56. public class pro7 extends Applet implements ActionListener
  57. {
  58. Button red, green, blue;
  59.  
  60. public void init()
  61. {
  62. red = new Button("Red");
  63. green = new Button("Green");
  64. blue = new Button("Blue");
  65.  
  66. add(red);
  67. add(green);
  68. add(blue);
  69.  
  70. red.addActionListener(this);
  71. green.addActionListener(this);
  72. blue.addActionListener(this);
  73. }
  74.  
  75. public void actionPerformed(ActionEvent ae)
  76. {
  77. String str = ae.getActionCommand();
  78. if(str.equals("Red"))
  79. {
  80. setBackground(Color.red);
  81. }
  82. else if(str.equals("Green"))
  83. {
  84. setBackground(Color.green);
  85. }
  86. else
  87. {
  88. setBackground(Color.blue);
  89. }
  90. repaint();
  91. }
  92. }
  93.  
  94. import java.applet.Applet;
  95. import java.awt.*;
  96. /*
  97. <applet code=as11_5 width=600 height=600>
  98. </applet>
  99. */
  100. public class as11_5 extends Applet
  101. {
  102. public void paint(Graphics g)
  103. {
  104. // Font f=new Font("Arial",Font.BOLD,14);
  105. g.setFont(f);
  106. g.drawRect(100,100,400,400);//outer rect
  107. g.drawOval(150,125,150,150);//circle
  108. g.drawString("Circle",200,175);
  109. g.drawRect(325,125,150,150);//sqare
  110. g.drawString("Square",375,175);
  111. g.drawOval(200,350,250,100);//oval
  112. g.drawString("Oval",300,400);
  113. }
  114. }
  115.  
  116.  
  117.  
  118. import java.applet.Applet;
  119. import java.awt.*;
  120. /*
  121. <applet code='As11_2'
  122. width=600
  123. height=600>
  124. </applet>
  125. */
  126.  
  127. public class As11_2 extends Applet
  128. {
  129. public void paint(Graphics g)
  130. {
  131. g.drawOval(100,100,400,400);//face
  132. g.setColor(Color.GRAY);
  133. g.fillOval(170,200,50,50);//left eye
  134. g.fillOval(400,200,50,50);//right eye
  135. g.drawLine(300,300,270,340);//nose horizontal arrow
  136. g.drawLine(270,340,310,340);//nose vertical arrow
  137. g.drawArc(200,400,200,80,10,170);
  138. }
  139. }
  140.  
  141.  
  142. import java.applet.Applet;
  143. import java.awt.*;
  144. /*
  145. <applet code='as11_1'
  146. width=600
  147. height=600>
  148. </applet>
  149. */
  150.  
  151. public class as11_1 extends Applet
  152. {
  153. public void paint(Graphics g)
  154. {
  155. g.drawOval(100,100,400,400);//face
  156. g.setColor(Color.black);
  157. g.fillOval(170,200,50,50);//left eye
  158. g.fillOval(400,200,50,50);//right eye
  159. g.drawLine(300,300,270,340);//nose horizontal arrow
  160. g.drawLine(270,340,310,340);//nose vertical arrow
  161. g.drawArc(200,350,200,70,-10,-170);
  162. }
  163. }
  164.  
  165.  
  166. <?php
  167.  
  168. require 'connect.php';
  169.  
  170. $id=$_GET['sid'];
  171.  
  172. $sqlq="delete from student_info where sid=$id";
  173. echo $sqlq;
  174. mysqli_query($conn,$sqlq);
  175. mysqli_close($conn);
  176. //header('Location: all_stud_info.php');
  177. ?>
  178.  
  179. <?php
  180.  
  181. require 'connect.php';
  182. $sid=$_GET['sid'];
  183.  
  184. $sqlq="select * from student_info where sid=$sid";
  185.  
  186. $r=mysqli_query($conn,$sqlq);
  187. $row=mysqli_fetch_array($r);
  188.  
  189. mysqli_close($conn);
  190.  
  191.  
  192. ?>
  193.  
  194.  
  195.  
  196. <html>
  197. <head>
  198. <title> Upload </title>
  199. </head>
  200. <body>
  201. <form method="POST">
  202.  
  203. <table>
  204. <tr>
  205. <td>Name:</td>
  206. <td><input type="text" name="txt_nm" value="<?php echo $row[1];?>"/></td>
  207. </tr>
  208. <tr>
  209. <td>Dept Name</td>
  210. <td><input type="text" name="txt_dept" value="<?php echo $row[2];?>"/></td>
  211. </tr>
  212. <tr>
  213. <td>address:</td>
  214. <td><textarea name="txta_add" ><?php echo $row[3];?></textarea></td>
  215. </tr>
  216. <tr>
  217. <td>Email:</td>
  218. <td><input type="text" name="txt_mail" value="<?php echo $row[4];?>"/> </td>
  219. </tr>
  220. <!-- <tr>
  221. <td>Contact no:</td>
  222. <td><input type="text" name="txt_cont" value="//< echo $row[5];?>"/></td>
  223. </tr> -->
  224. <tr>
  225. <td>Dob:</td>
  226. <td><input type="date" name="date_dob" value="<?php echo $row[5];?>"/></td>
  227. </tr>
  228. <tr>
  229. <td>Course Name:</td>
  230. <td><input type="text" name="txt_course" value="<?php echo $row[6];?>"/></td>
  231. </tr>
  232. <tr>
  233. <td align="center"> <input type="submit" value="update" name='btn_sub'></td>
  234. </tr>
  235.  
  236. </table>
  237.  
  238.  
  239. </form>
  240. </body>
  241. </html>
  242.  
  243. <?php
  244.  
  245. $r=$_GET["sid"];
  246.  
  247. if($r!=null)
  248. {
  249.  
  250. $con=mysqli_connect("localhost","root","") or die("Can't connect");
  251.  
  252. mysqli_select_db($con,'student_master');
  253.  
  254. $sql="select * from student_info where sid=$r";
  255.  
  256. $result = mysqli_query($con,$sql);
  257.  
  258. $row=mysqli_fetch_array($result);
  259. }
  260.  
  261.  
  262. if(isset($_POST['btn_sub']))
  263. {
  264. $name=$_POST['txt_nm'];
  265. $dept=$_POST['txt_dept'];
  266. $add=$_POST['txta_add'];
  267. $mail=$_POST['txt_mail'];
  268. // $contact=$_POST['txt_cont'];
  269. $dob=$_POST['date_dob'];
  270. $course=$_POST['txt_course'];
  271.  
  272. if(!(empty($name)and empty($dept)and empty($add)and empty($mail) and empty($contact) and empty($dob) and empty($course)))
  273. {
  274.  
  275. $sqlq="update student_info set name='$name',dept='$dept',address='$add',email='$mail',birth_date='$dob',course_name='$course' where sid=$r";
  276. echo $sqlq;
  277. mysqli_query($con,$sqlq);
  278. mysqli_close($con);
  279. // header('Location: student_info.php');
  280. }
  281. }
  282. ?>
  283.  
  284. <?php
  285.  
  286. $servername = "127.0.0.1";
  287. $username = "root";
  288. $password = "";
  289. $database = "student_master";
  290. // Create connection
  291. $conn = new mysqli($servername, $username, $password, $database);
  292.  
  293.  
  294. // Check connection
  295. if ($conn->connect_error) {
  296. die("Connection failed: " . $conn->connect_error);
  297. }
  298. echo "Connected successfully <br>";
  299.  
  300. ?>
Add Comment
Please, Sign In to add comment