gpt4 book ai didi

java - 错误 找不到符号 Main();第 20 行符号 : Method Main() Location class Main 1 error

转载 作者:行者123 更新时间:2023-12-02 06:09:42 33 4
gpt4 key购买 nike

import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.lang.*;

public class Main extends Frame
{
Label SourceLabelL = new Label("source");
Label SourceLabel = new Label("");
Label TargetLabel = new Label("");
Label FileNameLabel = new Label("File Name: ");
Button TargeButton = new Button("Target");
Button OKButton = new Button("OK ");
GridBagLayout gbl;
GridBagConstraints c;
public static void main(String[] args)
{
Main m = new Main();
}
Main()
{
gbl = new GridBagLayout();
c = new GridBagConstraints();
int colwidth[]={1,1,1,1,1,1,1,1};
int colheight[]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; // theres 18
double colweightb[]={1,1,1,1,1,1,1,1};
gbl.SetLayout(Display);
gbl.SetBounds(0,0,300,900);

找不到符号gbl.SetLayout(显示);符号:变量显示地点:主类我不知道在这里做什么。任何帮助肯定会很好

最佳答案

如果您尝试创建 Main 类的实例,则语法应为:

 Main m = new Main();

Main()是Main类的构造函数

关于java - 错误 找不到符号 Main();第 20 行符号 : Method Main() Location class Main 1 error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21995093/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com