| | |
How to
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2007
Posts: 6
Reputation:
Solved Threads: 0
How can i display the output of this coding in frames instead of Command Prompt.
and i want to view the result of that student only whose rollno is entered.
and i want to view the result of that student only whose rollno is entered.
Java Syntax (Toggle Plain Text)
import java.awt.*; //import java.applet.*; import java.awt.event.*; import java.lang.*; import java.sql.*; public class wscreen extends Frame implements WindowListener,ActionListener { Button b1; TextField t1; Label l1,l2; String msg,msg1,msg2,msg3,msg4,msg5,msg6,msg7; public wscreen() { super("imp"); setLayout(null); b1= new Button("submit"); l1=new Label("Result Declared",Label.CENTER); l2=new Label("Enter ROLL NO", Label.LEFT); t1=new TextField(5); /*t2=new TextField(5); t3=new TextField(5); t4=new TextField(5); t5=new TextField(5); t6=new TextField(5); t7=new TextField(5); t8=new TextField(5);*/ Font f=new Font("Impact", Font.BOLD,25); Color c1=new Color(255,200,210); Color c2=new Color(200,200,210); l1.setFont(f); l1.setForeground(c1); l1.setBackground(c2); l1.setBounds(90,20,200,30); add(l1); l2.setBounds(20,70,90,30); add(l2); t1.setBounds(200,70,90,20); add(t1); /* t2.setBounds(200,200,90,10); add(t2); t3.setBounds(200,230,90,10); add(t3); t4.setBounds(200,250,90,20); add(t4); t5.setBounds(200,270,90,20); add(t5); t6.setBounds(200,290,90,20); add(t6); t7.setBounds(200,300,90,20); add(t7); t8.setBounds(200,310,90,20); add(t8);*/ b1.setBounds(90,120,200,30); add(b1); addWindowListener(this); b1.addActionListener(this); } public void actionPerformed(ActionEvent ae) { Object ob=ae.getSource(); if(ob==b1); } public void paint(Graphics g) { msg="ROLLNO :"+t1.getText(); msg1="NAME :"; msg2="RESULT :"; msg3="P1 :"; msg4="P2 :"; msg5="P3 :"; msg6="P4 :"; msg7="P5 :"; g.drawString(msg,90,190); g.drawString(msg1,90,210); g.drawString(msg2,90,230); g.drawString(msg3,90,250); g.drawString(msg4,90,270); g.drawString(msg5,90,290); g.drawString(msg6,90,310); g.drawString(msg7,90,330); } public static void main(String ar[]) { wscreen d=new wscreen(); d.setSize(400,400); d.setVisible(true); String Sname; String Sno,m1,m2,m3,m4,m5; Connection Con=null; Statement Stmt; ResultSet ERs; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Con=DriverManager.getConnection("jdbc:odbc:data"); Stmt=Con.createStatement(); ERs=Stmt.executeQuery("SELECT * FROM s1"); while(ERs.next()) { Sno=ERs.getString("ROLLNO"); Sname=ERs.getString("NAME"); m1=ERs.getString("P1"); m2=ERs.getString("P2"); m3=ERs.getString("P3"); m4=ERs.getString("P4"); m5=ERs.getString("P5"); System.out.println(Sno+" "+Sname+" "+m1+" "+m2+" "+m3+" "+m4+""+m5+"\n"); } Stmt.close(); Con.close(); } catch(Exception e) { System.out.println(e); } } public void windowClosing(WindowEvent we) { this.setVisible(false); System.exit(0); } public void windowActivated(WindowEvent we) { } public void windowDeactivated(WindowEvent we) { } public void windowOpened(WindowEvent we) { } public void windowClosed(WindowEvent we) { } public void windowIconified(WindowEvent we) { } public void windowDeiconified(WindowEvent we) { } }
Last edited by sam18; Aug 27th, 2007 at 4:11 pm.
![]() |
Other Threads in the Java Forum
- Previous Thread: Resizing output window
- Next Thread: calling another function in nested class
| Thread Tools | Search this Thread |
-xlint android api applet application array arrays automation bi binary blackberry block bluetooth chat class classes client code compile compiler component database developmenthelp eclipse error exception fractal freeze functiontesting game gameprogramming givemetehcodez graphics gui html ide image input integer j2me j2seprojects java javac javaprojects jetbrains jni jpanel jtable julia learningresources lego linux list login loop loops mac map method methods mobile myregfun netbeans newbie notdisplaying number online page print problem program programming project qt recursion scanner screen server set singleton size sms sort spamblocker sql string swing system template textfields threads time title tree tutorial-sample update variablebinding windows working xor






