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_carpinel_compsys_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:

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.Math;
import java.awt.geom.*;
import javax.swing.border.*;
import javax.swing.event.*;
import java.awt.event.MouseEvent;
import java.net.*;

public class MatrixMultiplication extends Applet{

  Toolkit tk = Toolkit.getDefaultToolkit();
  Dimension d = tk.getScreenSize();
  Button continueButton = new Button("Continue");
  JRadioButton two;
  public int size = 2;
  String name = new String("Matrix Multiplication:  2 x 2");
  Button calculate = new Button("Calculate");
  
  public Button About = new Button("About");
  public Button Help = new Button("Help");

  public void init() {
    this.setBackground(Color.white);
    Panel radioPanel = new Panel();
    radioPanel.setBackground(Color.white);
    radioPanel.setLayout(new GridLayout(9,1));
    two = new JRadioButton("  2 x 2",true);
    two.setBackground(Color.white);
    ButtonGroup radioGroup = new ButtonGroup();
    ButtonGroup radioGroup2 = new ButtonGroup();
    radioGroup.add(two);
    JLabel label = new JLabel("<html>Matrix Multiplication</html>");
    JLabel label2 = new JLabel("<html>Please click continue to simulate</html>");
    radioPanel.add(label);
    radioPanel.add(label2);
    radioPanel.add(two);
    add(radioPanel);
    setLayout(new FlowLayout(FlowLayout.CENTER));
    add(continueButton);
    
    Help.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                URL codeBaseURL = getCodeBase();
                URL helpURL;
                URL aboutURL;

                try
                {
                    helpURL = new URL( codeBaseURL.toString() + "help.html" );
                    getAppletContext().showDocument( helpURL, "_blank" );
                    aboutURL = new URL( codeBaseURL.toString() + "about.html" );
                    getAppletContext().showDocument( aboutURL, "_blank" );
                    
                }
                catch ( Exception e ) { }
                }
        });
    
    About.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
            }
        });
    add(Help);
    add(About);
  
  }
class AboutDialogue extends javax.swing.JFrame implements HyperlinkListener {
    
    /** Creates new form About */
    public AboutDialogue() {
        initComponents();
        this.setSize(new java.awt.Dimension(500, 350));
        this.setBackground(Color.white);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension DialogSize = getSize();
        Point DialogLocation = new Point( ( screenSize.width
                  - DialogSize.width ) / 2, ( screenSize.height -
                  DialogSize.height ) / 2 );

        setLocation( DialogLocation );
    }
    
    //Listens for hyperlink clicks
    public void hyperlinkUpdate(HyperlinkEvent event) {
    if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        try
         {
            getAppletContext().showDocument( event.getURL(), "_blank" );
         }
         catch ( Exception e ) { }
    }
    }

    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() {
        AboutLabel = new javax.swing.JLabel();
        LowerPanel = new javax.swing.JPanel();
        OkButton = new javax.swing.JButton();
        CentralPane = new javax.swing.JScrollPane();
        MainText = new javax.swing.JEditorPane();

        setTitle("About Matrix Multiplication applyed to Systolic Architecture");
        setBackground(Color.white);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                exitForm(evt);
            }
        });

        AboutLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        AboutLabel.setText("About Matrix Multiplication applyed to Systolic Architecture");
        AboutLabel.setMaximumSize(new java.awt.Dimension(41, 55));
        AboutLabel.setMinimumSize(new java.awt.Dimension(41, 55));
        AboutLabel.setPreferredSize(new java.awt.Dimension(41, 35));
        AboutLabel.setOpaque(false);
        AboutLabel.setBackground(Color.white);
        getContentPane().add(AboutLabel, java.awt.BorderLayout.NORTH);

        LowerPanel.setPreferredSize(new java.awt.Dimension(10, 45));
        LowerPanel.setOpaque(false);
        LowerPanel.setBackground(Color.white);
        OkButton.setText("Ok");
        OkButton.setPreferredSize(new java.awt.Dimension(100, 26));
        OkButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                OkButtonActionPerformed(evt);
            }
        });

        LowerPanel.add(OkButton);

        getContentPane().add(LowerPanel, java.awt.BorderLayout.SOUTH);

        CentralPane.setPreferredSize(new java.awt.Dimension(177, 150));
        CentralPane.getViewport().setOpaque(false);
        String AboutText="<html>\n<body><b>The Matrix Multiplication Simulator</b><br><br>Copyright 2007,UK<br><br>\n";
        AboutText+="Developer: Orlando Vilas Boas Dantas.\n</body></html>";
        MainText.setEditable(false);
        MainText.setContentType("text/html");
        MainText.setText(AboutText);
        MainText.setCaretPosition(0);
        //MainText.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        MainText.setOpaque(false);
        MainText.setBackground(Color.white);
        MainText.addHyperlinkListener(this);
        CentralPane.setViewportView(MainText);
        

        getContentPane().add(CentralPane, java.awt.BorderLayout.CENTER);

        pack();
    }

    private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {
        // Add your handling code here:
        this.hide();
    }
    
    /** Exit the Application */
    private void exitForm(java.awt.event.WindowEvent evt) {
        System.exit(0);
    }
    
    
    // Variables declaration - do not modify
    private javax.swing.JButton OkButton;
    private javax.swing.JPanel LowerPanel;
    private javax.swing.JLabel AboutLabel;
    private javax.swing.JScrollPane CentralPane;
    private javax.swing.JEditorPane MainText;
    // End of variables declaration
    
  }
}

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

Recommended Answers

All 21 Replies

come back in a few years. Maybe we'll have run out of more urgent matters by then and have time to help you.

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.

come back in a few years. Maybe we'll have run out of more urgent matters by then and have time to help you.

What kind of applet are u looking for?

the kiddo has never been back, no need to resurrect a dead thread.

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

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

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?

Ah ok.Did u got any help from this forum?

Help? What do you mean?

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.

commented: ignorant homework kiddo getting agressive -3

this forum is NOT a place to ask others to do your work for you, kiddo.

And being rude and agressive towards those who might help you once you understood that is not going to make you popular.

We'll be happy to help anyone by giving ideas for their algorithm or debuging some part of the code, but don't expect for someone to read your entire code in order to figure out what is wrong when you the only comment you have made is saying that the code is messed up. What was the part that didn't work? Was it a problem with the logic or a gui problem concerning the applet? These are two separate things and you must first check that one of these works before trying putting them together.

and now johny has broken the rules of the site by swearing.
Typical for the homework kiddo, if it doesn't get what it wants it gets agressive and abusive.

Nasty little critter, the homework kiddo. Right down there with rats and venomous spiders when it comes to the desirability of them in your home.

If someone can't find something on internet the best way is to go to forums

Er.. not really. The first place to go is google; it'd save a lot of server-space and reader's time on most forums if people just looked up static reference material before even considering asking anyone else anything. Of course; it helps if you have a remote idea about what you're doing in the first place: and if you don't; you should probably be doing something else.

Er.. not really. The first place to go is google; it'd save a lot of server-space and reader's time on most forums if people just looked up static reference material before even considering asking anyone else anything. Of course; it helps if you have a remote idea about what you're doing in the first place: and if you don't; you should probably be doing something else.

Of course I have an idea, but I just asked for help.Is not asking too much is it?
God I just asked for a few line of code that I can' find on internet.

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 BASTARDD who can't keep his mouth shut.

Hey take it easy! Now you're being nasty.
Well I have asked for help but they weren't able to help me, so I went somewhere else.So its done.No harm done :)

There's a big difference between not able and not willing. I'm glad you got your problem sorted; and I hope you learned alot ( about programming ) in the process. There are a few people willing to run other's code and diagnose unspecified problems; but they're few and far between.

Your post was deleted because it contained profanity and rude, abusive language, something which currently violates the DaniWeb rules. No doubt the post which I'm responding to right now will get deleted and you'll receive an infraction for not keeping things pleasant here.

Not to mention that the DaniWeb policies clearly state that we only give homework help to those who show effort, something which I have yet to see in your previous thread.

Remember, this is supposed to be a friendly community where people can help each other and learn, not a homework service or any other misconception that may have formed in your mind when you entered DaniWeb.

please folow the rules

please folow the rules

Ok OK whatever.The thing no one helped me.Thats the thing...!

no, the thing is that you violated the rules.
Had you not done so in the first place by demanding people do your homework for you and later by being rude and abusive to people you would likely have received help.

Whether you'd have been able to correctly interpret that help and make use of it to your benefit will now never be known, as you're unlikely to ever receive much help in the future given the bad reputation you've very rapidly acrued for yourself.

we are all voluenteers. we dont help people if they dont be nice.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.