Ich habe mich nach jahrelanger Pause mal wieder auf Java gestürzt.
Leider hänge ich bei der Anzeige einer JList in einem JScrollPane.
Die JScrollPane und das JPanel teilen sich anscheinend auch 50/50 den Platz.
JScrolpane ist Blau und JPanel ist dunkelgrau.
Kann mir jemand sagen wo mein Denkfehler ist.
Leider hänge ich bei der Anzeige einer JList in einem JScrollPane.
Die JScrollPane und das JPanel teilen sich anscheinend auch 50/50 den Platz.
JScrolpane ist Blau und JPanel ist dunkelgrau.
Kann mir jemand sagen wo mein Denkfehler ist.
Code:
package view;
import java.awt.Color;
import java.awt.LayoutManager;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
public class OverviewView extends JPanel{
private JScrollPane sevenDays;
private JPanel thisMonth;
private JList<JLabel> liste;
private JLabel ltest1, ltest2;
public OverviewView() {
this.setLayout(new BoxLayout(this,BoxLayout.X_AXIS));
sevenDays = new JScrollPane();
sevenDays.setBackground(Color.CYAN);
sevenDays.getViewport().setBackground(Color.BLUE);
this.add(sevenDays);
ltest1 = new JLabel("Test1");
ltest2 = new JLabel("Test2");
liste = new JList<JLabel>();
liste.add(ltest1);
liste.add(ltest2);
sevenDays.add(liste);
thisMonth = new JPanel();
thisMonth.setBackground(Color.LIGHT_GRAY);
this.add(thisMonth);
this.setBackground(Color.YELLOW);
//tfTest = new JTextField("OverView");
//this.add(tfTest);
}
public OverviewView(LayoutManager arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
public OverviewView(boolean arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
public OverviewView(LayoutManager arg0, boolean arg1) {
super(arg0, arg1);
// TODO Auto-generated constructor stub
}
}