猿问

请教前辈一个挺基础的JAVA问题

import java.awt.*;

import javax.swing.*;

public class ExampleFrame_01 extends JFrame{

private static final long serialVersionUID = 1L;

public static void main(String[] args) {

ExampleFrame_01 Frame=new ExampleFrame_01();

Frame.setVisible(true);

}

public  Example_01(){

                super();

setTitle("分割面板");

setBounds(100,100,500,375);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

final JSplitPane hSplitPane=new JSplitPane();

hSplitPane.setDividerLocation(40);

getContentPane().add(hSplitPane,BorderLayout.CENTER);

hSplitPane.setLeftComponent(new JLabel("   1"));

final JSplitPane vSplitPane=new JSplitPane(JSplitPane.VERTICAL_SPLIT);

vSplitPane.setDividerLocation(30);

vSplitPane.setDividerSize(8);

vSplitPane.setOneTouchExpandable(true);

hSplitPane.setRightComponent(vSplitPane);

vSplitPane.setTopComponent(new JLabel("     2"));

vSplitPane.setBottomComponent(new JLabel("     3"));

}

}

下划线那两行报错。why?

慕粉1473725030
浏览 1250回答 1
1回答

zeng_建军

public  Example_01()这里是一个构造方法吧,方法名不应该和类名(ExampleFrame_01)一样吗
随时随地看视频慕课网APP

相关分类

Java
JavaScript
我要回答