【发布时间】:2016-02-01 21:47:46
【问题描述】:
所以,我只需要在我的挥杆中添加 一个标题。代码如下:
import javax.swing.*;
import java.util.Scanner;
public class Wall extends JFrame {
public static void main(String[] args) {
new Wall();
}
public Wall() {
final String title = "Wall Game";
this.setSize(300,300); //sets the screen
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setTitle(title);
this.setVisible(true);
JPanel panel1 = new JPanel();
JLabel label1 = new JLabel("Welcome to the Wall Game!");
JLabel label2 = new JLabel("Click the button to read the instructions!");
panel1.add(label1);
panel1.add(label2);
this.add(panel1);
}
}
我希望 Welcome to the Wall Game! 部分更大。有没有可能让它变大?如果有奖金,我想知道你是否可以添加不同的字体。但这并不重要。
感谢任何知道的人:P。
【问题讨论】: