Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 17th, 2013, 02:44 PM
arslan598 arslan598 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 1 arslan598 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 8 sec
Reputation Power: 0
Exclamation EJB - Compile time error

I am having a problem in this file.. it gives a compile time error and the error is
"Run_Project.java uses or overrides a deprecated API
Compile with -Xlint:deprecation for details"







/**
* @(#)Run_Project.java
*
*
* @author Choto
* @version 1.00 2009/9/8
*/

import java.awt.*;
import javax.swing.*;
import java.io.*;

public class Run_Project {
int casharray[]={10000,20000,40000,80000,160000,320000,640000,1250000,2500000,
5000000,10000000},
questionno[]=new int[11],score,pos;

String answer,useranswer="asd";

Cash d=new Cash();
Question q=new Question();
OptionA opa=new OptionA();
OptionB opb=new OptionB();
OptionC opc=new OptionC();
OptionD opd=new OptionD();

JFrame jf;

Run_Project() {
try{
buildGUI();
buildarray();
perform();
}catch(Exception e){}
}

public boolean questioncheck(int num)
{
for (int i = 0; i<questionno.length; i++)
{
if(num==questionno[i])
return true;
}
return false;
}

public void buildGUI() throws Exception
{

jf=new JFrame("Kaun Banega Crorepati");

Toolkit t=Toolkit.getDefaultToolkit();
Dimension dim=t.getScreenSize();
int width=(int)dim.getWidth(); int height=(int)dim.getHeight();


JLayeredPane jlp1=new JLayeredPane(),
jlp2=new JLayeredPane(),
jlp3=new JLayeredPane();

Box panelbox=new Box(BoxLayout.Y_AXIS);

jlp1.setLayout(new BoxLayout(jlp1,BoxLayout.X_AXIS));
jlp2.setLayout(new BorderLayout());
jlp3.setLayout(new GridLayout(2,2));

jlp1.add(BorderLayout.EAST,new LogoPanel());
jlp1.add(BorderLayout.WEST,d);

jlp3.add(opa);jlp3.add(opb);
jlp3.add(opc);jlp3.add(opd);
jlp3.setPreferredSize(new Dimension(1250,160));

panelbox.add(jlp1);panelbox.createVerticalStrut(200);
panelbox.add(q);
panelbox.add(jlp3);

jf.getContentPane().add(panelbox);

jf.setSize(width,height);
jf.setVisible(true);
jf.setAlwaysOnTop(true);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

public void buildarray(){
int count=-1;

while (count!=(questionno.length-1)){
int qno=(int)((Math.random()*16)+1);
if(questioncheck(qno)==false){
count+=1;
questionno[count]=qno;
}
}
}

public void correct_answer(){
if(opa.optiona.equals(answer)){
opa.wrong=1;
opa.repaint();
}
else if(opb.optionb.equals(answer)){
opb.wrong=1;
opb.repaint();
}
else if(opc.optionc.equals(answer)){
opc.wrong=1;
opc.repaint();
}
else if(opd.optiond.equals(answer)){
opd.wrong=1;
opd.repaint();
}
}

public void perform()throws Exception{

for (int i = 0; i<questionno.length; i++){

int lineno=0;
String fname="Questions/Question"+questionno[i]+".txt",str;

FileReader fr=new FileReader(fname);
BufferedReader br=new BufferedReader(fr);

while ((str=br.readLine())!=null) {
lineno++;
switch (lineno) {
case 1: q.question=str;
q.repaint();
break;
case 2: opa.optiona=str;
opa.repaint();
break;
case 3: opb.optionb=str;
opb.repaint();
break;
case 4: opc.optionc=str;
opc.repaint();
break;
case 5: opd.optiond=str;
opd.repaint();
break;
case 6: answer=str;
break;
default :
}
}

while ((opa.clicked==false)
&&(opb.clicked==false) && (opc.clicked==false ) && (opd.clicked==false)) {
}

if(opa.clicked==true)
if(opa.optiona.equals(answer)) {
opa.wrong=1;
opa.repaint();
}
else {
opa.wrong=2;
opa.repaint();
correct_answer();
break;
}
else if(opb.clicked==true)
if(opb.optionb.equals(answer)) {
opb.wrong=1;
opb.repaint();
}
else {
opb.wrong=2;
opb.repaint();
correct_answer();
break;
}
else if(opc.clicked==true)
if(opc.optionc.equals(answer)) {
opc.wrong=1;
opc.repaint();
}
else {
opc.wrong=2;
opc.repaint();
correct_answer();
break;
}
else if(opd.clicked==true)
if(opd.optiond.equals(answer)) {
opd.wrong=1;
opd.repaint();
}
else {
opd.wrong=2;
opd.repaint();
correct_answer();
break;
}


score=casharray[pos++];
d.current=score;
d.yc=390;
d.repaint();

Thread.sleep(1000);

opa.clicked=false;opc.clicked=false;
opb.clicked=false;opd.clicked=false;

opa.wrong=0;opb.wrong=0;
opc.wrong=0;opd.wrong=0;
}

if(score!=10000000 && score>80000){
score=casharray[pos-2];
d.current=score;
d.yc=390;d.yc2+=60;
d.repaint();
}
Thread.sleep(2000);
jf.setContentPane(new FinalScore(score));
SwingUtilities.updateComponentTreeUI(jf);
Thread.sleep(5000);
jf.hide();
new Intro().main(new String[]{"jhshsh"});
}

public static void main (String[] args) throws Exception{
new Run_Project();
}
}

Reply With Quote
  #2  
Old January 17th, 2013, 03:36 PM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: Eastern Florida
Posts: 2,952 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 2 h 33 m 55 sec
Reputation Power: 345
What messages do you get when you:
Compile with -Xlint:deprecation for details

The compiler will give you more messages if you use the -Xlint option:
D:\Java\jdk1.6.0_29\bin\javac.exe -Xlint AXgift2.java


Please edit the post and wrap the code in code tags

Reply With Quote
  #3  
Old January 21st, 2013, 06:49 AM
Aurum84 Aurum84 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 74 Aurum84 User rank is Sergeant (500 - 2000 Reputation Level)Aurum84 User rank is Sergeant (500 - 2000 Reputation Level)Aurum84 User rank is Sergeant (500 - 2000 Reputation Level)Aurum84 User rank is Sergeant (500 - 2000 Reputation Level)Aurum84 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 23 h 5 m 49 sec
Reputation Power: 17
The error looks to be on the line:

Code:

jf.hide();


Try switching this to:

Code:
setVisible(false);


Several objects, such as Cash and FinalFrame, are missing so it is hard to compile it. After this change the deprecation warning, listed as an error, is removed.

Reply With Quote
  #4  
Old January 21st, 2013, 06:53 AM
NormR's Avatar
NormR NormR is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Aug 2010
Location: Eastern Florida
Posts: 2,952 NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level)NormR User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 2 h 33 m 55 sec
Reputation Power: 345
The OP still needs to use the -Xlint option with the compiler. There are other useful things the compiler will tell you about possible problems in the code.
Comments on this post
stdunbar agrees!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > EJB - Compile time error

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap