Page 11 of 34 FirstFirst ... 89101112131421 ... LastLast
Results 101 to 110 of 335
  1. #101

    Default Re: Java Programming


    Quote Originally Posted by jerx d great
    tanx bro, by the way i'm a student! sa carbon!(usjr)..
    ahh... ok. your welcome.

  2. #102

    Default Re: Java Programming

    kaw bro, work nka??

  3. #103

    Default Re: Java Programming

    apply dayon sa NSP. tun-i ang OOP, network programming, etc.

    maau didto to start your career.

  4. #104

    Default Re: Java Programming

    Quote Originally Posted by jerx d great
    kaw bro, work nka??
    OT:
    Yup. BTW Dili ko programmer karon. Computer Science ko grad pero lahi ako trabaho karon. Laayo ra kaau sa akong course. Heheh...

  5. #105

    Default Re: Java Programming

    mao bah!!

    unsa diay work nimo ron bro??
    mayng gani ka wla pa jud mawla imong memory sa java sa??
    asa ka ni grad bro??

  6. #106

    Default Re: Java Programming

    Quote Originally Posted by jerx d great
    mao bah!!

    unsa diay work nimo ron bro??
    mayng gani ka wla pa jud mawla imong memory sa java sa??
    asa ka ni grad bro??
    PM'ed you bro.

  7. #107

    Default Re: Java Programming

    @bai cen, what if imong i read ug balik ang imong gi write bro!! unsa nimo pag retrieve niya!?

  8. #108

    Default Re: Java Programming

    Quote Originally Posted by jerx d great
    @bai cen, what if imong i read ug balik ang imong gi write bro!! unsa nimo pag retrieve niya!?
    Since na saved naman ang state sa Object. Mao ni ang pag-retrieve.

    Code:
      inputStream = new ObjectInputStream(new FileInputStream("jerus.records"));
      temp=(Animal) inputStream.readObject(); // since inputStream.readObject() returns "Object" it is important to 
    // morph the object into "animal Object"
    
      temp.getSpeciesName(); // returns String
      temp.getPopulation(); // returns String
      temp.getGrowthRate(); // returns String

  9. #109

    Default Re: Java Programming

    but bro, using this program nga akong gi post karon, unsaon mang pag butang niya sa textArea bro!! dli man jud siya modawat?? mo error man siya!?? morag ang akong problema bro sa, kay kanang akng gi bold, naa kay solution ana bro??

    dara ang code ai...

    import javax.swing.*;
    import java.awt.*;
    import java.io.*;

    public class Display_Records extends JFrame{

    public static final int width = 610;
    public static final int height = 250;
    Create_Record x = new Create_Record();
    public Display_Records(){

    JPanel North;
    JPanel South;

    addWindowListener(new WindowTerminator());
    setTitle("Display Records");
    setSize(width,height);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    JLabel speciesName = new JLabel("Species Name");
    JLabel population = new JLabel("Population");
    JLabel growthRate = new JLabel("Growth Rate");
    JLabel projectedGrowthRate = new JLabel("Projected Growth Rate");

    JTextArea content = new JTextArea(5,55);

    North = new JPanel();
    North.setLayout(new GridLayout(0,4));
    North.add(speciesName);
    North.add(population);
    North.add(growthRate);
    North.add(projectedGrowthRate);

    contentPane.add(North,BorderLayout.NORTH);

    ObjectInputStream inputStream = null;
    try{
    inputStream = new ObjectInputStream(new FileInputStream("jerus.records"));

    }
    catch(IOException e){
    displayErrors();
    }
    Animal line1 = null;

    try{
    line1 = (Animal)inputStream.readObject();
    line1.getSpeciesName();
    line1.getPopulation();
    line1.getGrowthRate();
    content.setText(line1);
    inputStream.close();


    }
    catch(Exception ex){
    displayErrors();

    }

    South = new JPanel();
    South.setLayout(new FlowLayout());
    South.add(content);

    contentPane.add(South);
    }

    public void displayErrors(){

    JFrame errors = new JFrame();
    errors.setLayout(new FlowLayout());
    errors.setSize(100,100);
    errors.setTitle("Error");
    JLabel errorMessage = new JLabel("Error Opening File!!");
    errors.add(errorMessage);
    errors.setVisible(true);
    errors.pack();
    }



    }

  10. #110

    Default Re: Java Programming

    Wrong...

    Code:
      line1 = (Animal)inputStream.readObject();
      line1.getSpeciesName();
      line1.getPopulation();
      line1.getGrowthRate();
      content.setText(line1);
      inputStream.close();
    Wrong since line1 is an Object Animal. Pwede ra unta to line1.toString() ang gamiton pero wala nimo gi-override ang object.toString() method sa Object Animal.

    Solution...

    Code:
      String text="";
      line1 = (Animal)inputStream.readObject();
      text="Name: " + line1.getSpeciesName() +"\n";
      text=text + "Population: " + line1.getPopulation() + "\n";
      text=text+ "Growth Rate: " + line1.getGrowthRate()+ "\n";
      content.setText(text);
      inputStream.close();

  11.    Advertisement

Page 11 of 34 FirstFirst ... 89101112131421 ... LastLast

Similar Threads

 
  1. JAVA PROGRAMMING *****
    By bardnekom in forum Programming
    Replies: 20
    Last Post: 04-18-2013, 12:51 PM
  2. MOVED: JAVA PROGRAMMING *****
    By vern in forum Software & Games (Old)
    Replies: 0
    Last Post: 03-23-2008, 02:43 AM
  3. Java programming help pls...
    By mr_gwen in forum Programming
    Replies: 6
    Last Post: 11-03-2006, 12:30 AM
  4. nid help..java programming
    By ronninalpha in forum Programming
    Replies: 3
    Last Post: 09-13-2006, 07:55 PM
  5. MOVED: Java Programming
    By BadDudes in forum Software & Games (Old)
    Replies: 0
    Last Post: 04-28-2006, 12:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top