我正在使用以下代码:
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();
}
}
要尝试获得一个如下所示的新窗口:
[输入框]
[按钮]
- 文本 -
但由于某种原因,结果总是这样:
[输入框] [按钮]
- 文本 -