Ich habe folgendes Problem: Eclipes gibt mir aus das ich folgenden Syntax Fehler habe.Die rot-Markierte Mengenklammer soll falsch sein. Ich hab versucht ihn zu beheben aber es funktioniert nicht bitte um Hilfe.
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Main
{
private static JFrame frm;
private static JButton b1,b2,b3,b4,b5;
private static JLabel text;
private String inhalt;
private int i = 0;
public Main() {}
public static void main( String[] args)
{
frm = new JFrame();
frm.setSize(1280,720);
frm.setVisible(true);
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frm.setLocationRelativeTo(null);
frm.setTitle("JavaDoc Praesentation");
//Button
b1 = new JButton("weiter");
b2.setBounds(600,450, 180, 80);
b3.setVisible(true);
//text
text = new JLabel("Java Doc");
text.setHorizontalAlignment(SwingConstants.CENTER);
text.setVisible(true);
erstelleObj();
}
b1.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent e){
if(b1 == e.getSource()){
}
}
});
}
public static void erstelleObj() {
frm.add(b1);
frm.add(text);
}
}
MfG Staatbekannt
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Main
{
private static JFrame frm;
private static JButton b1,b2,b3,b4,b5;
private static JLabel text;
private String inhalt;
private int i = 0;
public Main() {}
public static void main( String[] args)
{
frm = new JFrame();
frm.setSize(1280,720);
frm.setVisible(true);
frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frm.setLocationRelativeTo(null);
frm.setTitle("JavaDoc Praesentation");
//Button
b1 = new JButton("weiter");
b2.setBounds(600,450, 180, 80);
b3.setVisible(true);
//text
text = new JLabel("Java Doc");
text.setHorizontalAlignment(SwingConstants.CENTER);
text.setVisible(true);
erstelleObj();
}
b1.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent e){
if(b1 == e.getSource()){
}
}
});
}
public static void erstelleObj() {
frm.add(b1);
frm.add(text);
}
}
MfG Staatbekannt