2011-02-22 4 views
0

아래 코드는 사용자가 책과 관련된 정보를 입력하고 표시하도록 요청하는 간단한 GUI를 작성하려는 시도입니다. 문제는 내가 질문을 표시 즉, 제목을 입력하고, 한 번에 한 번에 한 번에 한 번에 하나씩 표시하는 코드에 내가 지금까지 작성한 것보다 작성자 등을 입력하고 싶습니다. 또한 비용을 표시하고 싶습니다. 두 번이나 확실하지는 않습니다. 제발 포인터주세요. 나는 내가 초급자이고 내가 지금까지해온 것을 어떻게 만드는지를보고 싶기 때문에 아래에 작성한 코드를 완전히 변경하지 않고 그것을하고 싶다. 덕분에 사이먼Java GUI에서 정보 표시

import javax.swing.JOptionPane; 

public class GUI 

{ 

    public static void main (String args[]) 

    { 
     String title = ""; 
     String author = ""; 
     String year = ""; 
     String publisher = ""; 
     String cost = ""; 

     title = JOptionPane.showInputDialog("Enter Title"); 
     author = JOptionPane.showInputDialog("Enter Author"); 
     year = JOptionPane.showInputDialog("Enter Year"); 
     publisher = JOptionPane.showInputDialog("Enter Publisher");  
     cost = JOptionPane.showInputDialog("Enter Cost"); 

     String message = "The title of the book is :" + title +", " + 
       "and the Author of the Book is :" + author +". It was published in" + year + "by " + publisher + 
       "and retails at" + cost; 

     ; 

     JOptionPane.showMessageDialog(null, message, "Book Details", JOptionPane.PLAIN_MESSAGE); 

       System.exit(0); 
    } 


} 

답변