The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Java Help
|
EJB - Compile time error
Discuss Compile time error in the Java Help forum on Dev Shed. Compile time error Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

January 17th, 2013, 02:44 PM
|
|
Registered User
|
|
Join Date: Jan 2013
Posts: 1
Time spent in forums: 5 m 8 sec
Reputation Power: 0
|
|
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();
}
}
|

January 17th, 2013, 03:36 PM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: Eastern Florida
|
|
|
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
|

January 21st, 2013, 06:49 AM
|
|
|
The error looks to be on the line:
Try switching this to:
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.
|

January 21st, 2013, 06:53 AM
|
 |
Contributing User
|
|
Join Date: Aug 2010
Location: Eastern Florida
|
|
|
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.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|