RSS Forums RSS

How to

Please support our Java advertiser: Programming Forums
Reply
Posts: 6
Reputation: sam18 is an unknown quantity at this point 
Solved Threads: 0
sam18 sam18 is offline Offline
Newbie Poster

Question How to

  #1  
Aug 27th, 2007
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.

 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 3:11 pm.
AddThis Social Bookmark Button
Reply With Quote  
Posts: 6
Reputation: sam18 is an unknown quantity at this point 
Solved Threads: 0
sam18 sam18 is offline Offline
Newbie Poster

Re: How to

  #2  
Aug 27th, 2007
I am attaching the screen shot of above coding.
Attached Images
File Type: jpg untitled.JPG (16.5 KB, 5 views)
Reply With Quote  
Posts: 4,111
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 458
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: How to

  #3  
Aug 27th, 2007
You have this same question going in two threads. Please limit these to a single thread to avoid confusion. I have responded in your other one.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the Java Forum
Views: 499 | Replies: 2 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:20 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC