import javax.swing.*; public class ListExample extends JFrame { public ListExample() { String[] items = {"Item 1", "Item 2", "Item 3", "Item 4", "Item 5"}; JListIn this example, we create a JList component and set its bounds to (50, 50, 100, 100) which means it will be positioned at (50, 50) on the screen with a width and height of 100. The JList is then added to the JFrame. Package library: javax.swinglist = new JList<>(items); list.setBounds(50, 50, 100, 100); add(list); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(200, 200); setVisible(true); } public static void main(String[] args) { new ListExample(); } }