Swing No suitable Method found for add

THELokusta

Neues Mitglied
Hi!
Ich habe folgendes Problem:
Der normale Befehl "add" funktioniert nicht mehr, da ich die einzelnen Elemente meines "Interfaces" in andere Klassen ausgelagert habe. Wie kann man diesen Fehler beheben bzw. die Elemente wieder sichtbar machen?
Hier ist der Code der Frame Klasse:
Java:
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Frame extends Button1 
{
    private int b;
    private int h;
    private JFrame frm;
    private String inhalt;
    private Button1 button1;
    private Button2 button2;
    private Text text;
    public Frame(int breite, int hoehe)
    {
        b = breite;
        h = hoehe;
        frm = new JFrame();
        frm.setSize(b,h);
        frm.setVisible(true);
        frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frm.setLocationRelativeTo(null);
        frm.setTitle("JavaDoc Praesentation");
        //Button1
        button1 = new Button1();
        //Button2
        button2 = new Button2();
        //Text
        text = new Text();
    }


    public void erstelleObj() {
        frm.add(button1);
        frm.add(button2);
        frm.add(text);
    }
}

Vielen danke für die Hilfe :)

-Marius
 
Zuletzt bearbeitet:
Ähnliche Java Themen
  Titel Forum Antworten Datum
M JavaFX java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found AWT, Swing, JavaFX & SWT 5
M JavaFX Non-static method 'widthProperty()' cannot be referenced from a static context AWT, Swing, JavaFX & SWT 4
beli3ver JavaFX Anwendung startet nicht, kann den Fehler nicht finden (Exception in Application start method) AWT, Swing, JavaFX & SWT 1
Z JavaFX Exception in Application start method AWT, Swing, JavaFX & SWT 2
B AWT actionPerformed Method funktioniert nicht AWT, Swing, JavaFX & SWT 12
S Java Swing Print() method AWT, Swing, JavaFX & SWT 4
U JavaFX Error: Handler Method not found AWT, Swing, JavaFX & SWT 3
H Swing Spiel: Maexchen: method cannot be applied to given types AWT, Swing, JavaFX & SWT 3
H Event Handling Externe Method schliesst Hauptapplikation AWT, Swing, JavaFX & SWT 6
N Swing Exception: Comparison method violates its general contract! AWT, Swing, JavaFX & SWT 13
J Calling a method from another class AWT, Swing, JavaFX & SWT 2
hdi ViewportView der JScrollPane - welche Method synchronisiert? AWT, Swing, JavaFX & SWT 15
G Method drawLine() AWT, Swing, JavaFX & SWT 14
M Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found AWT, Swing, JavaFX & SWT 14
J FXML - Internationalisierung - Behandung key not found AWT, Swing, JavaFX & SWT 39
R eclipse source not found AWT, Swing, JavaFX & SWT 4

Ähnliche Java Themen

Neue Themen


Oben