[JAVA] JComboBox nicht anwählbar

White

Well-known member
ID: 123940
L
20 April 2006
910
42
Hi ihr,

irgendwie bin ich grade blind.

Ich habe folgenden SOurce Code.
PHP:
package crap.views;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.JComboBox;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.JTextPane;

import crap.CrapView;

/**
 * Diese Klasse stellt die Uebersicht ueber alle Rechner die im System sind dar.
 * 
 * @author White
 * 
 */
public class Rechner extends JPanel {
	private CrapView main = null;
	
	// die folgenden pannels unterteilen das hauptpanel in unterpanel
	private JPanel oben=new JPanel(new BorderLayout());
	private JPanel unten=new JPanel(new GridLayout(3,1));
	
	
	//die folgenden Objekte befuellen das oben Panel
	private JComboBox rechnerauswahlListe=new JComboBox();
	private JLabel rechnernameLabel=new JLabel("Rechnername");
	
	
	
	//die folgenden Panels befuelölen das "unten" panel
	private JPanel hardwarePanel=new JPanel();
	
	//die folgenden Objekte befuellen das hardwarePanel
	private JLabel hardwareBeschreibungLabel=new JLabel("Hardware");
	// wird im Konstrkutor befuellt
	private JScrollPane hardwareBeschreibungScrollPane=null; 
	private JEditorPane hardwareBeschreibungTextfeld=new JTextPane();
	

	public Rechner(CrapView main) {
		this.main=main;
		

		//oben Panel befuellen
		oben.add(rechnerauswahlListe, BorderLayout.NORTH);
		oben.add(rechnernameLabel, BorderLayout.CENTER);
		
		//hauptpanel befuellen
		this.add(oben, BorderLayout.NORTH);
		this.add(unten, BorderLayout.CENTER);
		
	}

	@Override
	public void addNotify() {
		System.out.println();
	}

}

und

PHP:
package testzeug;

import java.awt.Dimension;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URL;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.Format;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;

import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpMethodParams;

import crap.views.Rechner;

public class Test {

	/**
	 * @param args
	 * @throws NoSuchAlgorithmException 
	 * @throws IOException 
	 * @throws HttpException 
	 */
	public static void main(String[] args) throws NoSuchAlgorithmException, HttpException, IOException {		
		JFrame fenster=new JFrame("Test");
		fenster.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		fenster.setSize(new Dimension(800, 600));
		fenster.add(new Rechner(null));
		fenster.setVisible(true);
	}
}

Nun habe ich das Problem dass die ComboBox nicht anwählbar ist.
Wenn ich anstatt der ComboBox ein JEditorPane oder irgendws anderes was Userinput verlangt einsetze kann ich es ebenfalls nicht auswählen und nix.

Hat jemand irgendwie ne Idee ?
 
Code:
    @Override
    public void addNotify() {
        System.out.println();
    }
Da liegt das Problem. Das eigentliche addNotify von JPanel wird überschrieben, fehlt also mindestens noch super.addNotify()
 
Hi burnred,

genau das ist mir auch gerade aufgefallen. UNd es lag auch daran

Man und an sowas sitzt man nen Tag und debuggt wie ein blöder rum ohne den Fehler zu finden :D

Manchma bin ich echt blind.