Wenn ich JScrollPane hinzufüg wird liste ausgeblet

ich habe folgenden programmcode und möchte ein Jscrollpane zu einer Jlist hinzufügen.Leider klappt das nicht ganz so wie ich will, denn wenn ich es zur JList „unusedItemDevProp“ hinzufüge wird sie ausgeblendet

Hier mein CODE

import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JPanel;
import javax.swing.filechooser.FileNameExtensionFilter;
import java.awt.Toolkit;
import java.awt.Color;
import javax.swing.JList;
import javax.swing.ListSelectionModel;


public class Window implements ActionListener {

 static JFrame frmFigurePatchCreator;
 static JFileChooser fc = new JFileChooser();
 private JList unusedItemDevProp;

 /\*\*
 \* Launch the application.
 \*/
 public static void main(String[] args) {
 EventQueue.invokeLater(new Runnable() {
 public void run() {
 try {
 Window window = new Window();
 frmFigurePatchCreator.setVisible(true);
 } catch (Exception e) {
 e.printStackTrace();
 }
 }
 });
 }

 public static void FileChooser() {
 FileNameExtensionFilter filter = new FileNameExtensionFilter(
 "Figure Thor Files", "bass", "lead");
 Window.fc.setFileFilter(filter);
 }

 /\*\*
 \* Create the application.
 \*/
 public Window() {
 initialize();
 }

 /\*\*
 \* Initialize the contents of the frame.
 \*/
 private void initialize() {
 frmFigurePatchCreator = new JFrame();
 frmFigurePatchCreator.getContentPane().setBackground(Color.GRAY);
 frmFigurePatchCreator.setBackground(Color.DARK\_GRAY);
 frmFigurePatchCreator
 .setIconImage(Toolkit
 .getDefaultToolkit()
 .getImage(
 "C:\\Users\\cweiss\\Desktop\\SRC\\tool\\figure\_icon.gif"));
 frmFigurePatchCreator.setTitle("Figure Patch Creator");
 frmFigurePatchCreator.setBounds(100, 100, 574, 637);
 frmFigurePatchCreator.setDefaultCloseOperation(JFrame.EXIT\_ON\_CLOSE);

 // Tabs
 JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
 tabbedPane.setBackground(Color.GRAY);
 frmFigurePatchCreator.getContentPane().add(tabbedPane);


 // Dev Propreties
 JPanel DevPropPanel = new JPanel();
 DevPropPanel.setBackground(Color.DARK\_GRAY);
 tabbedPane.addTab("Device Properties", DevPropPanel);
 DevPropPanel.setLayout(null);



 unusedItemDevProp = new JList(new String []{"1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1",});
 unusedItemDevProp.setLayoutOrientation(JList.VERTICAL);
 unusedItemDevProp.setValueIsAdjusting(true);
 unusedItemDevProp.setSelectionMode(ListSelectionModel.SINGLE\_SELECTION);
 unusedItemDevProp.setBounds(59, 42, 156, 228);
 //JScrollPane scrollPane = new JScrollPane(unusedItemDevProp);
 //scrollPane.add(unusedItemDevProp);
 //DevPropPanel.add(scrollPane);
 DevPropPanel.add(unusedItemDevProp);

 }

 // action Performed
 public void actionPerformed(ActionEvent e) {

 }

}

MOD: Pre-Tag eingefügt

Hi, ohne dir zu viel Arbeit abzunehmen.

1.) TabbedPane erzeugen
2.) JList erzeugen
3.) JList in eine Scrollpane packen
4.) Scrollpane auf dein devPropPanel
5.) devPropPanel als neuen Tab in deine tabbedPane einfügen.
6.) TabbedPane aufs Frame klatschen :smile:

Viele Grüße!

Spickzettel
Schön machen musst dus selber :wink:

 private void initialize()
 {

 frame = new JFrame();
 frame.getContentPane().setBackground(Color.GRAY);
 frame.setBackground(Color.DARK\_GRAY);
 frame.setIconImage(Toolkit.getDefaultToolkit().getImage(
 "C:\\Users\\cweiss\\Desktop\\SRC\\tool\\figure\_icon.gif"));
 frame.setTitle("Figure Patch Creator");
 frame.setBounds(100, 100, 574, 637);
 frame.setDefaultCloseOperation(JFrame.EXIT\_ON\_CLOSE);

 // Tabs
 JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
 tabbedPane.setBackground(Color.GRAY);

 // List
 unusedItemDevProp = new JList(new String[] { "1", "1", "1", "1", "1",
 "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
 "1", });
 unusedItemDevProp.setLayoutOrientation(JList.VERTICAL);
 unusedItemDevProp.setValueIsAdjusting(true);
 unusedItemDevProp.setSelectionMode(ListSelectionModel.SINGLE\_SELECTION);
 unusedItemDevProp.setBounds(59, 42, 156, 228);

 // scrollpane
 JScrollPane scrollPane = new JScrollPane(unusedItemDevProp);


 // Panel
 JPanel devPropPanel = new JPanel();
 devPropPanel.setBackground(Color.DARK\_GRAY);
 devPropPanel.add(scrollPane);

 tabbedPane.addTab("Device Properties", devPropPanel);
 frame.getContentPane().add(tabbedPane);

 }