我的程序将无法运行。无法自行找到解决方案

My program won't work. Can't find the solution on my own

我正要制作我的第一个图形程序,但我卡住了。我无法让它工作,它没有错误所以当我 运行 它在 eclipse 上时它看起来是正确的但是一个新的 window 没有像它应该的那样打开。这只是整个程序的一小部分。

这是我的代码:

import javax.swing.*;
import javax.swing.event.*;
import javax.swing.filechooser.*;

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

public class Inlupp2 extends JFrame{
    JTextField ordFält = new JTextField();
    JTextArea display = new JTextArea();

    Inlupp2() {
        super("Inlupp2");

        JPanel norr = new JPanel();
        add(norr, BorderLayout.NORTH);

        JLabel lab = new JLabel("Ny: ");
        norr.add(lab);
        norr.add(ordFält);

        JButton searchKnapp = new JButton("Search");
        norr.add(searchKnapp);
        searchKnapp.addActionListener(new SearchLyss());

        JButton hideKnapp = new JButton("Hide place");
        norr.add(hideKnapp);
        hideKnapp.addActionListener(new HideLyss());

        JButton deleteKnapp = new JButton("Delete places");
        norr.add(deleteKnapp);
        deleteKnapp.addActionListener(new deleteKnapp());

        JButton locationKnapp = new JButton("What is here?");
        norr.add(locationKnapp);
        locationKnapp.addActionListener(new locationKnapp());

        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setLocationRelativeTo(null);
        setSize(600, 500);
        setVisible(true);

    }
    class locationKnapp implements ActionListener{
        public void actionPerformed(ActionEvent ave){

        }
    }

    class deleteKnapp implements ActionListener{
        public void actionPerformed(ActionEvent ave){

        }
    }
    class HideLyss implements ActionListener{
        public void actionPerformed(ActionEvent ave){

        }
    }

    class SearchLyss implements ActionListener {
        public void actionPerformed(ActionEvent ave) {

        }
    }

        public static void String(String[] args) {
            new Inlupp2();
        }

}

您不小心修改了 main 方法(这是一个 starting/entry 点)以将其命名为 String。

所以不用

public static void String(String[] args) {

改为:

public static void main(String[] args) {

我认为在你写的那一点上:

public static void String(String[] args) {
        new Inlupp2();
    }

你应该写:

public static void main(String[] args) {
        new Inlupp2();
    }