Solved

interface expected here

Posted on 2002-05-10
6
552 Views
Last Modified: 2006-11-17
hi All,

Do you know what's the pb here? I would be checking this post frequebtly ... Thanks.

---------------- JDK Release Build ------------------
Compiling C:\WebDesign(Dev)\Pos_Test\PrintReceipt.java
C:\WebDesign(Dev)\Pos_Test\PrintReceipt.java:12: interface expected here
public class PrintReceipt extends JFrame implements JApplet

Dawn.
0
Comment
Question by:Dawn_rico
  • 3
  • 3
6 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 50 total points
ID: 7000678
 JApplet is a class and not an interface. You cannot implement a class but you only implement the interface. You have to change your code: public class PrintReceipt extends JFrame implements JApplet to public class PrintReceipt extends JApplet and it will work. The JApplet itself extends java.awt.Panel and you can use it as you would use a JFrame.

  Hope it helps.
0
 

Author Comment

by:Dawn_rico
ID: 7000953
hi girionis ,

Thanks for your immediate detailed explanation.

frame.pack();
setTitle("Point of Sales - Receipt");

Some other doubts - for applets, am I not suppose to use these 2 methods?

Thanks.

Dawn.
0
 
LVL 35

Expert Comment

by:girionis
ID: 7001071
 You cannot use the pack() method with a JApplet. pack() is inherited from java.awt.Window and since JApplet does not extend it you cannot use it. You could always write yor own though if you feel it is necessary. If you want to set a size for your applet you can use the resize(int, int) or resize(Dimension).

  As for the title, you cannot set the title of the whole window since the applet is running within a browser and it would require you to change the title of the browser. If you want to set a title to your applet window only pass it through the parameters in the HTMl file: <param name="title" value="WStar Applet by Propix">

  Hope it helps.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Dawn_rico
ID: 7001258
hi girionis ,

:) Thanks a lot for your extra very detailed help ! You're very good in Java ..

Dawn.
0
 

Author Comment

by:Dawn_rico
ID: 7001263
hi girionis ,

:) Thanks a lot for your extra very detailed help ! You're very good in Java ..

Dawn.
0
 
LVL 35

Expert Comment

by:girionis
ID: 7001352
 Thank you for the points. :-)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now