我使用下面的代碼: n不工作的換行符 - Java的
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URI;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class Finder extends JFrame
{
JPanel jp = new JPanel();
JLabel jl = new JLabel("Credits: Andrew/JellyBellyFred");
JTextField jt = new JTextField("Enter A Player Name, Then Press 'Find Skin'!", 30);
JButton jb = new JButton("Find Skin");
JLabel lnbreak = new JLabel("\n");
public Finder()
{
setTitle("Minecraft Skin Finder");
setVisible(true);
setSize(500, 200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setResizable(false);
jp.add(jt);
jp.add(lnbreak);
jp.add(jb);
jb.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
String input = jt.getText();
jl.setText("http://minecraft.aggenkeech.com/player/" + input);
}
});
jp.add(jl);
add(jp);
}
public static void main(String[] args)
{
Finder t = new Finder();
}
}
,試圖獲得一個新的窗口,這將是這樣的:
[輸入框]
[按鈕]
--TEXT--
但由於某種原因,它總是原來是這樣的:
[輸入框] [按鈕]
--TEXT--