Hello,
I have to make a graphical application, which has a JComboBox and scroll bars. I tried quite a few things, nothing worked and I don't know why. Here is the code I currently have.
package Java24; import java.awt.*; import javax.swing.*; public class HR16ComboScroll extends JFrame{ //Hour sixteen, activity one. public HR16ComboScroll(){ super("Combo Scroll"); setSize(400,600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); FlowLayout flo = new FlowLayout(); setLayout(flo); String[] contents = new String[]{"Alem", "Habtam", "Desta", "Almaz", "Zewdit", "Abraham", "Tsehaye"}; JScrollBar pane = new JScrollBar(); JComboBox list = new JComboBox(contents); list.addItem(pane); add(list); setVisible(true); } //run public static void main(String[] args){ HR16ComboScroll pane = new HR16ComboScroll(); } }