Hallo Leute,
Ich habe folgenden code geschrieben:
Wie mahce ich eine JList Scrolbar, ohne andere Componenten zu überdecken.
In Zeile 53 hab ich es probiert. Funktioniert aber nicht.
Ich hoffe ihr könnt mir helfen.
Lg Tron36
Ich habe folgenden code geschrieben:
Code:
package de.fraunhofer.glossar.view;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JComboBox;
import javax.swing.JList;
import javax.swing.JButton;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTextArea;
import de.fraunhofer.glossar.Command;
import de.fraunhofer.glossar.control.Control;
public class MainWindow extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
/** Event listener */
Control actionListner = new Control();
private JPanel contentPane;
private JTextField tbxSearch;
private JTextArea textArea;
private JComboBox<String> cmbSelect;
private JList<String> list;
public JButton btnSearch;
/**
* Create the frame.
*/
public MainWindow() {
super("Main Window");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 750, 500);
setVisible(true);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
list = new JList<String>();
list.setBounds(0, 41, 120, 421);
JScrollPane scrollPane = new JScrollPane(list);
scrollPane.setBounds(list.getBounds());
contentPane.add(scrollPane);
cmbSelect = new JComboBox<String>();
cmbSelect.addItem("Eintrag");
cmbSelect.addItem("Projekt");
cmbSelect.addItem("Autor");
cmbSelect.addItem("Tag");
cmbSelect.addActionListener(actionListner);
cmbSelect.setActionCommand(Command.CHANGE_TERM_SHOWLIST);
cmbSelect.setBounds(0, 21, 120, 20);
contentPane.add(cmbSelect);
btnSearch = new JButton("Suchen");
btnSearch.addActionListener(actionListner); //Register listener
btnSearch.setBounds(845, 20, 89, 23);
contentPane.add(btnSearch);
tbxSearch = new JTextField();
tbxSearch.setBounds(122, 20, 721, 20);
contentPane.add(tbxSearch);
tbxSearch.setColumns(10);
textArea = new JTextArea();
textArea.setColumns(textArea.getColumns());
textArea.setVisible(true);
textArea.setBounds(122, 41, 612, 421);
contentPane.add(textArea);
}
}
Wie mahce ich eine JList Scrolbar, ohne andere Componenten zu überdecken.
In Zeile 53 hab ich es probiert. Funktioniert aber nicht.
Ich hoffe ihr könnt mir helfen.
Lg Tron36