看板 java 關於我們 聯絡資訊
※ 引述《redhon ( redhon)》之銘言: : 請問.. : 如果我的主程式為 : public class mm{ : public static void main (String[] args) throws IOException { : BufferedReader keyin; : keyin =new BufferedReader(new InputStreamReader(System.in)); : System.out.print("請輸入字串:"); : String st=keyin.readLine(); : CFrame frame = new CFrame(); : } : } : 該如何讓輸入的字串顯示於 Frame 上??? : 謝謝!! Here is an example ^^ import java.io.IOException; import javax.swing.JFrame; import javax.swing.JLabel; public class mm { public static void main(String[] args) throws IOException { BufferedReader keyin; keyin =new BufferedReader(new InputStreamReader(System.in)); System.out.print("請輸入字串:"); String st = "Hello world!"; JFrame frame = new JFrame(); frame.getContentPane().add(new JLabel(st)); frame.setSize(400, 300); frame.setVisible(true); } } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 24.17.240.114