日期:2014-05-20 浏览次数:20677 次
import java.awt.*;
import javax.swing.*;
public class Aaa extends JFrame
{
public void DecoratedFrame()
{
this.getContentPane().add(new JLabel("Just a test."));
this.setUndecorated(true);
this.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
this.setSize(300,150);
}
public static void main(String[] args)
{
JFrame frame = new DecoratedFrame();
frame.setVisible(true);
}
}
public DecoratedFrame()
public void DecoratedFrame()
import java.awt.*; import javax.swing.*; public class DecoratedFrame extends JFrame { public DecoratedFrame() { this.getContentPane().add(new JLabel("Just a test.")); this.setUndecorated(true); this.getRootPane().setWindowDecorationStyle(JRootPane.NONE); this.setSize(300,150); } public static void main(String[] args) { JFrame frame = new DecoratedFrame(); frame.setVisible(true); } }
------解决方案--------------------
JFrame frame = new DecoratedFrame();
错误太明显了,你怎么new了一个方法啊 !
呵呵
把你的类名改成DecoratedFrame就好了
------解决方案--------------------