Guys, Im wondering, If I have another class with a jpanel in it... and I add this to the jPanel, this should work correct?
jpanel.add(new DoughOverviewList());
jpanel.repaint();
for some reason its not showing in my jpanel,
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package doughtracker;
import java.awt.Color;
import java.awt.Font;
import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.ListSelectionModel;
import javax.swing.border.Border;
import javax.swing.event.ListSelectionEvent;
/**
*
* @author Acer
*/
public class DoughOverviewList extends JList {
JScrollPane doughListScrollPane;
DefaultListModel doughListModel;
Border GrayLine = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
public DoughOverviewList() {
super.setFont(new Font("Arial", Font.PLAIN, 16));
super.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
super.setBorder(GrayLine);
doughListScrollPane = new JScrollPane(this);
doughListScrollPane.setBounds(DoughTracker.dimensions.doughCreatorWidth / 2, 120, 250, 345);
doughListScrollPane.setBorder(GrayLine);
doughListModel = new DefaultListModel();
doughListModel.addElement("Testing ");
super.setModel(doughListModel);
super.setVisible(true);
super.addListSelectionListener((ListSelectionEvent ev) -> {
});
}
}