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 9 of 9

Thread: TRANSLATION NEEDED

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post TRANSLATION NEEDED

    CAN SOMEONE PLEASE SHOW ME HOW THIS PIEVE OF CODING WORKS AND WHAT IT DOES?
    ASAP PLEASE !!!
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;


    public class CheckLibrary extends JFrame
    implements ActionListener {
    [code=java] JTextField trackNo = new JTextField(2);
    TextArea information = new TextArea(6, 50);
    JButton list = new JButton("List All Tracks");
    JButton check = new JButton("Check Track");
    public CheckLibrary() { [/java]
    setLayout(new BorderLayout());
    setBounds(100, 100, 400, 200);
    setTitle("Check Library");
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    JPanel top = new JPanel();
    top.add(new JLabel("Enter Track Number:"));
    top.add(trackNo);
    top.add(check);
    top.add(list);
    list.addActionListener(this);
    check.addActionListener(this);
    add("North", top);
    JPanel middle = new JPanel();
    information.setText(LibraryData.listAll());
    middle.add(information);
    add("Center", middle);]

    [setResizable(false);
    setVisible(true);
    }
    //
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() == list) {
    information.setText(LibraryData.listAll());
    } else {
    String key = trackNo.getText();
    String name = LibraryData.getName(key);
    if (name == null) {
    information.setText("No such track number");
    } else {
    information.setText(name + " - " + LibraryData.getArtist(key));
    information.append("\nRating: " + stars(LibraryData.getRating(key)));
    information.append("\nPlay count: " + LibraryData.getPlayCount(key));
    }
    }
    }

    [code=java] private String stars(int rating) {
    String stars = "";
    for (int i = 0; i < rating; ++i) {
    stars += "*";
    }
    return stars;[/java]
    }
    }

    This is meant to be coding for a jukebox application


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: TRANSLATION NEEDED

    Please edit your post and wrap your code with code tags:
    [code=java]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.

    Post the program's output.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: TRANSLATION NEEDED

    are the changes i made what you asked for?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: TRANSLATION NEEDED

    No. The code needs to be wrapped in code tags:

    [code=java]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.

    It should look like this:
           Thread appThread = new Thread() {
               public void run() {
                   try {
                       SwingUtilities.invokeAndWait(doHelloWorld);
                   }
                   catch (Exception e) {
                       e.printStackTrace();
                   }
                   System.out.println("Finished on " + Thread.currentThread()); //Finished on Thread[Thread-0,5,main]
     
               }
           };
           appThread.start();

    What specific questions do you have about the code?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Dec 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: TRANSLATION NEEDED

    i just need to explain how all the codes work in this application.

    for example
    // import the classes of the abstract windows toolkit and swing to enable us to use
    //components like buttons
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: TRANSLATION NEEDED

    Please edit the post and wrap the code in code tags.

    If you have questions about parts of the code, post them. "How does it all work" is too general a question.

    --- Update ---

    Have you looked in the tutorial: The Really Big Index
    Using Package Members (The Java™ Tutorials > Learning the Java Language > Packages)
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts
    If you don't understand my answer, don't ignore it, ask a question.

  8. #8
    Junior Member
    Join Date
    Nov 2013
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: TRANSLATION NEEDED

    your suppose to read you text and figure this out not ask us to tell you how to do it

  9. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: TRANSLATION NEEDED

    ASAP PLEASE !!!
    I guess it wasn't needed as soon as expected.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. java gui for translation/as dictionary
    By malayo in forum Java Theory & Questions
    Replies: 1
    Last Post: September 2nd, 2013, 12:59 AM
  2. Grails Developer Needed - URGENTLY NEEDED *WORK FROM HOME*
    By IngeniumR in forum Paid Java Projects
    Replies: 0
    Last Post: February 5th, 2013, 07:19 AM
  3. Translation to Java?
    By java_novice in forum Java Theory & Questions
    Replies: 4
    Last Post: February 9th, 2012, 01:39 PM
  4. Language translation
    By archanaanbu in forum Member Introductions
    Replies: 1
    Last Post: February 9th, 2011, 07:01 AM