Page 6 of 34 FirstFirst ... 345678916 ... LastLast
Results 51 to 60 of 335
  1. #51

    Default Re: Java Programming


    no problem with the jdk package im using..

    prob lang is it wont run if the apps server and database resides in one single linux box...

  2. #52

    Default Re: Java Programming

    wat if naa sa linux imong appserver ug db then access it from other pc? mo work or dli?

  3. #53

    Default Re: Java Programming

    Quote Originally Posted by M@rv|n
    wat if naa sa linux imong appserver ug db then access it from other pc? mo work or dli?
    wnt work bro..

  4. #54

    Default Re: Java Programming

    mu work diay, but throwing some errors...

  5. #55

    Default Re: Java Programming

    Does anyone know of a free java API in the net for Printing, making hardcopy. I don't want to use Crystal Report, is there a free option?

  6. #56

    Default Re: Java Programming

    ^^^ naa, mura JasperReports ang name... its opensourced...

  7. #57

    Default Re: Java Programming

    Thanks, I'll check out Jasper Reports

  8. #58

    Default Re: Java Programming

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

    public class TextFileOpen extends JFrame implements ActionListener{

    public static final int width = 400;
    public static final int height = 300;
    JTextArea textArea;
    JTextField tfFilename;

    public TextFileOpen(){

    JPanel North;
    JPanel South;

    setTitle("TextFileOpen");
    setSize(width,height);
    addWindowListener(new WindowTerminator());
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());
    contentPane.setBackground(Color.GRAY);

    JLabel fileName = new JLabel("File Name:");

    tfFilename = new JTextField(10);

    JButton open = new JButton("Open");
    // open.setBackground(Color.RED);
    open.addActionListener(this);

    JButton delete = new JButton("Delete");
    //delete.setBackground(Color.RED);
    delete.addActionListener(this);

    North = new JPanel();
    North.setLayout(new FlowLayout());
    North.add(fileName);
    North.add(tfFilename);
    North.add(open);
    North.add(delete);
    contentPane.add(North,BorderLayout.NORTH);

    textArea = new JTextArea(10,30);


    South = new JPanel();
    South.setLayout(new FlowLayout());
    South.add(textArea);
    contentPane.add(South,BorderLayout.CENTER);
    }

    public void actionPerformed(ActionEvent e){
    String command = e.getActionCommand();

    if(e.getSource() instanceof JButton){

    if("Open".equals(command)){

    String filename = tfFilename.getText();
    try{
    BufferedReader inputStream = null;
    inputStream = new BufferedReader(new FileReader(filename));
    String line = null;
    line = inputStream.readLine();
    textArea.setText(line);
    textArea.getText();
    line = inputStream.readLine();
    textArea.setText(line);
    textArea.getText();
    inputStream.close();

    }catch(FileNotFoundException ex){
    textArea.setText("Error Opening the file!! ");
    }
    catch(IOException exe){

    textArea.setText("Error reading from file!!");
    }
    }

    if("Delete".equals(command)){

    textArea.setText("");
    }
    }

    }
    public static void main(String[] args){

    TextFileOpen r = new TextFileOpen();
    r.setVisible(true);
    }
    }

    naa lang unta koy i konsulta ninyo mga maayo ug java bah!! kani nga program kay naggamit ug filehandling!!, now, ang problema nako! kay dli mo display ang iyang content sa source nga akong gi open! ang mo display ra kay ang last sentence sa txtfile! ngano mana?? can u pls. help me about this problem!! i think ang problema jud ani nga program kay kanang gi bold nako nga part sa program! can u help me about this!? tanx..!!

  9. #59

    Default Re: Java Programming



    if("Open".equals(command)){

    String filename = tfFilename.getText();
    try{
    BufferedReader inputStream = null;
    inputStream = new BufferedReader(new FileReader(filename));
    String line = null;
    line = inputStream.readLine();
    textArea.setText(line);
    textArea.getText(); // Useless man ni
    line = inputStream.readLine();
    textArea.setText(line); // Automatic mo-puli ni siya
    textArea.getText(); // Same. Useless sad ni
    inputStream.close();

    }catch(FileNotFoundException ex){
    textArea.setText("Error Opening the file!! ");
    }
    catch(IOException exe){

    textArea.setText("Error reading from file!!");
    }
    }

    [br]Posted on: September 04, 2006, 04:01:36 PM_________________________________________________

    @jerx d great: Try lang ni siya bai. Dili gani mo-work aw. Dili gyud gyud heheh..






    if("Open".equals(command)){

    String filename = tfFilename.getText();
    try{

    BufferedReader inputStream = null;
    inputStream = new BufferedReader(new FileReader(filename));

    String tmpStr = "";

    if (inputStream != null) {
    while((line = inputStream.readLine()) != null) {
    tmpStr += (line + "\n");
    }
    textArea.setText(tmpStr);
    }

    inputStream.close();

    }catch(FileNotFoundException ex){
    textArea.setText("Error Opening the file!! ");
    }
    catch(IOException exe){

    textArea.setText("Error reading from file!!");
    }
    }

  10. #60

    Default Re: Java Programming

    I think it is better to use append method not setText

    textArea.append("the message to be appended");

  11.    Advertisement

Page 6 of 34 FirstFirst ... 345678916 ... 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