Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: JAVA GUI and FILE TEXT

  1. #1
    Junior Member
    Join Date
    May 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JAVA GUI and FILE TEXT

    Hello,I have a problem,I need to use JFrame ,and JTextField for name,age and other,and i must to catch that information from JTextField and save in txt.file and on the call button that information from JTextField who save on txt file to show.
    Please help me.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,199
    Thanks
    49
    Thanked 2,174 Times in 2,147 Posts

    Default Re: JAVA GUI and FILE TEXT

    Can you post the code you are having problems with and explain what the problems are?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    May 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JAVA GUI and FILE TEXT

    I have jFramem with someone Textfield who need to be cheked,and that information whick you entered in JTextfield,need to save on someone txt.file when you press button,when you press other button need to show that information whick you entered in JTF.I need y to pick up Jtextfield,save on txt.file and show that.


    port java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Frame;
    import java.awt.GridLayout;
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import static javax.swing.JFrame.EXIT_ON_CLOSE;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;


    public class Projektni extends JFrame {
    public Projektni()
    {
    JPanel panel=new JPanel (new GridLayout(6, 7));



    panel.add(new JLabel("Ime studenta:"));
    panel.add(new JTextField(10));
    panel.add(new JLabel("Prezime studenta:"));
    panel.add(new JTextField(15));
    panel.add(new JLabel("Broj indeksa studenta:"));
    panel.add(new JTextField(5));

    String[] seminari = {"Microsoft","MAC","Java"};
    JComboBox cek = new JComboBox(seminari);
    panel.add(cek);
    panel.add(new JButton("Upisi"));
    panel.add(new JButton("Prikazi"));
    add(panel,BorderLayout.CENTER);
    }

    public static void main(String[] args) {
    JFrame frame = new Projektni();
    frame.setSize(500, 500);
    frame.setLocationRelativeTo(null);
    frame.setTitle("Seminari");
    frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);

    }


    }

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,860
    My Mood
    Mellow
    Thanks
    179
    Thanked 631 Times in 618 Posts

    Default Re: JAVA GUI and FILE TEXT

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly per the above link.

  5. #5
    Junior Member amitection's Avatar
    Join Date
    May 2014
    Location
    India
    Posts
    24
    My Mood
    Busy
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default Re: JAVA GUI and FILE TEXT

    Well i am doing something similar with my code but there is an issue.
    The link i am providing you contains some code.
    The code creates a JOptionPane with multiple JTextFields and Outputs the Entered Stuff to a file.

    JOptionPane with Multiple JTextFields

    I haven't read your code yet but the problem i am facing with my code is that the output to the text file isn't right. Maybe you would like to check it out and have any suggestions.
    ăϻі

  6. #6
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,860
    My Mood
    Mellow
    Thanks
    179
    Thanked 631 Times in 618 Posts

    Default Re: JAVA GUI and FILE TEXT

    @amitection: Please start a new topic with your current question rather than hijacking someone else's.

Similar Threads

  1. Search and delete data to a Text file in GUI
    By Nathanlll in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 24th, 2013, 04:36 PM
  2. Java code Split text file into multiple text file
    By jayraj in forum What's Wrong With My Code?
    Replies: 26
    Last Post: April 19th, 2013, 06:14 AM
  3. Saving login information into a text file in my GUI App
    By lf2killer in forum Java Theory & Questions
    Replies: 5
    Last Post: November 16th, 2012, 08:14 AM
  4. java program to copy a text file to onother text file
    By francoc in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: April 23rd, 2010, 03:10 PM