Stuck with this array

so i have my code which makes the MC go to random places on the stage, but what i want is for the MC to go to each corner of the stage randomly, not all over the stage.
think its the arrays that need to be edited but im not sure?
any one have an answer?
import flash.events.MouseEvent;
addChild(btnPos1U);
btnPos1U.x=btnPos1U.y=0;
var positionA:Array=[[stage.stageWidth-btnPos1U.width,0],
                     [0,stage.stageHeight-btnPos1U.height],
                     [stage.stageWidth-btnPos1U.width,0],
                     [stage.stageWidth-btnPos1U.width,stage.stageHeight-btnPos1U.height]];
var t:Timer=new Timer(2000,0);
t.addEventListener(TimerEvent.TIMER,f);
t.start();
function f(e:TimerEvent):void{
btnPos1U.visible = true
btnPos1U.x=Math.floor(Math.random()*(stage.stageWidth-btnPos1U.width))
btnPos1U.y=Math.floor(Math.random()*(stage.stageHeight-btnPos1U.height))
btnPos1U.addEventListener(MouseEvent.CLICK,g)
function g (e:MouseEvent):void
    btnPos1U.visible = false
    init();
    btnNeg1.addEventListener(MouseEvent.CLICK, EndUnlimited);
    btnNeg2.addEventListener(MouseEvent.CLICK, EndUnlimited);
    btnNeg3.addEventListener(MouseEvent.CLICK, EndUnlimited);
    btnNeg4.addEventListener(MouseEvent.CLICK, EndUnlimited);
    btnPos1U.addEventListener(MouseEvent.CLICK, on_press);
function EndUnlimited (e:MouseEvent):void
    gotoAndPlay(102);
stop();

There is no "MC" in your code.  If you are talking about the button that gets randomly placed, that happens in the following two lines:
btnPos1U.x=Math.floor(Math.random()*(stage.stageWidth-btnPos1U.width))
btnPos1U.y=Math.floor(Math.random()*(stage.stageHeight-btnPos1U.height ))
The array you speak of identifies the locations of the four corners of the stage, which is what you want to pick from I would guess.  Think thru what you have and what you want and figure out how to make use of what you have to get there.

Similar Messages

  • ICloud backup is unable to access the account, because email I used for iCloud account is been deleted. And my iPad is stuck with this note on a screen, can't go Settings. How do I delete my account?

    iCloud backup is unable to access my account, because email I used for iCloud account is been deleted. And my iPad is stuck with this note on a screen, can't go Settings. How do I delete or edit my iCloud account?

    You can eirther I think go on ITunes or if you can get to settings you would just go to iCloud.

  • ASR Hyper-v (VMM) to Azure and we are stuck with this error while preparing the VMM Server

    We are stuck with this error while installing ASR provider and registering with Azure Vault, can i get some help on this
    Error:
    NO Vaults could be retried for the registration key. Please ensure that
    1, your registration key has not expired.You can re-downloading registration key from Azure site Recovery portal
    2, Your system clock is not out of sync with the selected system time zone
    System Clock is set to IST and Azure to southeastasia

    Hi,
    Could you please ensure that you have downloaded the latest registration key from the portal?
    Also ensure that the machine from where you are accessing the portal and the VMM server has the right time according to your time zone.
    Thank you,
    Ruturaj

  • Can somebody help me install IOS 6.1.3 back to my iPhone 4. IOS 7 is not smooth enough as perfect as IOS 6.1.3. I am stuck with this OS, every app gives a break for 4-5 seconds to open up. And playing games in this OS using iPhone 4 is really crazy

    Can somebody help me install IOS 6.1.3 back to my iPhone 4. IOS 7 or 7.0.4 is not smooth enough as perfect as IOS 6.1.3. I am stuck with this OS, every app gives a break for 4-5 seconds to open up. And playing games in this OS using iPhone 4 is really crazy. Very much disappointed that I am not able to use IOS 7 and cant go back to what I need.

    Mani Dinesh wrote:
    Can somebody help me install IOS 6.1.3 back to my iPhone 4.
    Downgrading is not supported by Apple.
    Mani Dinesh wrote:
    ...every app gives a break for 4-5 seconds to open up. ...
    See this discussion...
    https://discussions.apple.com/message/23731048#23731048

  • I have an emac running 10.5.8  I purchased snow leopard to upgrade. during the attempt to install, the computer says this is not an intel and is mot supported.  i think this is a power pc? am i stuck with this 10.5.8 version or is there away i can upgrade

    I have an emac running 10.5.8  I purchased a copy of snow leopard from apple. upon attempting the install i read that the computer is not an intel. I believe this is a power PC?  Is there a way to upgrade to the snow leopard or am I stuck with this version 10.5.8?  Thank you for any help.

    As Niel says, no way to go past 10.5.8 on your Mac, but there is a more upto date Browser...
    TenFourFox is the most up to date browser for our PPCs, they even have G4 & G5 optimized versions...
    http://www.floodgap.com/software/tenfourfox/

  • Im stuck with this message "no bootable device, insert boot disk and press any key". Now i want to go back to mac os but everytime i turn on my laptop that message appear..kindly help... Please

    Im stuck with this message "no bootable device, insert boot disk and press any key". Now i want to go back to mac os but everytime i turn on my laptop that message appear..kindly help... Please .... Im using my usb as bootable device but it cant be detected..

    Reboot, hold the option key down, select OSX when the startup manager appears.

  • I'm stuck with this message : en attente d'éléments à copier (étape 6 sur 6).

    Hi ! I'm from Québec, Canada, so maybe there's a lot of mistakes in the following.
    I've download IOS.5 this last sunday, and since everytime I sync my Ipod I'm stuck with this message in my Itunes:
    En attend d'éléments à copier (étape 6 sur 6)
    Can I unplug my Ipod even if it's not written : OK pour déconnecter.
    Help me please, or fix that bug with an update !
    Thanks a lot.

    Apple loops and jingles are free for you to use, here's the corresponding Apple document:
    http://support.apple.com/kb/HT2931

  • Stuck with this query

    i have stuck in this query. it is giving compile error that v_customerloop invalid identifier. this does not make sense because if i comment the sql, it runs fine and i can actually see the count in the dbms output. i tried commenting out some of the where clauses but cannot pinpoint where i am making a mistake.
    can some one see if i am doing something out of ordinary.
    declare
      -- Local variables here
    o_errorcode     NUMBER;
           o_errortext     VARCHAR2(1000);
    o_LoopId      NUMBER;
    i_CustomerLoop      Kroner.Pkgsldcommon.T_CUSTOMERLOOPTYPE;
    To_CustomerLoop Kroner.Pkgsldcommon.T_CUSTOMERLOOPTYPE;
      v_sql        VARCHAR2(3000);
    v_CustomerLoop Kroner.t_CustomerLoopElement := Kroner.t_CustomerLoopElement();
    begin
        i_CustomerLoop(1).Cable := '138-2';
      i_CustomerLoop(1).coup := '501';
      i_CustomerLoop(1).TermSysID := 1178050;
      i_CustomerLoop(1).CentralOfficeName := 'TOROON45';
         i_CustomerLoop(2).Cable := '138-2';
      i_CustomerLoop(2).coup := '503';
      i_CustomerLoop(2).TermSysID := 1178052;
      i_CustomerLoop(2).CentralOfficeName := 'TOROON45';
       FOR i IN 1..i_CustomerLoop.COUNT -- Create a instance of Kroner.o_CustomerLoopElement
       LOOP 
               v_CustomerLoop.Extend();
               v_CustomerLoop(i) := Kroner.o_CustomerLoopElement(co_clli => i_CustomerLoop(i).CentralOfficeName,
                                                cable => i_CustomerLoop(i).Cable,
                                                coup => i_CustomerLoop(i).coup,
                                                termsysid => i_CustomerLoop(i).TermSysID,
                                                landing_number => i
       END LOOP;
       dbms_output.put_line('v_CustomerLoop length' || v_CustomerLoop.Count);
    v_sql:= 'select loop_f1.loopid
                 from nrms_interface.wdn_landing seg_f1, nrms_interface.wdn_loop_landing_association assoc_f1, nrms_interface.wdn_potential_loop_makeup loop_f1,
                 nrms_interface.wdn_landing seg_fx, nrms_interface.wdn_loop_landing_association assoc_fx,
                 table(cast( v_CustomerLoop as Kroner.t_CustomerLoopElement)) input_loop
            where loop_f1.CO_CLLI =  v_CustomerLoop(1).co_clli
            and loop_f1.LOOPID = assoc_f1.LOOPID
            and assoc_f1.landing_NUMBER = v_CustomerLoop(1).landing_number
            and assoc_f1.landing_ID = seg_f1.landing_ID
            and seg_f1.CABLE = v_CustomerLoop(1).cable
            and (seg_f1.low_coup <= v_CustomerLoop(1).coup and seg_f1.high_coup >= v_CustomerLoop(1).coup)
            and seg_f1.TERMSYSID = v_CustomerLoop(1).termsysid
            and assoc_f1.landing_number = 1
            and loop_f1.loopid = assoc_fx.loopid
            and assoc_fx.landing_ID = seg_fx.landing_id
            and assoc_fx.landing_number = input_loop.landing_number
            and seg_fx.CABLE = input_loop.cable
            and (seg_fx.low_coup <= input_loop.coup and seg_fx.high_coup >= input_loop.coup)
            and seg_fx.termsysid = input_loop.termsysid
            group by loop_f1.loopid
            having max(assoc_fx.landing_NUMBER) = :noOflandings
            and count(case when assoc_fx.landing_number = input_loop.landing_number then 1 else 0 end) = :noOflandings';
    EXECUTE IMMEDIATE v_sql  INTO o_LoopId
    USING  v_CustomerLoop.count,v_CustomerLoop.count;

    Hi,
    I don't know much about object types, but I think that the error is due to the usage of v_CustomerLoop variable in a different context.
    Imagine that using the EXECUTE IMMEDIATE you spawn a different process that communicates with the caller using prameters (USING) and return values (INTO).
    In this case, the variable is not visible by the new environement (it is not the same behaviour of nesting a BEGIN/END block in a procedure and referencing a parent variable)
    Hope this helps
    Max

  • I am stuck with this code- I definitely need a bail out

    I would appreciate if a good samaritan could add this code for me. I am at my wits end.
    The program I am trying to write is supposed to add students with their personal information and then display them in a GUI.
    I should be able to select a student and add a grade for that student.
    Finally I should be able to get the average for all the grades added for this student and display the average grade.
    My challenge is how to obtain all the added scores and show the students average .
    I understand my best shot is to use VECTOR API.
    I tried to write someething but it did not work at , obviously due to inexperience.
    I just can't figure how to link this average display window to the Get Average button.
    A student can have any number of grades.
    I need someone to show me the way, may be little "code guide" I am waaaay lost
    Thanks in advance
    Little Delmarie.
    THIS IS WHAT I HAVE DONE SO FAR . IT COMPILES nicely in DOS and Visual age
    // CODE GradeSystem
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import java.awt.*;
    * UsingJLists.java
    * This is a sample program for the use of JLists. You can add a student by entering their
    * information a clicking on add. You can remove a student by entering their information and
    * clicking on remove. They must be in the list to be removed. You can modify a student by
    * entering their information and clicking add. You will be asked for the new student
    * information when using modify. The add and remove buttons will disappear when modifying
    * is underway and the new information is being collected for updating.
    * @author Delmarie
    public class GradeSystem extends JDialog {
    Vector studentGrades = new Vector();
    JButton add, modify, remove;
    JList theJList;
    JPanel buttonPanel, textPanel, labelPanel, masterPanel, jlistPanel, infoPanel;
    JTextField score, possibleScore, gradeType;
    JLabel label1, label2, label3;
    public class ModifyHandler implements ActionListener {
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
    // get the student info from the text boxes
    double dScore = 0;
    double dPossibleScore = 0;
    try {
    String str1 = score.getText();
    if (str1 != null) dScore = Double.parseDouble(str1);
    String str2 = possibleScore.getText();
    if (str2 != null) dPossibleScore = Double.parseDouble(str2);
    catch(NumberFormatException e) {}
    String sGradeType = gradeType.getText();
    Grade grade = (Grade)theJList.getSelectedValue();
    if (grade == null) {
    score.setText("");
    possibleScore.setText("");
    gradeType.setText("");
    return;
    grade.setScore(dScore);
    grade.setPossibleScore(dPossibleScore);
    grade.setGradeType(sGradeType);
    theJList.repaint();
    public class RemoveHandler implements ActionListener {
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
    int removeIndex = theJList.getSelectedIndex();
    if (removeIndex == -1) {
    score.setText("");
    possibleScore.setText("");
    gradeType.setText("");
    return;
    DefaultListModel model = (DefaultListModel) theJList.getModel();
    model.removeElementAt(removeIndex);
    studentGrades.removeElementAt(removeIndex);
    // clear the textboxes
    score.setText("");
    possibleScore.setText("");
    gradeType.setText("");
    public class AddHandler implements ActionListener {
    public void actionPerformed(ActionEvent actionEvent) {
    // get the student info from the text boxes
    double dScore = 0;
    double dPossibleScore = 0;
    try {
    String str1 = score.getText();
    if (str1 != null) dScore = Double.parseDouble(str1);
    String str2 = possibleScore.getText();
    if (str2 != null) dPossibleScore = Double.parseDouble(str2);
    catch(NumberFormatException e) {}
    String sGradeType = gradeType.getText();
    // get the model and add the student to the model
    Grade g = new Grade();
    g.setScore(dScore);
    g.setPossibleScore(dPossibleScore);
    g.setGradeType(sGradeType);
    studentGrades.add(g);
    DefaultListModel model = (DefaultListModel) theJList.getModel();
    model.addElement(g);
    // display the added element
    theJList.setSelectedValue(g, true);
    public class WindowHandler extends WindowAdapter {
    public void windowClosing(WindowEvent e) {
    setVisible(false);
    /** Creates a new instance of UsingJLists */
    public GradeSystem(JFrame owner, boolean modal) {
    super(owner, modal);
    // create all of the components, put them in panels, and put the panels in JFrame
    add = new JButton("Add");
    modify = new JButton("Modify");
    remove = new JButton("Remove");
    score = new JTextField("");
    score.setColumns(10);
    possibleScore = new JTextField("");
    gradeType = new JTextField("");
    label1 = new JLabel("score");
    label2 = new JLabel("possibleScore");
    label3 = new JLabel("gradeType");
    FlowLayout flow = new FlowLayout();
    FlowLayout flow1 = new FlowLayout();
    FlowLayout flow2 = new FlowLayout();
    GridLayout grid1 = new GridLayout(7,1);
    GridLayout grid2 = new GridLayout(7,1);
    BorderLayout border3 = new BorderLayout();
    buttonPanel = new JPanel(flow);
    buttonPanel.add(add);
    buttonPanel.add(modify);
    buttonPanel.add(remove);
    labelPanel = new JPanel(grid1);
    //labelPanel.setBorder(BorderFactory.createLineBorder(Color.black));
    labelPanel.add(Box.createVerticalStrut(20));
    labelPanel.add(label1);
    labelPanel.add(Box.createVerticalStrut(20));
    labelPanel.add(label2);
    labelPanel.add(Box.createVerticalStrut(20));
    labelPanel.add(label3);
    labelPanel.add(Box.createVerticalStrut(20));
    textPanel = new JPanel(grid2);
    //textPanel.setBorder(BorderFactory.createLineBorder(Color.black));
    textPanel.add(Box.createVerticalStrut(20));
    textPanel.add(score);
    textPanel.add(Box.createVerticalStrut(20));
    textPanel.add(possibleScore);
    textPanel.add(Box.createVerticalStrut(20));
    textPanel.add(gradeType);
    textPanel.add(Box.createVerticalStrut(20));
    infoPanel = new JPanel(new FlowLayout());
    infoPanel.setBorder(BorderFactory.createTitledBorder("Grade Information"));
    infoPanel.add(Box.createHorizontalStrut(10));
    infoPanel.add(textPanel);
    infoPanel.add(Box.createHorizontalStrut(10));
    infoPanel.add(labelPanel);
    infoPanel.add(Box.createHorizontalStrut(10));
    theJList = new JList(new DefaultListModel());
    theJList.addListSelectionListener(new javax.swing.event.ListSelectionListener(){
    public void valueChanged(ListSelectionEvent evt) {
    Grade grade = (Grade)theJList.getSelectedValue();
    if (grade == null) {
    score.setText("");
    possibleScore.setText("");
    gradeType.setText("");
    return;
    score.setText(Double.toString(grade.getScore()));
    possibleScore.setText(Double.toString(grade.getPossibleScore()));
    gradeType.setText(grade.getGradeType());
    //JLabel theLabel = new JLabel("Students");
    jlistPanel = new JPanel(border3);
    jlistPanel.setBorder(BorderFactory.createTitledBorder("List of Scores"));
    jlistPanel.add(new JScrollPane(theJList));//, BorderLayout.SOUTH);
    masterPanel = new JPanel(new GridLayout(1, 2));
    masterPanel.setBorder(BorderFactory.createLineBorder(Color.black));
    // masterPanel.add(Box.createHorizontalStrut(10));
    masterPanel.add(infoPanel);
    // masterPanel.add(Box.createHorizontalStrut(10));
    masterPanel.add(jlistPanel);
    // masterPanel.add(Box.createHorizontalStrut(10));
    BorderLayout border = new BorderLayout();
    this.getContentPane().setLayout(border);
    Container theContainer = this.getContentPane();
    theContainer.add(buttonPanel,BorderLayout.SOUTH);
    theContainer.add(masterPanel, BorderLayout.CENTER);
    // now add the event handlers for the buttons
    AddHandler handleAdd = new AddHandler();
    ModifyHandler handleModify = new ModifyHandler();
    RemoveHandler handleRemove = new RemoveHandler();
    add.addActionListener(handleAdd);
    modify.addActionListener(handleModify);
    remove.addActionListener(handleRemove);
    // add the event handler for the window events
    WindowHandler handleWindow = new WindowHandler();
    this.addWindowListener(handleWindow);
    setSize(600,300);
    * Insert the method's description here.
    * Creation date: (2/24/03 4:20:07 PM)
    * @param v com.sun.java.util.collections.Vector
    public void setStudentGrades(Vector v) {
    studentGrades = v;
    DefaultListModel model = (DefaultListModel) theJList.getModel();
    model.removeAllElements();
    int size = v.size();
    for (int i = 0; i < size; i++) {
    model.addElement(v.get(i));
    score.setText("");
    possibleScore.setText("");
    gradeType.setText("");
    setVisible(true);
    // CODE2 StudentSystem
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import java.awt.*;
    * UsingJLists.java
    * This is a sample program for the use of JLists. You can add a student by entering their
    * information a clicking on add. You can remove a student by entering their information and
    * clicking on remove. They must be in the list to be removed. You can modify a student by
    * entering their information and clicking add. You will be asked for the new student
    * information when using modify. The add and remove buttons will disappear when modifying
    * is underway and the new information is being collected for updating.
    * @author Delmarie
    public class StudentSystem extends JFrame {
    StudentGradeBook studentGradeBook = new StudentGradeBook();
    GradeSystem gradeSystem = new GradeSystem(this, true);
    JButton add, modify, remove, bGrade;
    JList theJList;
    JPanel buttonPanel, textPanel, labelPanel, masterPanel, jlistPanel, infoPanel;
    JTextField name, address, email, phone, courseName, courseDescription;
    JLabel label1, label2, label3;
    StudentSystem tempObjectRef; // used to hold a class level reference to object for dispose
    boolean getStudentInfo = false;
    int saveIndexInObject;
    public class ModifyHandler implements ActionListener {
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
    // get the information for the student to modify
    String studentName = name.getText();
    String studentAddress = address.getText();
    String studentEmail = email.getText();
    if (!getStudentInfo) { // set up to get student info
    // find the correct element of the model to remove and save in class variable
    int removeIndex = -1;
    DefaultListModel model = (DefaultListModel) theJList.getModel();
    for (int i = 0; i < model.size(); i++) {
    String temp = (String) model.elementAt(i);
    if (temp.equals(name.getText())) {
    removeIndex = i;
    break;
    saveIndexInObject = removeIndex;
    if (removeIndex == -1) return;
    // change the text on the border of the info box
    infoPanel.setBorder(BorderFactory.createTitledBorder("Enter new Student Info"));
    // set up to get the modified info and remove some of the buttons
    getStudentInfo = true;
    buttonPanel.removeAll();
    buttonPanel.add(modify);
    buttonPanel.add(bGrade);
    buttonPanel.repaint();
    else {
    // reset the border and change the element at the provided index (from if above)
    getStudentInfo = false;
    infoPanel.setBorder(BorderFactory.createTitledBorder("Student Information"));
    DefaultListModel model = (DefaultListModel) theJList.getModel();
    model.setElementAt(name.getText(), saveIndexInObject);
    Student student = studentGradeBook.findStudent(saveIndexInObject);
    student.setName(name.getText());
    student.setAddress(address.getText());
    student.setEmail(email.getText());
    student.setPhone(phone.getText());
    student.setCourseName(courseName.getText());
    student.setCourseDescription(courseDescription.getText());
    // clear the textboxes
    name.setText("");
    address.setText("");
    email.setText("");
    phone.setText("");
    courseName.setText("");
    courseDescription.setText("");
    // restore all of the buttons
    buttonPanel.removeAll();
    buttonPanel.add(add);
    buttonPanel.add(modify);
    buttonPanel.add(remove);
    buttonPanel.add(bGrade);
    buttonPanel.repaint();
    public class RemoveHandler implements ActionListener {
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
    // get the student info from the text boxes
    String studentName = name.getText();
    String studentAddress = address.getText();
    String studentEmail = email.getText();
    // find the element to remove by name (you could use email address etc also)
    int removeIndex = -1; // = theJList.getSelectedIndex();
    DefaultListModel model = (DefaultListModel) theJList.getModel();
    for (int i = 0; i < model.size(); i++) {
    String temp = (String) model.elementAt(i);
    if (temp.equals(name.getText())) {
    removeIndex = i;
    break;
    if (removeIndex == -1) return;
    // remove the element at the index from the for loop
    model.removeElementAt(removeIndex);
    Student student = studentGradeBook.findStudent(removeIndex);
    studentGradeBook.removeStudent(student);
    // clear the textboxes
    name.setText("");
    address.setText("");
    email.setText("");
    phone.setText("");
    courseName.setText("");
    courseDescription.setText("");
    public class AddHandler implements ActionListener {
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
    // get the student info from the text boxes
    String studentName = name.getText();
    String studentAddress = address.getText();
    String studentEmail = email.getText();
    String studentPhone = phone.getText();
    String studentCourseName = courseName.getText();
    String studentCourseDescription = courseDescription.getText();
    // get the model and add the student to the model
    studentGradeBook.addStudent(studentName, studentAddress, studentEmail, studentPhone,
    studentCourseName, studentCourseDescription);
    DefaultListModel model = (DefaultListModel) theJList.getModel();
    model.addElement(studentName);
    // reset the text boxes
    name.setText("");
    address.setText("");
    email.setText("");
    phone.setText("");
    courseName.setText("");
    courseDescription.setText("");
    public class WindowHandler extends WindowAdapter {
    public void windowClosing(WindowEvent e) {
    gradeSystem.dispose();
    tempObjectRef.dispose();
    System.exit(0);
    /** Creates a new instance of UsingJLists */
    public StudentSystem() {
    // create all of the components, put them in panels, and put the panels in JFrame
    add = new JButton("Add");
    modify = new JButton("Modify");
    remove = new JButton("Remove");
    bGrade = new JButton("Grades");
    name = new JTextField("");
    name.setColumns(10);
    address = new JTextField("");
    email = new JTextField("");
    phone = new JTextField("");
    courseName = new JTextField("");
    courseDescription = new JTextField("");
    label1 = new JLabel("name");
    label2 = new JLabel("address");
    label3 = new JLabel("email");
    JLabel label4 = new JLabel("phone");
    JLabel label5 = new JLabel("courseName");
    JLabel label6 = new JLabel("courseDescription");
    FlowLayout flow = new FlowLayout();
    FlowLayout flow1 = new FlowLayout();
    FlowLayout flow2 = new FlowLayout();
    GridLayout grid1 = new GridLayout(13,1);
    GridLayout grid2 = new GridLayout(13,1);
    BorderLayout border3 = new BorderLayout();
    buttonPanel = new JPanel(flow);
    buttonPanel.add(add);
    buttonPanel.add(modify);
    buttonPanel.add(remove);
    buttonPanel.add(bGrade);
    bGrade.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent evt) {
    int index = theJList.getSelectedIndex();
    if (index == -1) return;
    Student student = studentGradeBook.findStudent(index);
    gradeSystem.setStudentGrades(student.getStudentGrades());
    labelPanel = new JPanel(grid1);
    //labelPanel.setBorder(BorderFactory.createLineBorder(Color.black));
    labelPanel.add(Box.createVerticalStrut(20));
    labelPanel.add(label1);
    labelPanel.add(Box.createVerticalStrut(20));
    labelPanel.add(label2);
    labelPanel.add(Box.createVerticalStrut(20));
    labelPanel.add(label3);
    labelPanel.add(Box.createVerticalStrut(20));
    labelPanel.add(label4);
    labelPanel.add(Box.createVerticalStrut(20));
    labelPanel.add(label5);
    labelPanel.add(Box.createVerticalStrut(20));
    labelPanel.add(label6);
    labelPanel.add(Box.createVerticalStrut(20));
    textPanel = new JPanel(grid2);
    //textPanel.setBorder(BorderFactory.createLineBorder(Color.black));
    textPanel.add(Box.createVerticalStrut(20));
    textPanel.add(name);
    textPanel.add(Box.createVerticalStrut(20));
    textPanel.add(address);
    textPanel.add(Box.createVerticalStrut(20));
    textPanel.add(email);
    textPanel.add(Box.createVerticalStrut(20));
    textPanel.add(phone);
    textPanel.add(Box.createVerticalStrut(20));
    textPanel.add(courseName);
    textPanel.add(Box.createVerticalStrut(20));
    textPanel.add(courseDescription);
    textPanel.add(Box.createVerticalStrut(20));
    infoPanel = new JPanel(new FlowLayout());
    infoPanel.setBorder(BorderFactory.createTitledBorder("Student Information"));
    infoPanel.add(Box.createHorizontalStrut(10));
    infoPanel.add(textPanel);
    infoPanel.add(Box.createHorizontalStrut(10));
    infoPanel.add(labelPanel);
    infoPanel.add(Box.createHorizontalStrut(10));
    theJList = new JList(new DefaultListModel());
    theJList.addListSelectionListener(new javax.swing.event.ListSelectionListener(){
    public void valueChanged(ListSelectionEvent evt) {
    int index = theJList.getSelectedIndex();
    if (index == -1) return;
    Student student = studentGradeBook.findStudent(index);
    name.setText(student.getName());
    address.setText(student.getAddress());
    email.setText(student.getEmail());
    phone.setText(student.getPhone());
    courseName.setText(student.getCourseName());
    courseDescription.setText(student.getCourseDescription());
    //JLabel theLabel = new JLabel("Students");
    jlistPanel = new JPanel(border3);
    jlistPanel.setBorder(BorderFactory.createTitledBorder("List of Students"));
    jlistPanel.add(new JScrollPane(theJList), BorderLayout.SOUTH);
    masterPanel = new JPanel(flow1);
    masterPanel.setBorder(BorderFactory.createLineBorder(Color.black));
    masterPanel.add(Box.createHorizontalStrut(10));
    masterPanel.add(infoPanel);
    masterPanel.add(Box.createHorizontalStrut(10));
    masterPanel.add(jlistPanel);
    masterPanel.add(Box.createHorizontalStrut(10));
    BorderLayout border = new BorderLayout();
    this.getContentPane().setLayout(border);
    Container theContainer = this.getContentPane();
    theContainer.add(buttonPanel,BorderLayout.SOUTH);
    theContainer.add(masterPanel, BorderLayout.NORTH);
    // now add the event handlers for the buttons
    AddHandler handleAdd = new AddHandler();
    ModifyHandler handleModify = new ModifyHandler();
    RemoveHandler handleRemove = new RemoveHandler();
    add.addActionListener(handleAdd);
    modify.addActionListener(handleModify);
    remove.addActionListener(handleRemove);
    // add the event handler for the window events
    WindowHandler handleWindow = new WindowHandler();
    this.addWindowListener(handleWindow);
    // make the frame visible and set its size and show it.
    this.setVisible(true);
    this.pack();//setSize(600,300);
    this.show();
    public static void main (String [] args) {
    StudentSystem mainObject = new StudentSystem();
    mainObject.setTempObjectRef(mainObject);
    public void setTempObjectRef(StudentSystem obj) {
    // set up a reference to this object for use in closing the window method dispose
    tempObjectRef = obj;
    // CODE 3 Student
    import java.util.*;
    * Insert the type's description here.
    * Creation date: (2/24/03 11:23:58 AM)
    * @author: Delmarie
    public class Student {
    private String name, address, phone, email, courseName, courseDescription;
    private Vector studentGrades;
    * Student constructor comment.
    public Student() {
    studentGrades = new Vector();
    * Insert the method's description here.
    * Creation date: (2/24/03 11:39:56 AM)
    * @param score double
    * @param possibleScore double
    * @param gradeType java.lang.String
    public void addGrade(double score, double possibleScore, String gradeType) {
    Grade g = new Grade();
    g.setScore(score);
    g.setPossibleScore(possibleScore);
    g.setGradeType(gradeType);
    studentGrades.add(g);
    * Insert the method's description here.
    * Creation date: (2/24/03 11:47:01 AM)
    * @return Grade
    * @param index int
    public Grade findGrade(int index) {
    return (Grade)studentGrades.get(index);
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @return java.lang.String
    public java.lang.String getAddress() {
    return address;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @return java.lang.String
    public java.lang.String getCourseDescription() {
    return courseDescription;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @return java.lang.String
    public java.lang.String getCourseName() {
    return courseName;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @return java.lang.String
    public java.lang.String getEmail() {
    return email;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:48:03 AM)
    * @return java.util.Iterator
    public Iterator getGradeIterator() {
    return studentGrades.iterator();
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @return java.lang.String
    public java.lang.String getName() {
    return name;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @return java.lang.String
    public java.lang.String getPhone() {
    return phone;
    * Insert the method's description here.
    * Creation date: (2/25/03 10:56:13 AM)
    * @return java.util.Vector
    public java.util.Vector getStudentGrades() {
    return studentGrades;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:41:52 AM)
    * @param grade Grade
    public void removeGrade(Grade grade) {
    studentGrades.remove(grade);
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @param newAddress java.lang.String
    public void setAddress(java.lang.String newAddress) {
    address = newAddress;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @param newCourseDescription java.lang.String
    public void setCourseDescription(java.lang.String newCourseDescription) {
    courseDescription = newCourseDescription;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @param newCourseName java.lang.String
    public void setCourseName(java.lang.String newCourseName) {
    courseName = newCourseName;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @param newEmail java.lang.String
    public void setEmail(java.lang.String newEmail) {
    email = newEmail;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @param newName java.lang.String
    public void setName(java.lang.String newName) {
    name = newName;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:28:57 AM)
    * @param newPhone java.lang.String
    public void setPhone(java.lang.String newPhone) {
    phone = newPhone;
    * Insert the method's description here.
    * Creation date: (2/25/03 10:56:13 AM)
    * @param newStudentGrades java.util.Vector
    public void setStudentGrades(Vector newStudentGrades) {
    studentGrades = newStudentGrades;
    //CODE 4 StudentGradeBook
    import java.util.*;
    * Insert the type's description here.
    * Creation date: (2/24/03 11:50:35 AM)
    * @author: delmarie
    public class StudentGradeBook {
    private Vector allStudents;
    * StudentGradeBook constructor comment.
    public StudentGradeBook() {
    allStudents = new Vector();
    * Insert the method's description here.
    * Creation date: (2/24/03 11:54:01 AM)
    * @param name java.lang.String
    * @param address java.lang.String
    * @param email java.lang.String
    * @param phone java.lang.String
    public void addStudent(String name, String address, String email, String phone) {
    Student student = new Student();
    student.setName(name);
    student.setAddress(address);
    student.setEmail(email);
    student.setPhone(phone);
    allStudents.add(student);
    * Insert the method's description here.
    * Creation date: (2/24/03 11:54:01 AM)
    * @param name java.lang.String
    * @param address java.lang.String
    * @param email java.lang.String
    * @param phone java.lang.String
    public void addStudent(String name, String address, String email, String phone,
    String courseName, String courseDescription) {
    Student student = new Student();
    student.setName(name);
    student.setAddress(address);
    student.setEmail(email);
    student.setPhone(phone);
    student.setCourseName(courseName);
    student.setCourseDescription(courseDescription);
    allStudents.add(student);
    * Insert the method's description here.
    * Creation date: (2/24/03 12:00:53 PM)
    * @param index Student
    public Student findStudent(int index) {
    return (Student)allStudents.get(index);
    * Insert the method's description here.
    * Creation date: (2/24/03 12:02:43 PM)
    * @return java.util.Iterator
    public Iterator getStudentIterator() {
    return allStudents.iterator();
    * Insert the method's description here.
    * Creation date: (2/24/03 11:59:41 AM)
    * @param student Student
    public void removeStudent(Student student) {
    allStudents.remove(student);
    // CODE 5 Grade
    * Insert the type's description here.
    * Creation date: (2/24/03 11:29:38 AM)
    * @author: Delmarie
    public class Grade {
    private double score, possibleScore;
    private String gradeType;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:46:07 AM)
    public Grade() {}
    * Insert the method's description here.
    * Creation date: (2/24/03 11:31:13 AM)
    * @return java.lang.String
    public java.lang.String getGradeType() {
    return gradeType;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:31:13 AM)
    * @return double
    public double getPossibleScore() {
    return possibleScore;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:31:13 AM)
    * @return double
    public double getScore() {
    return score;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:31:13 AM)
    * @param newGradeType java.lang.String
    public void setGradeType(java.lang.String newGradeType) {
    gradeType = newGradeType;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:31:13 AM)
    * @param newPossibleScore double
    public void setPossibleScore(double newPossibleScore) {
    possibleScore = newPossibleScore;
    * Insert the method's description here.
    * Creation date: (2/24/03 11:31:13 AM)
    * @param newScore double
    public void setScore(double newScore) {
    score = newScore;
    * Insert the method's description here.
    * Creation date: (2/24/03 4:03:57 PM)
    * @return java.lang.String
    public String toString() {
    return Double.toString(score);

    Ok.
    I had a look at your code and decided against showing you how to
    modify it to do what you want....
    Reason being that it's something of a mess. I guess the reason for that
    mess is a combination of the fact that you're new to Java (new to
    software in general?) and you're using Visual Age.
    So, below is a very quick (far from perfect, I just knocked it up in my
    lunch hour) example of the kind of approach I would take to the problem.
    Feel free to take ideas from it and build them in to your code.
    Whatever you do, don't hand it in as you own work. By all means, hand
    it in in addition to your own work and maybe even get your
    teacher to comment on it.
    Oh yes, if you use it, chuck me some dukes form this and your earlier
    post on the same subject. Too many folks these days are neglecting to
    allocate dukes - don't be one of them!
    Oh, one thing about using the app, double clicking on table entries
    for students and grades brings up the appropriate dialog. To create
    a new grade or delete the selected ones, use the "right mouse" context
    menu.
    Enjoy.
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.*;
    import java.text.*;
    public class Rosemary2
         static class GradeDialog
              extends JDialog
              private JTextField mScore= new JTextField();
              private JTextField mPossibleScore= new JTextField();
              private JTextField mGradeType= new JTextField();
              private Grade mGrade;
              public GradeDialog(JDialog owner) { this(owner, null); }
              public GradeDialog(JDialog owner, Grade grade)
                   super(owner, true);
                   mGrade= grade;
                   if (mGrade == null)
                        setTitle("New Grade");
                   else {
                        setTitle("Edit Grade");
                        setGrade();
                   JPanel panel= new JPanel();
                   panel.setBorder(new EmptyBorder(4,4,4,4));
                   panel.setLayout(new GridLayout(0,2,4,4));
                   panel.add(new JLabel("Score:"));
                   panel.add(mScore);
                   panel.add(new JLabel("Possible Score:"));
                   panel.add(mPossibleScore);
                   panel.add(new JLabel("Grade Type:"));
                   panel.add(mGradeType);
                   getContentPane().add(panel, BorderLayout.CENTER);
                   panel= new JPanel();
                   panel.setLayout(new GridLayout(1,0));
                   JButton ok= new JButton("OK");
                   panel.add(ok);
                   ok.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                             if (scrapeGrade())
                                  dispose();
                   JButton cancel= new JButton("Cancel");
                   panel.add(cancel);
                   cancel.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                             mGrade= null;
                             dispose();
                   JPanel wrapper= new JPanel();
                   wrapper.setBorder(new EmptyBorder(0,4,4,4));
                   wrapper.setLayout(new BorderLayout());
                   wrapper.add(panel, BorderLayout.EAST);
                   getContentPane().add(wrapper, BorderLayout.SOUTH);
                   setResizable(false);
                   pack();
                   setLocation(
                        owner.getLocation().x +
                             (owner.getSize().width/2) -
                                  (getSize().width/2),
                        owner.getLocation().y +
                             (owner.getSize().height/2) -
                                  (getSize().height/2));
              private void setGrade()
                   mScore.setText(String.valueOf(mGrade.getScore()));
                   mPossibleScore.setText(String.valueOf(mGrade.getPossibleScore()));
                   mGradeType.setText(mGrade.getGradeType());
                   mScore.selectAll();
              private boolean scrapeGrade()
                   try {
                        if (mGrade == null) {
                             mGrade= new Grade(
                                  Double.parseDouble(mScore.getText()),
                                  Double.parseDouble(mPossibleScore.getText()),
                                  mGradeType.getText());
                        else {
                             mGrade.setScore(Double.parseDouble(mScore.getText()));
                             mGrade.setPossibleScore(Double.parseDouble(mPossibleScore.getText()));
                             mGrade.setGradeType(mGradeType.getText());
                        return true;
                   catch (NumberFormatException e) {
                        JOptionPane.showMessageDialog(this, "Scores must be numbers, you Muppet!");
                   return false;
              public Grade getGrade() { return mGrade; }
         static class GradesPanel
              extends JPanel
              private Vector mGrades= new Vector();
              private JTable mTable;
              private NumberFormat mFormat= NumberFormat.getInstance();
              private JDialog mParent;
              public GradesPanel(JDialog parent, Iterator grades)
                   mParent= parent;
                   mFormat.setMaximumFractionDigits(2);
                   while (grades != null && grades.hasNext())
                        mGrades.add(grades.next());
                   setLayout(new BorderLayout());
                   setBorder(new EmptyBorder(4,4,4,4));
                   createTable();
                   JScrollPane sp= new JScrollPane(mTable);
                   add(sp, BorderLayout.CENTER);
                   MouseListener listener= new MouseAdapter() {
                        public void mousePressed(MouseEvent e) {
                             if (e.getButton() == e.BUTTON2 || e.getButton() == e.BUTTON3)     
                                  menu(e.getPoint());
                   mTable.addMouseListener(listener);
                   sp.addMouseListener(listener);
                   mTable.addMouseListener(new MouseAdapter() {
                        public void mouseClicked(MouseEvent e) {
                             if (e.getClickCount() >= 2)
                                  editGrade();
              public Iterator getGrades() { return mGrades.iterator(); }
              private void createTable()
                   mTable= new JTable(new AbstractTableModel() {
                        public int getColumnCount() {
                             return 4;
                        public int getRowCount() {
                             return mGrades.size();
                        public String getColumnName(int column) {
                             switch (column) {
                                  case 0: return "Score";
                                  case 1: return "Possible";
                                  case 2: return "Type";
                                  case 3: return "Grade";
                                  default: return "###";
                        public Object getValueAt(int row, int column) {
                             Grade grade= (Grade) mGrades.elementAt(row);
                             switch (column) {
                                  case 0: return mFormat.format(grade.getScore());
                                  case 1: return mFormat.format(grade.getPossibleScore());
                                  case 2: return grade.getGradeType();
                                  case 3: return String.valueOf(grade.getGrade()) +"%";
                                  default: return "###";
                   mTable.setPreferredScrollableViewportSize(new Dimension(10,10));
              private void menu(Point point)
                   JPopupMenu popup= new JPopupMenu();
                   JMenuItem add= new JMenuItem("Add");
                   popup.add(add);
                   add.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) { addGrade(); } });
                   if (mTable.rowAtPoint(point) >= 0 && mTable.rowAtPoint(point) == mTable.getSelectedRow()) {
                        JMenuItem edit= new JMenuItem("Edit");
                        popup.add(edit);
                        edit.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent e) { editGrade(); } });
                        if (mTable.getSelectedRowCount() > 1)
                             edit.setEnabled(false);
                        JMenuItem delete= new JMenuItem("Delete");
                        popup.add(delete);
                        delete.addActionListener(new ActionListener() {
                             public void actionPerformed(ActionEvent e) { deleteGrade(); } });
                   popup.show(this, point.x, point.y);
              private void addGrade()
                   GradeDialog dialog= new GradeDialog(mParent);
                   dialog.setVisible(true);
                   Grade grade= dialog.getGrade();
                   if (grade != null) {
                        mGrades.add(grade);
                        ((AbstractTableModel) mTable.getModel()).fireTableRowsInserted(
                             mGrades.size()-1, mGrades.size()-1);
              private void editGrade()
                   GradeDialog dialog= new GradeDialog(
                        mParent, (Grade) mGrades.get(mTable.getSelectedRow()));
                   dialog.setVisible(true);
                   if (dialog.getGrade() != null) {
                        ((AbstractTableModel) mTable.getModel()).fireTableRowsUpdated(
                             mTable.getSelectedRow(), mTable.getSelectedRow());
              private void deleteGrade()
                   while (true) {
                        int row= mTable.getSelectedRow();
                        if (row < 0)
                             break;
                        mGrades.removeElementAt(row);
                        ((AbstractTableModel) mTable.getModel()).fireTableRowsDeleted(row, row);
         static class StudentDialog
              extends JDialog
              private JTextField mName= new JTextField(12);
              private JTextField mAddress= new JTextField();
              private JTextField mPhone= new JTextField();
              private JTextField mEmail= new JTextField();
              private JTextField mCourseName= new JTextField();
              private JTextField mCourseDescription= new JTextField();
              private GradesPanel mGradesPanel;
              private Student mStudent;
              public StudentDialog(JFrame owner) { this(owner, null); }
              public StudentDialog(JFrame owner, Student student)
                   super(owner, true);
                   mStudent= student;
                   if (mStudent == null) {
                        setTitle("New Student");
                        mGradesPanel= new GradesPanel(this, null);
                   else {
                        setTitle("Edit Student: " +mStudent.getName());
                        mGradesPanel= new GradesPanel(this, mStudent.getGrades());
                   JTabbedPane tab= new JTabbedPane();
                   tab.setBorder(new EmptyBorder(4,4,4,4));
                   getContentPane().add(tab, BorderLayout.CENTER);
                   tab.add("Details", getDetailsPanel());
                   tab.add("Grades", mGradesPanel);
                   JPanel panel= new JPanel();
                   panel.setLayout(new GridLayout(1,0));
                   JButton ok= new JButton("OK");
                   panel.add(ok);
                   ok.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                             scrapeStudent();
                             dispose();
                   JButton cancel= new JButton("Cancel");
                   panel.add(cancel);
                   cancel.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                             mStudent= null;
                             dispose();
                   JPanel wrapper= new JPanel();
                   wrapper.setBorder(new EmptyBorder(0,4,4,4));
                   wrapper.setLayout(new BorderLayout());
                   wrapper.add(panel, BorderLayout.EAST);
                   getContentPane().add(wrapper, BorderLayout.SOUTH);
                   setResizable(false);
                   pack();
                   if (mStudent != null)
                        setStudent();
                   setLocation(
                        owner.getLocation().x +
                             (owner.getSize().width/2) -
                                  (getSize().width/2),
                        owner.getLocation().y +
                             (owner.getSize().height/2) -
                                  (getSize().height/2));
              private JPanel getDetailsPanel()
                   JPanel panel= new JPanel();
                   panel.setBorder(new EmptyBorder(4,4,4,4));
                   panel.setLayout(new GridLayout(0,2,4,4));
                   panel.add(new JLabel("Name:"));
                   panel.add(mName);
                   panel.add(new JLabel("Address:"));
                   panel.add(mAddress);
                   panel.add(new JLabel("Phone:"));
                   panel.add(mPhone);
                   panel.add(new JLabel("E-Mail:"));
                   panel.add(mEmail);
                   panel.add(new JLabel("Course Name:"));
                   panel.add(mCourseName);
                   panel.add(new JLabel("Course Description:"));
                   panel.add(mCourseDescription);
                   return panel;
              private void setStudent()
                   mName.setEnabled(false);
                   mName.setText(mStudent.getName());
                   mAddress.setText(mStudent.getAddress());
                   mPhone.setText(mStudent.getPhone());
                   mEmail.setText(mStudent.getEmail());
                   mCourseName.setText(mStudent.getCourseName());
                   mCourseDescription.setText(mStudent.getCourseDescription());
              private void scrapeStudent()
                   if (mStudent == null) {
                        mStudent= new Student(
                             mName.getText(),
                             mAddress.getText(),
                             mPhone.getText(),
                             mEmail.getText(),
                             mCourseName.getText(),
                             mCourseDescription.getText());
                   else {
                        mStudent.setName(mName.getText());
                        mStudent.setAddress(mAddress.getText());
                        mStudent.setPhone(mPhone.getText());
                        mStudent.setEmail(mEmail.getText());
                        mStudent.setCourseName(mCourseName.getText());
                        mStudent.setCourseDescription(mCourseDescription.getText());
                   mStudent.clearGrades();
                   Iterator grades= mGradesPanel.getGrades();
                   while (grades.hasNext())
                        mStudent.addGrade((Grade) grades.next());
              public Student getStudent() { return mStudent; }
         static class StudentFrame
              extends JFrame
              private Vector mStudents;
              private JTable mTable;
              private JButton mBtnEdit;
              private JButton mBtnDelete;
              public StudentFrame(Vector students)
                   super("Students");
                   mStudents= students;
                   createTable();
                   getContentPane().add(new JScrollPane(mTable), BorderLayout.CENTER);
                   JPanel panel= new JPanel();
                   panel.setLayout(new GridLayout(1,0));
                   JButton btn= new JButton("Add");
                   panel.add(btn);
                   btn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) { addStudent(); } });
                   mBtnEdit= new JButton("Edit");
                   panel.add(mBtnEdit);
                   mBtnEdit.setEnabled(false);
                   mBtnEdit.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) { editStudent(); } });
                   mBtnDelete= new JButton("Delete");
                   panel.add(mBtnDelete);
                   mBtnDelete.setEnabled(false);
                   mBtnDelete.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) { deleteStudent(); } });
                   JPanel wrapper= new JPanel();
                   wrapper.setLayout(new BorderLayout());
                   wrapper.add(panel, BorderLayout.WEST);
                   getContentPane().add(wrapper, BorderLayout.SOUTH);
                   btn= new JButton("Exit");
                   wrapper.add(btn, BorderLayout.EAST);
                   btn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) { System.exit(0); } });
                   pack();
              private void createTable()
                   mTable= new JTable(new AbstractTableModel() {
                        public int getColumnCount() {
                             return 7;
                        public int getRowCount() {
                             return mStudents.size();
                        public String getColumnName(int column) {
                             switch (column) {
                                  case 0: return "Name";
                                  case 1: return "Address";
                                  case 2: return "Phone";
                                  case 3: return "Email";
                                  case 4: return "Course";
                                  case 5: return "Description";
                                  case 6: return "Grade Average";
                                  default: return "###";
                        public Object getValueAt(int row, int column) {
                             Student student= (Student) mStudents.elementAt(row);
                             switch (column) {
                                  case 0: return student.getName();
                                  case 1: return student.getAddress();
                                  case 2: return student.getPhone();
                                  case 3: return student.getEmail();
                                  case 4: return student.getCourseName();
                                  case 5: return student.getCourseDescription();
                                  case 6: return student.getGrade() >= 0 ? String.valueOf(student.getGrade()) +"%": "n/a";
                                  default: return "###";
                   mTable.getSelectionModel().addListSelectionListener(
                        new ListSelectionListener() {
                             public void valueChanged(ListSelectionEvent e) {
                                  if (e.getValueIsAdjusting())
                                       return;
                                  switch (mTable.getSelectedRowCount()) {
                                       case 0:
                                            mBtnEdit.setEnabled(false);
                                            mBtnDelete.setEnabled(false);
                                            break;
                                       case 1:
                                            mBtnEdit.setEnabled(true);
                                            mBtnDelete.setEnabled(true);
                                            break;
                                       default:
                                            mBtnEdit.setEnabled(false);
                                            mBtnDelete.setEnabled(true);
                                            break;
                   mTable.addMouseListener(new MouseAdapter() {
                        public void mouseClicked(MouseEvent e) {
                             if (e.getClickCount() >= 2)
                                  editStudent();
              private void addStudent()
                   StudentDialog dialog= new StudentDialog(this);
                   dialog.setVisible(true);
                   Student student= dialog.getStudent();
                   if (student != null) {
                        mStudents.add(student);
                        ((AbstractTableModel) mTable.getModel()).fireTableRowsInserted(
                             mStudents.size()-1, mStudents.size()-1);
              private void editStudent()
                   StudentDialog dialog= new StudentDialog(
                        this, (Student) mStudents.get(mTable.getSelectedRow()));
                   dialog.setVisible(true);
                   if (dialog.getStudent() != null) {
                        ((AbstractTableModel) mTable.getModel()).fireTableRowsUpdated(
                             mTable.getSelectedRow(), mTable.getSelectedRow());
              private void deleteStudent()
                   while (true) {
                        int row= mTable.getSelectedRow();
                        if (row < 0)
                             break;
                        mStudents.removeElementAt(row);
                        ((AbstractTableModel) mTable.getModel()).fireTableRowsDeleted(row, row);
         static class Student
              private String name;
              private String address;
              private String phone ;
              private String email;
              private String courseName;
              private String courseDescription;
              private Vector grades= new Vector();
              public Student(
                   String name,
                   String address,
                   String phone,
                   String email,
                   String courseName,
                   String courseDescription)
                   setName(name);
                   setAddress(address);
                   setPhone(phone);
                   setEmail(email);
                   setCourseName(courseName);
                   setCourseDescription(courseDescription);
              public Iterator getGrades() { return grades.iterator(); }
              public void addGrade(Grade grade) { grades.add(grade); }
              public void removeGrade(Grade grade) { grades.remove(grade); }
              public void clearGrades() { grades.clear(); }
              public int getGrade()
                   if (grades.size() == 0)
                        return -1;
                   int total= 0;
                   for (int i= 0; i< grades.size(); i++)
                        total += ((Grade) grades.get(i)).getGrade();
                   return (int) (total/grades.size());
              public String getAddress() { return address; }
              public void setAddress(String newAddress) { address = newAddress; }
              public String getCourseDescription() { return courseDescription; }
              public void setCourseDescription(String newCourseDescription) { courseDescription = newCourseDescription; }
              public String getCourseName() { return courseName; }
              public void setCourseName(String newCourseName) { courseName = newCourseName; }
              public String getEmail() { return email; }
              public void setEmail(String newEmail) { email = newEmail; }
              public String getName() { return name; }
              public void setName(String newName) { name = newName; }
              public String getPhone() { return phone; }
              public void setPhone(String newPhone) { phone = newPhone; }
         static class Grade
              private double score;
              private double possibleScore;
              private String gradeType;
              public Grade(
                   double score,
                   double possibleScore,
                   String gradeType)
                   setScore(score);
                   setPossibleScore(possibleScore);
                   setGradeType(gradeType);
              public int getGrade() { return (int) ((100/possibleScore)*score); }
              public String getGradeType() { return gradeType; }
              public void setGradeType(String newGradeType) { gradeType = newGradeType; }
              public double getPossibleScore() { return possibleScore; }
              public void setPossibleScore(double newPossibleScore) { possibleScore = newPossibleScore; }
              public double getScore() { return score; }
              public void setScore(double newScore) { score = newScore; }
              public String toString() { return Double.toString(score); }
         public static void main (String [] args)
              Vector students= new Vector();
              students.add(new Student(
                   "Fred Flitstone",
                   "6 Boulder Close, Bedrock",
                   "555 1234",
                   "[email protected]",
                   "Masonary 101",
                   "Elementary chipping bits off rocks"));
              students.add(new Student(
                   "Barney Rubble",
                   "7 Boulder Close, Bedrock",
                   "555 6789",
                   "[email protected]",
                   "Masonary 101",
                   "Elementary chipping bits off rocks"));
              for (int i= 0; i< 10; i++) {
                   Student student= new Student(
                        "Student " +i,
                        i +" Dorm St, Campus",
                        "555 1234",
                        "student" +i +"@college.edu",
                        "CS 101",
                        "CS for dummies");
                   student.addGrade(new Grade(Math.random()*100, 100.0, "Passing?"));
                   student.addGrade(new Grade(Math.random()*100, 100.0, "Failing?"));
                   students.add(student);
              StudentFrame frame= new StudentFrame(students);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setBounds(32,32,640,480);
              frame.setVisible(true);
    }

  • Stuck with this SQL requirement

    Ok here's the basic test data for my requirement:
    with test_data as
      select to_date('15/12/2008','dd/mm/yyyy') as start_date, to_date('15/12/3000','dd/mm/yyyy') as end_date from dual
    select *
    from test_data;
    START_DATE END_DATE
    15-12-2008 15-12-3000We work with a pattern, which is divided in two parts:
    The first week : the first 7 days of the pattern, starting from START_DATE
    The Second week : the 7 days that follow the first week (self explanatory)
    I've got a requirement that says that if I'm supplied with a date, I have to find out what pattern (first or second week) the supplied date falls in.
    so, our pattern for test_data is:
    15-12-2008 : First day of 1st week
    16-12-2008 : Second day of 1st week
    17-12-2008 : Third day of 1st week
    18-12-2008 : Fourth day of 1st week
    19-12-2008 : Fifth day of 1st week
    20-12-2008 : Sixth day of 1st week
    21-12-2008 : Seventh day of 1st week
    22-12-2008 : First day of second week
    23-12-2008 : Second day of second week
    28-12-2008 : Seventh day of second week
    ============================== end of pattern =================================
    29-12-2008 : Start of First day of 1st week
    Now, if my date supplied is 16 Dec 2008, my sql should return something like: "First Week".
    If my date supplied is 24-12-2008, my sql should return "Second week".
    If my date supplied is 29-12-2008, my sql should return "First Week".
    phew, I thought of a connect by, but this wouldn't do the trick I think because the comparison is between columns and no rows. No clue.. I could only got til using 16/12/2008 as test date, but it doesn't work in all cases :-(:
    with test_data as
      select to_date('15/12/2008','dd/mm/yyyy') as start_pattern, to_date('15/12/3000','dd/mm/yyyy') as end_pattern from dual
    select
           start_pattern,
           start_pattern + 7,
           case when to_date('16/12/2008','dd/mm/yyyy') between start_pattern and start_pattern + 7 then
               'first'
           else
               'second'
           end week_it_belongs_in_pattern
    from test_data
    START_PATT START_PATT WEEK_I
    15-12-2008 22-12-2008 firstEdited by: user9541973 on Nov 18, 2008 8:57 PM

    Solution
    SELECT X SO , PP PATERN
    FROM DUAL
    MODEL
    DIMENSION BY (TO_DATE(&DT1,'YYYY-MM-DD') X)
    MEASURES (1 Y, 'FIRST  WEEK' PP)
    (Y[FOR X FROM DATE  &DT1 TO DATE &DT2 INCREMENT INTERVAL '1' DAY ]=0,
    PP[FOR X FROM DATE  &DT1 TO DATE &DT2 INCREMENT INTERVAL '1' DAY ]=
       DECODE(MOD(CV(X)- TO_DATE(&DT1,'YYYY-MM-DD'),7),0,'First',1,'Second ',2,
                               'Third',3,'Fourth',4,'Fifth',5,'Sixth',6,'Seventh')||
                                ' day of '||
       CASE WHEN  MOD(TO_CHAR(CV(X),'IW'),2)= 1 THEN
        'first week'
        ELSE 'second week' END  )
    Demo
    SQL> SELECT X SO , PP PATERN
      2  FROM DUAL
      3  MODEL
      4  DIMENSION BY (TO_DATE(&DT1,'YYYY-MM-DD') X)
      5  MEASURES (1 Y, 'FIRST  WEEK' PP)
      6  (Y[FOR X FROM DATE  &DT1 TO DATE &DT2 INCREMENT INTERVAL '1' DAY ]=0,
      7  PP[FOR X FROM DATE  &DT1 TO DATE &DT2 INCREMENT INTERVAL '1' DAY ]=
      8     DECODE(MOD(CV(X)- TO_DATE(&DT1,'YYYY-MM-DD'),7),0,'First',1,'Second ',2,
      9                             'Third',3,'Fourth',4,'Fifth',5,'Sixth',6,'Seventh')||
    10                              ' day of '||
    11     CASE WHEN  MOD(TO_CHAR(CV(X),'IW'),2)= 1 THEN
    12      'first week'
    13      ELSE 'second week' END  );
    Entrez une valeur pour dt1 : '2008-12-15'
    ancien   4 : DIMENSION BY (TO_DATE(&DT1,'YYYY-MM-DD') X)
    nouveau   4 : DIMENSION BY (TO_DATE('2008-12-15','YYYY-MM-DD') X)
    Entrez une valeur pour dt1 : '2008-12-15'
    Entrez une valeur pour dt2 : '2009-02-15'
    ancien   6 : (Y[FOR X FROM DATE  &DT1 TO DATE &DT2 INCREMENT INTERVAL '1' DAY ]=0,
    nouveau   6 : (Y[FOR X FROM DATE  '2008-12-15' TO DATE '2009-02-15' INCREMENT INTERVAL '1' DAY ]=0,
    Entrez une valeur pour dt1 : '2008-12-15'
    Entrez une valeur pour dt2 : '2009-02-15'
    ancien   7 : PP[FOR X FROM DATE  &DT1 TO DATE &DT2 INCREMENT INTERVAL '1' DAY ]=
    nouveau   7 : PP[FOR X FROM DATE  '2008-12-15' TO DATE '2009-02-15' INCREMENT INTERVAL '1' DAY ]=
    Entrez une valeur pour dt1 : '2008-12-15'
    ancien   8 :    DECODE(MOD(CV(X)- TO_DATE(&DT1,'YYYY-MM-DD'),7),0,'First',1,'Second ',2,
    nouveau   8 :    DECODE(MOD(CV(X)- TO_DATE('2008-12-15','YYYY-MM-DD'),7),0,'First',1,'Second ',2,
    SO         PATERN
    2008-12-15 First day of first week
    2008-12-16 Second  day of first week
    2008-12-17 Third day of first week
    2008-12-18 Fourth day of first week
    2008-12-19 Fifth day of first week
    2008-12-20 Sixth day of first week
    2008-12-21 Seventh day of first week
    2008-12-22 First day of second week
    2008-12-23 Second  day of second week
    2008-12-24 Third day of second week
    2008-12-25 Fourth day of second week
    SO         PATERN
    2008-12-26 Fifth day of second week
    2008-12-27 Sixth day of second week
    2008-12-28 Seventh day of second week
    2008-12-29 First day of first week
    2008-12-30 Second  day of first week
    2008-12-31 Third day of first week
    2009-01-01 Fourth day of first week
    2009-01-02 Fifth day of first week
    2009-01-03 Sixth day of first week
    2009-01-04 Seventh day of first week
    2009-01-05 First day of second week
    SO         PATERN
    2009-01-06 Second  day of second week
    2009-01-07 Third day of second week
    2009-01-08 Fourth day of second week
    2009-01-09 Fifth day of second week
    2009-01-10 Sixth day of second week
    2009-01-11 Seventh day of second week
    2009-01-12 First day of first week
    2009-01-13 Second  day of first week
    2009-01-14 Third day of first week
    2009-01-15 Fourth day of first week
    2009-01-16 Fifth day of first week
    SO         PATERN
    2009-01-17 Sixth day of first week
    2009-01-18 Seventh day of first week
    2009-01-19 First day of second week
    2009-01-20 Second  day of second week
    2009-01-21 Third day of second week
    2009-01-22 Fourth day of second week
    2009-01-23 Fifth day of second week
    2009-01-24 Sixth day of second week
    2009-01-25 Seventh day of second week
    2009-01-26 First day of first week
    2009-01-27 Second  day of first week
    SO         PATERN
    2009-01-28 Third day of first week
    2009-01-29 Fourth day of first week
    2009-01-30 Fifth day of first week
    2009-01-31 Sixth day of first week
    2009-02-01 Seventh day of first week
    2009-02-02 First day of second week
    2009-02-03 Second  day of second week
    2009-02-04 Third day of second week
    2009-02-05 Fourth day of second week
    2009-02-06 Fifth day of second week
    2009-02-07 Sixth day of second week
    SO         PATERN
    2009-02-08 Seventh day of second week
    2009-02-09 First day of first week
    2009-02-10 Second  day of first week
    2009-02-11 Third day of first week
    2009-02-12 Fourth day of first week
    2009-02-13 Fifth day of first week
    2009-02-14 Sixth day of first week
    2009-02-15 Seventh day of first week
    63 ligne(s) sélectionnée(s).
    SQL>  Edited by: Salim11 on 2008-11-19 08:16
    Edited by: Salim11 on 2008-11-19 08:17
    Edited by: Salim11 on 2008-11-19 08:18

  • How to uninstall and reinstall itunes...it has gone crackers... sometimes opens, other times asks for agreement, then when it is open, asks over and over for charge card verification... this is one horrid product but we are stuck with this crap... how

    How to uninstall and install itunes... has gone crazy... opens up sometimes, other times ask me to sign agreement over and over, takes me to tutorial, wants me to download what I have already downloaded...this is post last upgrade... How to fix this garbage and get back to the normal I have been used to... this is infuriating

    Hello binbingogoABC,
    Shopping on BestBuy.com should be easy and fun and not fraught with the kind of trouble that you describe. I regret very much that this has been your experience.
    Using the information you provided when you signed up for Best Buy Unboxed I was able to locate your cancelled orders. I have requested more information from my back-office partners. As soon as I have additional details about your situation, I will reply again to this message. In the interim, I'm sorry that I must impose upon your patience.
    I'm very grateful that you wrote to us with your concerns.
    Sincerely,

  • Please Help Me - I am stuck with this problem for days

    O.k I have posted couple of problems here. But the latest one is as follows
    I trying to pass a Stiring Array from Java function to my native method. the native function in turn invokkes another function that takes a char [][] as its parameter. My native function basically converts teh jobjectarray into char [][] and then invoke the other function.
    JNIEXPORT jboolean JNICALL
    Java_copilotplus_DataTransferTab_GetStatus
    (JNIEnv *env, jobject o, jobjectArray fn, jlongArray size)
    char szStr[8][33];
    int len = env->GetArrayLength( fn );
    int i=0;
    for( i=0; i < len; i++ )
    jobject obj = env->GetObjectArrayElement(fn, i);
    jstring str = (jstring)obj;
    szStr[33] = (char)env->GetStringUTFChars( str, 0 );
         //*file = szStr[i];
    BOOL status = Upload(szStr);
    return status;
    BOOL Upload(char pFileName [][33])
         return TRUE;
    Now this compiles fine and makes a dll
    But when I run my java program it gives me this error
    HotSpot Virtual Machine Error, EXCEPTION_ACCESS_VIOLATION
    # Please report this error at
    # http://java.sun.com/cgi-bin/bugreport.cgi
    # Error ID: 4F533F57494E13120E43505002D4
    What am I doing wrong
    Please Help
    Vaishali

    The problem was that I did not ahve any actual values in the String Array. I was doing like this initially
    String []file = new String[8]
    and then when i pass file to the dll it was trying to read something which was not there. That's why it was crashing.
    But now I put some values in it and then it works fine.

  • Am I always going to be stuck with this ugly calender?

    Is there any way to change the skin or fonts on iCal?
    I would like one a bit more feminine! Not so harsh and a whole LOT HAPPIER!!!
    Can anyone direct me tro an App with some sort of affordable FUN calender?
    This one feels like a cheap lawyer calender and it isn't enjoyable to remind myself to do stuff on it.
    Thanks!

    Graphics processing (including game playing) aside, there is the basic issue of "upgradability" just in case your needs change.
    Air has memory soldered to the motherboard, so cannot be upgraded by you later.
    Pro (even the 13 in model) allows both memory anf HDD to be upraded.
    If you go with Air, buy 4 GB memory (the max).
    Even if you do not take on gaming, you could find yourself using heaveier programming resources as the years take you into advanced math systems.
    But, that being said ...
    Talk with your college math department to find out the computing resources (and restrictions, such as "need Windows") especially in the 3rd and 4th year before spending a penny on this Mac.

  • I bought an iPhone 5s in China and the maps app is different.  When I go to the US will I be able to use Apple's native app or will I be stuck with this one?

    So I wanted to ask a question that my googlefoo couldn't help me solve.
    I bought an iphone at a reputable electronics market here in China and it is an AT&T model phone.  I bought it at one of the grey market locations because they were sold out elsewhere.  I contacted a friend at AT&T to make sure it is a legit AT&T model.  The phone is great and everything works perfectly including maps.  But maps are done by Autonavi here in China, not Apple.  I downloaded the Mavericks update on my mac and tried some of the new maps features and they wouldn't work with my phone.  That's okay since I live in China now but I'll be going back to the USA soon and I wonder what will happen.  Will it update the app to Apple's native one or stay with Autonavi.  Autonatvi does not have the flyover features and it is not robust in the USA.
    Who can help me out here?  Has anyone purchased a 5, 5c, or 5s in China and gone elsewhere?  Did the maps app change?
    Thank you
    tl;dr my china iphone has autonavi for maps not apple, when I go to the usa will I get the native app?

    I live in China as well and my iPhone5s is the model A1530 I bougth outside China. I have the same problem as Nikatnight with the iPhone while the iPad Air (wifi only) is working like a charm. It must be definitely something related to the carrier since I was abroad few days ago and everything worked well.
    If you pay attention at the source of your maps, you'll discover they are provided by AutoNavi instead of TomTom and make them appear in chinese with their own border interpretation. Queries are only acceppted in Chinese (p.e. if I type in english "Los Angeles International Airport"  it replies it cannot locate it)
    I suppose everything will be fine when you'll be out of censorship....
    Perhaps iOS  Apple Maps are absolutely useless for expatriate in China.
    Use Google Maps instead
    BTW, I'm surprised how much Apple might prostrate towards hard power Governments.... No matter what, money are always on top!

  • What wrong with this array program

    Hello,
    I am writing a program to calculate a sum of matrix A (power 100) and B(power 50). I do not have mathlab to check the result. However, it seem to me that the last row of result is not correct. Can any one help me, please. The below is my program. Thank you very much.
    public class MatrixT
    public static void main(String[] args) {   
         //This part is used to calculate Matrix A (power 100)
    int [][]MatrixA0 = {     {1,2,-9,5,3},{2,3,6,2,5},{1,2,3,-6,4},{5,5,2,1,0},{-6,2,3,1,0}};
         System.out.println("Matrix A (power 100) is ");
         int [][]MatrixA1 = new int [5][5];
         for (int i=0; i < 5;i++)
         for (int j=0; j<5; j++)
              MatrixA1 [j] = MatrixA0 [i][j];
         for (int n = 0 ; n < 100 ; n ++)
         int [][] MatrixA2 = new int [5][5];
         for (int i=0; i < 5;i ++)
         for (int j=0; j<5; j ++)
              //MatrixA2[i][j] = 0;
              for (int k = 0; k<5; k++)
              MatrixA2[i][j] += MatrixA1[i][k] * MatrixA0[k][j];
         for (int i=0; i < 5;i++)
         for (int j=0; j<5; j++)
              MatrixA1 [i][j] = MatrixA2[i][j];
         for (int i=0; i < 5;i++)
         for (int j=0; j<5; j++)
    System.out.print(MatrixA1[i][j] + "\t");
         System.out.println();
    // This part is used to calculate Matrix B (power 50)
    int [][]MatrixB0 = {{2,0,4,-2,-8},{1,1,2,2,7},{3,1,-5,6,3},{5,-5,-7,-1,3},{3,7,1,0,0}};
    System.out.println("Matrix B (power 50) is ");
    int [][]MatrixB1 = new int [5][5];
         for (int i=0; i < 5;i++)
         for (int j=0; j<5; j++)
              MatrixB1 [i][j] = MatrixB0 [i][j];
         for (int n = 0 ; n < 50 ; n ++)
         int [][] MatrixB2 = new int [5][5];
         for (int i=0; i < 5;i ++)
         for (int j=0; j < 5; j ++)
              //MatrixB2[i][j] = 0;
              for (int k = 0; k < 5; k++)
              MatrixB2[i][j] += MatrixB1[i][k] * MatrixB0[k][j];
         for (int i=0; i < 5;i++)
         for (int j=0; j < 5; j++)
              MatrixB1 [i][j] = MatrixB2[i][j];
    for (int i=0; i < 5;i++)
         for (int j=0; j < 5; j++)
         System.out.print(MatrixB1[i][j] + "\t");
         System.out.println();
    //This part is used to sum up the two productions of A and B
    int [][]MatrixC = new int [5][5];
         System.out.println("Matrix C (sum of A and B) ");
    for (int i=0; i < 5;i++)
         for (int j=0; j < 5; j++)
              MatrixC[i][j] = MatrixA1[i][j] + MatrixB1[i][j];
         for (int i=0; i < 5;i++) {
         for (int j=0; j < 5; j++)
         System.out.print(MatrixC[i][j] + "\t");
         System.out.println();

    hi couldnt compile ur program
    so i wrote it this wayy.hope this will help u
    import java.util.*;
    public class matrix {
    static int SIZE = 5;
    static int NO_OF_TIMES1=99;
         static int NO_OF_TIMES2=49;
    public static void main(String args[]) {
         int mA[][] = { {1,2,-9,5,3},{2,3,6,2,5},{1,2,3,-6,4},{5,5,2,1,0},{-6,2,3,1,0}};
         int mB[][] = {{2,0,4,-2,-8},{1,1,2,2,7},{3,1,-5,6,3},{5,-5,-7,-1,3},{3,7,1,0,0}};
         int mA100[][] = new int[SIZE][SIZE];
    int mB50[][] = new int[SIZE][SIZE];
         int mAPLUSB[][] = new int[SIZE][SIZE];
         for (int i=0; i<NO_OF_TIMES1; i++) {
         mA100= mmult(SIZE, SIZE, mA, mA, mA100);
         for (int i=0; i<NO_OF_TIMES2; i++) {
         mB50= mmult(SIZE, SIZE, mB, mB, mB50);
         mAPLUSB=madd(SIZE, SIZE, mA100, mB50, mAPLUSB);
         print(mAPLUSB);
    public static void print(int[][] mm){
    for(int j=0;j<SIZE;j++){
    for(int k=0;k<SIZE;k++){
                   System.out.print(mm[j][k]);
                   System.out.print("\t");
              System.out.println();
    public static int[][] mmult (int rows, int cols,
         int[][] m1, int[][] m2, int[][] m3) {
         for (int i=0; i<rows; i++) {
         for (int j=0; j<cols; j++) {
              int val = 0;
              for (int k=0; k<cols; k++) {
              val += m1[i][k] * m2[k][j];
              m3[i][j] = val;
         return m3;
         public static int[][] madd (int rows, int cols,
         int[][] m1, int[][] m2, int[][] m3) {
         for (int i=0; i<rows; i++) {
         for (int j=0; j<cols; j++) {
              int val = 0;
              val += m1[i][j] + m2[i][j];
                   m3[i][j] = val;
         return m3;

Maybe you are looking for

  • Server loses internet connection after creating virtual switch in hyper-v

    On a fresh Server 2012R2 Essentials install, I set up Hyper-v and created an external virtual switch. Connection to the vm is good but Health Report no shows loss of internet connectivity and that the router is incorrectly setup.  However, I still ha

  • Color differences between high and low res images in Illustrator pdfs

    OK, I'm creating a tradeshow graphic for a client. I designed the whole thing in Illlustrator CS6. But for the proof, I used a low res image of the sky (before we purchased it). Everyone was happy. It was a low-res RGB image imported into Illustrator

  • From and To date Validations in Adobe form

    Hi All, I'm new to the Adobe forms, I have a requirement to do validations on Date fields. from >= current to >= from               and use Month YYYY format (e.g., September 2009) Could anyone please let me know the code to validate in the Adobe for

  • APO DP - loading of Notes

    I am using APO DP V5. In a job, I am using function module /SAPAPO/MSDP_NOTE_WRITE to load Notes from a flat file into APO DP. But I seem to only load the first 133 characters. Does anyone have any experience of this? Thanks, Bob Austin, Atos Origin.

  • Form Field Display Only

    Is there anyway within ADDT to specify a form field that is input on insert but display only on update? Marking the field read-only makes it so for both. I would like to let the user input the data, not be able to change it, but still see it for refe