wildpeach75's Profile
Reputation: 0
Apprentice
- Group:
- Members
- Active Posts:
- 19 (0.06 per day)
- Joined:
- 21-July 12
- Profile Views:
- 152
- Last Active:
Aug 03 2012 07:39 AM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: I need an explanation about an error.
Posted 29 Jul 2012
I have my code down to 3 errors and can not understand why I am getting these error message. Can someone please help me understand what I am doing wrong. Here is my code again and the error message that I am getting.
import java.awt.*; import java.awt.event.*; import java.awt.font.*; import java.awt.geom.*; import java.awt.image.*; import java.text.*; import javacard.framework.Applet; import javax.swing.*; public class PieChart2 { public static void main(String[] args) { JFrame f = new JFrame("Pie Chart"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(new PieChartPanel()); f.setSize(350,300); f.setLocation(300,300); f.setVisible(true); } private static class JFrame { public JFrame(String pie_Chart) { } } private static class PieChartPanel { public PieChartPanel() { } } } /** set as enum package PieChartPanel extends JPanel { BufferedImage image; final int PAD = 30; Font font; NumberFormat numberFormat; public PieChartPanel() { font = new Font("Book Antiqua", Font.BOLD, 20); numberFormat = NumberFormat.getPercentInstance(); addMouseListener(new Visibility(this)); addComponentListener(new ComponentAdapter() {}); } protected void paintComponent(Graphics graphics) { super.paintComponent(graphics); Graphics2D graphics2d = (Graphics2D)graphics; graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); createChartImage(); graphics2d.drawImage(image, 0, 0, this); } private void createChartImage() { int[] marks = { 85, 10, 5 }; int width = getWidth(); int height = getHeight(); int cp = width/2; int cq = height/2; image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); g2.setPaint(Color.yellow); g2.fillRect(0, 0, width, height); g2.setPaint(Color.blue); int pie = Math.min(width,height) - 2*PAD; g2.draw(new Ellipse2D.Double(cp - pie/2, cq - pie/2, pie, pie)); double total = 0; for(int j = 0; j < marks.length; j++) total += marks[j]; double theta = 0, phi = 0; double p, q; for(int j = 0; j < marks.length; j++) { p = cp + (pie/2) * Math.cos(theta); q = cq + (pie/2) * Math.sin(theta); g2.draw(new Line2D.Double(cp, cq, p, q)); phi = (marks[j]/total) * 2 * Math.PI; p = cp + (9*pie/24) * Math.cos(theta + phi/2); q = cq + (9*pie/24) * Math.sin(theta + phi/2); g2.setFont(font); String st = String.valueOf(marks[j]); FontRenderContext frc = g2.getFontRenderContext(); float textWidth = (float)font.getStringBounds(st, frc).getWidth(); LineMetrics lm = font.getLineMetrics(st, frc); float sp = (float)(p - textWidth/2); float sq = (float)(q + lm.getAscent()/2); g2.drawString(st, sp, sq); p = cp + (pie/2 + 4*PAD/5) * Math.cos(theta + phi/2); q = cq + (pie/2 + 4*PAD/5) * Math.sin(theta+ phi/2); st = numberFormat.format(marks[j]/total); textWidth = (float)font.getStringBounds(st, frc).getWidth(); lm = font.getLineMetrics(st, frc); sp = (float)(p - textWidth/2); sq = (float)(q + lm.getAscent()/2); g2.drawString(st, sp, sq); theta += phi; } g2.dispose(); } public void toggleVisibility() { repaint(); } private void repaint() { } } package Visibility extends MouseAdapter { PieChartPanel piechart; public Visibility(PieChartPanel pc) { piechart = pc; } public void mousePressed(MouseEvent event) { if(event.getClickCount() > 1) piechart.toggleVisibility(); } private static class MouseEvent { public MouseEvent() { } } } package extendedapplet1; import java.io.IOException; import java.io.PrintWriter; import javacard.framework.*; import javacardx.framework.JCSystem; /** * * @author Peachy */ /** set as enum * public PieChart2 extends Applet { /** * Installs this applet. * * @param bArray * the array containing installation parameters * @param bOffset * the starting offset in bArray * @param bLength * the length in bytes of the parameter data in bArray */ public static void install(byte[] bArray, short bOffset, byte bLength) { new PieChart2(); } /** * Only this class install method should create the applet object. */ // set as enum protected PieChart2() { *register*(); } /** * Processes an incoming APDU. * * @see APDU * @param apdu * the incoming APDU */ // set as enum @Override public void process(APDU apdu) { //Insert your code here } }
Error message:
ant -f C:\\Users\\Peachy\\Documents\\NetBeansProjects\\PieChart2 run __reset_for_debug__: init-platform-properties: Using JavaCard Platform Definition at C:\Users\Peachy\AppData\Roaming\NetBeans\7.2\config\Services\Platforms\org-netbeans-api-java-Platform\javacard_default.jcplatform Java Card Home is C:\Program Files (x86)\NetBeans 7.2\javacard\JCDK3.0.2_ConnectedEdition (Java Card Platform) init-ri-properties: init-device-properties: Platform device property name is jcplatform.javacard_default.devicespath Computed device folder path is C:\Users\Peachy\AppData\Roaming\NetBeans\7.2\config\org-netbeans-modules-javacard\servers\javacard_default Platform device file path property name is C:\Users\Peachy\AppData\Roaming\NetBeans\7.2\config\org-netbeans-modules-javacard\servers\javacard_default\Default Device.jcard Deploying to device Default Device http port 8019 init-keystore: Keystore is C:\Program Files (x86)\NetBeans 7.2\javacard\JCDK3.0.2_ConnectedEdition/samples/keystore/a.keystore build-dependencies: unpack-dependencies: compile: Compiling 12 source files to C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\build\APPLET-INF\classes C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\src\extendedapplet1\PieChart2.java:169: error: class, interface, or enum expected public static void install(byte[] bArray, short bOffset, byte bLength) { C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\src\extendedapplet1\PieChart2.java:170: error: class, interface, or enum expected new PieChart2(); } C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\src\extendedapplet1\PieChart2.java:180: error: class, interface, or enum expected } C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\src\extendedapplet1\PieChart2.java:193: error: class, interface, or enum expected public void process(APDU apdu) { 4 errors C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\nbproject\build-impl.xml:273: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 0 seconds) -
In Topic: I need an explanation about an error.
Posted 29 Jul 2012
I now have this code down to four errors from the five that I originally posted. Here are the current errors.
ant -f C:\\Users\\Peachy\\Documents\\NetBeansProjects\\PieChart2 build init-platform-properties: Using JavaCard Platform Definition at C:\Users\Peachy\AppData\Roaming\NetBeans\7.2\config\Services\Platforms\org-netbeans-api-java-Platform\javacard_default.jcplatform Java Card Home is C:\Program Files (x86)\NetBeans 7.2\javacard\JCDK3.0.2_ConnectedEdition (Java Card Platform) init-ri-properties: init-device-properties: Platform device property name is jcplatform.javacard_default.devicespath Computed device folder path is C:\Users\Peachy\AppData\Roaming\NetBeans\7.2\config\org-netbeans-modules-javacard\servers\javacard_default Platform device file path property name is C:\Users\Peachy\AppData\Roaming\NetBeans\7.2\config\org-netbeans-modules-javacard\servers\javacard_default\Default Device.jcard Deploying to device Default Device http port 8019 init-keystore: Keystore is C:\Program Files (x86)\NetBeans 7.2\javacard\JCDK3.0.2_ConnectedEdition/samples/keystore/a.keystore build-dependencies: unpack-dependencies: compile: Compiling 12 source files to C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\build\APPLET-INF\classes C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\src\extendedapplet1\PieChart2.java:155: error: class, interface, or enum expected public PieChart2 extends Applet { C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\src\extendedapplet1\PieChart2.java:170: error: class, interface, or enum expected public static void install(byte[] bArray, short bOffset, byte bLength) { C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\src\extendedapplet1\PieChart2.java:180: error: class, interface, or enum expected protected PieChart2(){ C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\src\extendedapplet1\PieChart2.java:195: error: class, interface, or enum expected public void process(APDU apdu){ 4 errors C:\Users\Peachy\Documents\NetBeansProjects\PieChart2\nbproject\build-impl.xml:273: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 0 seconds) -
In Topic: Error messages
Posted 22 Jul 2012
Can you explain this a little better I don't understand what you are trying to tell me to do. -
In Topic: Error with last bracket
Posted 22 Jul 2012
I am in an online class and trying to figure this stuff out on my own without an instructor's help. I have no one that I can turn to for help so I am trying to ask for help on here. I don't want you to give my the answer just help me figure out what I am doing wrong. -
In Topic: Error with last bracket
Posted 22 Jul 2012
If I send you the assignment that I am working do you think you might be able to suggest something to help me?
Here is my assignment requirements:
Create a GUI-based program to accept name of donor, name of charity, and amount of pledge from the user.
Display a list of entries in a JTextArea or JTable.
Submit the .java source file for this program.
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
wildpeach75 hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
wildpeach75 has no profile comments yet. Why not say hello?