小程序有点小毛病
import java.awt.*;import javax.swing.*;
public class AritDemo
{
public static void main(String[] args)
{
AritFrame frame = new AritFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
}
}
class AritFrame extends JFrame
{
private JLabel T;
public AritFrame()
{
setTitle("Arit Demo");
Container container=getContentPane();
container.setLayout(new FlowLayout());
T=new JLabel("Java,你好!");
T.getLocation(400,100);
Font f=new Font(T,Font.BOLD,32);
text.setFont(f);
container.add(T,BorderLayout.SOUTH);
setVisible(true);
pack();
setSize(450,150);
}
}
搜索更多相关的解决方案:
毛病
----------------解决方案--------------------------------------------------------
import java.awt.*;
import javax.swing.*;
public class AritDemo
{
public static void main(String[] args)
{
AritFrame frame = new AritFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
}
}
class AritFrame extends JFrame
{
private JLabel T;
public AritFrame()
{
setTitle("Arit Demo");
Container container=getContentPane();
container.setLayout(new FlowLayout());
T=new JLabel("Java,你好!");
T.getLocale();
// T.getLocation(400,100);
Font f=new Font("宋体",Font.BOLD,32);
//text.setFont(f); text是什么来的?没有定义吧
container.add(T,BorderLayout.SOUTH);
setVisible(true);
pack();
setSize(450,150);
}
}
----------------解决方案--------------------------------------------------------