Urgent help on Applet

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Dec 2007
Posts: 6
Reputation: Mikesvb is an unknown quantity at this point 
Solved Threads: 0
Mikesvb Mikesvb is offline Offline
Newbie Poster

Urgent help on Applet

 
0
  #1
Dec 10th, 2007
Hi there.This is my first post here.I need help urgently.
I getting desperate because I got a deadline for a project in 3 weeks time.I'm trying to do a 2 X 2 matrix multiplication applet that simulate systolic architecture.Should be something like the Wallace Tree Simulation. It can be seen here:

http://media.pearsoncmg.com/aw/aw_ca...sys_1/wallace/

I got little knowledge of Java but I have to finish this in 3 weeks time.
Anyone expert in Java that could help me here?
Here it is the code that I did so far:
  1. import java.applet.*;
  2. import java.awt.*;
  3. import java.awt.event.*;
  4. import javax.swing.*;
  5. import java.lang.Math;
  6. import java.awt.geom.*;
  7. import javax.swing.border.*;
  8. import javax.swing.event.*;
  9. import java.awt.event.MouseEvent;
  10. import java.net.*;
  11.  
  12. public class MatrixMultiplication extends Applet{
  13.  
  14. Toolkit tk = Toolkit.getDefaultToolkit();
  15. Dimension d = tk.getScreenSize();
  16. Button continueButton = new Button("Continue");
  17. JRadioButton two;
  18. public int size = 2;
  19. String name = new String("Matrix Multiplication: 2 x 2");
  20. Button calculate = new Button("Calculate");
  21.  
  22. public Button About = new Button("About");
  23. public Button Help = new Button("Help");
  24.  
  25. public void init() {
  26. this.setBackground(Color.white);
  27. Panel radioPanel = new Panel();
  28. radioPanel.setBackground(Color.white);
  29. radioPanel.setLayout(new GridLayout(9,1));
  30. two = new JRadioButton(" 2 x 2",true);
  31. two.setBackground(Color.white);
  32. ButtonGroup radioGroup = new ButtonGroup();
  33. ButtonGroup radioGroup2 = new ButtonGroup();
  34. radioGroup.add(two);
  35. JLabel label = new JLabel("<html>Matrix Multiplication</html>");
  36. JLabel label2 = new JLabel("<html>Please click continue to simulate</html>");
  37. radioPanel.add(label);
  38. radioPanel.add(label2);
  39. radioPanel.add(two);
  40. add(radioPanel);
  41. setLayout(new FlowLayout(FlowLayout.CENTER));
  42. add(continueButton);
  43.  
  44. Help.addMouseListener(new java.awt.event.MouseAdapter() {
  45. public void mouseClicked(java.awt.event.MouseEvent evt) {
  46. URL codeBaseURL = getCodeBase();
  47. URL helpURL;
  48. URL aboutURL;
  49.  
  50. try
  51. {
  52. helpURL = new URL( codeBaseURL.toString() + "help.html" );
  53. getAppletContext().showDocument( helpURL, "_blank" );
  54. aboutURL = new URL( codeBaseURL.toString() + "about.html" );
  55. getAppletContext().showDocument( aboutURL, "_blank" );
  56.  
  57. }
  58. catch ( Exception e ) { }
  59. }
  60. });
  61.  
  62. About.addMouseListener(new java.awt.event.MouseAdapter() {
  63. public void mouseClicked(java.awt.event.MouseEvent evt) {
  64. }
  65. });
  66. add(Help);
  67. add(About);
  68.  
  69. }
  70. class AboutDialogue extends javax.swing.JFrame implements HyperlinkListener {
  71.  
  72. /** Creates new form About */
  73. public AboutDialogue() {
  74. initComponents();
  75. this.setSize(new java.awt.Dimension(500, 350));
  76. this.setBackground(Color.white);
  77. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  78. Dimension DialogSize = getSize();
  79. Point DialogLocation = new Point( ( screenSize.width
  80. - DialogSize.width ) / 2, ( screenSize.height -
  81. DialogSize.height ) / 2 );
  82.  
  83. setLocation( DialogLocation );
  84. }
  85.  
  86. //Listens for hyperlink clicks
  87. public void hyperlinkUpdate(HyperlinkEvent event) {
  88. if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
  89. try
  90. {
  91. getAppletContext().showDocument( event.getURL(), "_blank" );
  92. }
  93. catch ( Exception e ) { }
  94. }
  95. }
  96.  
  97.  
  98. /** This method is called from within the constructor to
  99.   * initialize the form.
  100.   * WARNING: Do NOT modify this code. The content of this method is
  101.   * always regenerated by the Form Editor.
  102.   */
  103. private void initComponents() {
  104. AboutLabel = new javax.swing.JLabel();
  105. LowerPanel = new javax.swing.JPanel();
  106. OkButton = new javax.swing.JButton();
  107. CentralPane = new javax.swing.JScrollPane();
  108. MainText = new javax.swing.JEditorPane();
  109.  
  110. setTitle("About Matrix Multiplication applyed to Systolic Architecture");
  111. setBackground(Color.white);
  112. addWindowListener(new java.awt.event.WindowAdapter() {
  113. public void windowClosing(java.awt.event.WindowEvent evt) {
  114. exitForm(evt);
  115. }
  116. });
  117.  
  118. AboutLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  119. AboutLabel.setText("About Matrix Multiplication applyed to Systolic Architecture");
  120. AboutLabel.setMaximumSize(new java.awt.Dimension(41, 55));
  121. AboutLabel.setMinimumSize(new java.awt.Dimension(41, 55));
  122. AboutLabel.setPreferredSize(new java.awt.Dimension(41, 35));
  123. AboutLabel.setOpaque(false);
  124. AboutLabel.setBackground(Color.white);
  125. getContentPane().add(AboutLabel, java.awt.BorderLayout.NORTH);
  126.  
  127. LowerPanel.setPreferredSize(new java.awt.Dimension(10, 45));
  128. LowerPanel.setOpaque(false);
  129. LowerPanel.setBackground(Color.white);
  130. OkButton.setText("Ok");
  131. OkButton.setPreferredSize(new java.awt.Dimension(100, 26));
  132. OkButton.addActionListener(new java.awt.event.ActionListener() {
  133. public void actionPerformed(java.awt.event.ActionEvent evt) {
  134. OkButtonActionPerformed(evt);
  135. }
  136. });
  137.  
  138. LowerPanel.add(OkButton);
  139.  
  140. getContentPane().add(LowerPanel, java.awt.BorderLayout.SOUTH);
  141.  
  142. CentralPane.setPreferredSize(new java.awt.Dimension(177, 150));
  143. CentralPane.getViewport().setOpaque(false);
  144. String AboutText="<html>\n<body><b>The Matrix Multiplication Simulator</b><br><br>Copyright 2007,UK<br><br>\n";
  145. AboutText+="Developer: Orlando Vilas Boas Dantas.\n</body></html>";
  146. MainText.setEditable(false);
  147. MainText.setContentType("text/html");
  148. MainText.setText(AboutText);
  149. MainText.setCaretPosition(0);
  150. //MainText.setVerticalAlignment(javax.swing.SwingConstants.TOP);
  151. MainText.setOpaque(false);
  152. MainText.setBackground(Color.white);
  153. MainText.addHyperlinkListener(this);
  154. CentralPane.setViewportView(MainText);
  155.  
  156.  
  157. getContentPane().add(CentralPane, java.awt.BorderLayout.CENTER);
  158.  
  159. pack();
  160. }
  161.  
  162. private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {
  163. // Add your handling code here:
  164. this.hide();
  165. }
  166.  
  167. /** Exit the Application */
  168. private void exitForm(java.awt.event.WindowEvent evt) {
  169. System.exit(0);
  170. }
  171.  
  172.  
  173. // Variables declaration - do not modify
  174. private javax.swing.JButton OkButton;
  175. private javax.swing.JPanel LowerPanel;
  176. private javax.swing.JLabel AboutLabel;
  177. private javax.swing.JScrollPane CentralPane;
  178. private javax.swing.JEditorPane MainText;
  179. // End of variables declaration
  180.  
  181. }
  182. }
I know...the code is a mess...!I can't figure out.
Why doesn't work?
I'm so desperate that I even thought on asking the same thing on experts-exchange but I dunno if they're going to come out with some answer, and I have to pay for it
So any help would be great guys.
Thanks
Last edited by Ancient Dragon; Feb 17th, 2008 at 9:20 pm. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Urgent help on Applet

 
0
  #2
Dec 10th, 2007
come back in a few years. Maybe we'll have run out of more urgent matters by then and have time to help you.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 6
Reputation: Mikesvb is an unknown quantity at this point 
Solved Threads: 0
Mikesvb Mikesvb is offline Offline
Newbie Poster

Re: Urgent help on Applet

 
0
  #3
Dec 10th, 2007
Why are u being cynical?
I just asked for help...! Nothing more
Doesn't mean that everything has to stop just because this is urgent.






Originally Posted by jwenting View Post
come back in a few years. Maybe we'll have run out of more urgent matters by then and have time to help you.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 6
Reputation: Jonhlong has a little shameless behaviour in the past 
Solved Threads: 0
Jonhlong Jonhlong is offline Offline
Newbie Poster

Re: Urgent help on Applet

 
0
  #4
Feb 15th, 2008
What kind of applet are u looking for?
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Urgent help on Applet

 
0
  #5
Feb 15th, 2008
the kiddo has never been back, no need to resurrect a dead thread.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 6
Reputation: Mikesvb is an unknown quantity at this point 
Solved Threads: 0
Mikesvb Mikesvb is offline Offline
Newbie Poster

Re: Urgent help on Applet

 
0
  #6
Feb 15th, 2008
Originally Posted by jwenting View Post
the kiddo has never been back, no need to resurrect a dead thread.

Hi! Well I got it work so, that's why I never came back, but thanks anyway
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 6
Reputation: Mikesvb is an unknown quantity at this point 
Solved Threads: 0
Mikesvb Mikesvb is offline Offline
Newbie Poster

Re: Urgent help on Applet

 
0
  #7
Feb 15th, 2008
Originally Posted by Jonhlong View Post
What kind of applet are u looking for?

Hi jonhlong! Thanks for the reply, but I got it work already.No need for help
Bye
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 6
Reputation: Jonhlong has a little shameless behaviour in the past 
Solved Threads: 0
Jonhlong Jonhlong is offline Offline
Newbie Poster

Re: Urgent help on Applet

 
0
  #8
Feb 15th, 2008
Originally Posted by Mikesvb View Post
Hi jonhlong! Thanks for the reply, but I got it work already.No need for help
Bye
Ah ok.Did u got any help from this forum?
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 6
Reputation: Mikesvb is an unknown quantity at this point 
Solved Threads: 0
Mikesvb Mikesvb is offline Offline
Newbie Poster

Re: Urgent help on Applet

 
0
  #9
Feb 15th, 2008
Originally Posted by Jonhlong View Post
Ah ok.Did u got any help from this forum?
Help? What do you mean?
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 6
Reputation: Jonhlong has a little shameless behaviour in the past 
Solved Threads: 0
Jonhlong Jonhlong is offline Offline
Newbie Poster

Re: Urgent help on Applet

 
-1
  #10
Feb 16th, 2008
Originally Posted by Mikesvb View Post
Help? What do you mean?
Well I asked if anyone could help me with some code for an animation of a data flow within a system.
I got a reply from a guy called "Phaelax" and his post was like this "You want code given to you, use google. We're not here to do your work"
WTF. I came to this forum to ask for help and not to get a rude answer from some <snipped>who can't keep his mouth shut.
Last edited by happygeek; Feb 18th, 2008 at 7:22 pm. Reason: mis-spelling used to circumvent curse filtering
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC