polo shirt n gamay na bag.
Ako mo apil ko basta barato or free, ug dili sad ko bz
java is nice!! karon pa ko ka notice! ehehehe
Naa man gihapon problem ang java bai. Nothing is perfect. Maka-sulti ra ta nga perfect ang JAVA kung solution gyud na sa problem nga atong gi-address.Originally Posted by jerx d great
I agree, there is no perfect programming language, it takes longer time to develop than other languages like VB or Delphi.
OT:Originally Posted by javapenguin
Depende ang answer. Depende sa gi-address nimo nga problem og sa developer. Naay specific nga problem nga dali ra ma-solve kung VB or Delphi. Depende sad sa developer. Takes time man sad to study new PL to solve sa gi-address nga problem. So diskarte rana sa developer kung asa siya.
Sakto ka bai!Originally Posted by cen
Thanks! BTW Java is one of my favorite language and javapenguin is one of my favorite istoryans! :mrgreen:Originally Posted by javapenguin
likewise broOriginally Posted by cen
i have these another problem! ok ra ako nasad i post dire?? ma ikog nmn ko ninyo mo konsulta oi hehehhehe!! file handling japn ni nga problem sa java....
dara ang code ai...!
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import java.io.*;
public class Create_Record extends JFrame{
public static final int width =350;
public static final int height = 170;
JTextField tf_population;
JTextField tf_growthRate;
JTextField tf_speciesName;
public Create_Record(){
JPanel controlNorth;
JPanel North;
JPanel South;
ActionListener RecordListener = new RecordListener();
setTitle("Create Record");
setSize(width,height);
Container record = getContentPane();
record.setLayout(new BorderLayout());
tf_speciesName = new JTextField(10);
JLabel jl_speciesName = new JLabel("Species Name");
tf_population = new JTextField(10);
JLabel jl_population = new JLabel("Population");
tf_growthRate = new JTextField(10);
JLabel jl_growthRate = new JLabel("Growth Rate");
JButton saveRecord = new JButton("Save Record");
saveRecord.addActionListener(RecordListener);
JButton createAnotherRecord = new JButton("Create Another Record");
createAnotherRecord.addActionListener(RecordListen er);
JButton exit = new JButton("exit");
exit.addActionListener(RecordListener);
controlNorth = new JPanel();
controlNorth.setLayout(new GridLayout(3,2));
controlNorth.add(jl_speciesName);
controlNorth.add(tf_speciesName);
controlNorth.add(jl_population);
controlNorth.add(tf_population);
controlNorth.add(jl_growthRate);
controlNorth.add(tf_growthRate);
North = new JPanel();
North.setLayout(new FlowLayout());
North.add(controlNorth);
South = new JPanel();
South.setLayout(new FlowLayout());
South.add(saveRecord);
South.add(createAnotherRecord);
South.add(exit);
record.add(North,BorderLayout.NORTH);
record.add(South,BorderLayout.CENTER);
}//end of constructor
class RecordListener implements ActionListener{
public void actionPerformed(ActionEvent e){
String command = e.getActionCommand();
if(e.getSource() instanceof JButton){
if("Save Record".equals(command)){
String line1 = tf_speciesName.getText();
String line2 = tf_population.getText();
String line3 = tf_growthRate.getText();
ObjectOutputStream outputStream = null;
try{
outputStream = new ObjectOutputStream(new FileOutputStream("jerus.records"));
}
catch(IOException ex){
displayErrors();
}
try{
outputStream.writeObject(line1);
outputStream.writeObject(line2);
outputStream.writeObject(line3);
}
catch(IOException exe){
displayErrors();
}
}//end of save Record.
if("Create Another Record".equals(command)){
tf_growthRate.setText("");
tf_population.setText("");
tf_speciesName.setText("");
}
if("exit".equals(command)){
System.exit(0);
}
}//end of getSource();
}//end of actionPerformed();
}//end of recordListener.
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();
}
}//end of class Create_Record.
ang approach ani nga program kay mo produce siya ug file which is called jerus.records. pero ang problema kay iyang i-overwrite ang previous nako nga gi-add nga record which means dli jud mo write tanan nakong gipang add nga records dadto sa jerus.records nga file!! ngano mana?? i think kanang akong gi bold maoy problema sa program!! can u help me pls....tanx....
Similar Threads |
|