By Priya Pedamkar. JFrame is a java class that is extended by Frame class of Java. JFrame is treated as the main window. In JFrame different elements such as labels, text fields, buttons can be added. JFrame is also known as Swing top-level container. JFrame class in the application can be created in the following way. AccessibleContext getAccessibleContext — This method gets the accessible context that remains associated with the JFrame. In the below screenshot a frame is created using JFrame classes of swing library.
FlowLayout; import java. JList is part of Java Swing package. JList is a component that displays a set of Objects and allows the user to select one or more items. JList inherits JComponent class. JList is a easy way to display an array of Vectors. JList ListModel d : creates a new list with the specified List Model JList Vector l : creates a new list with the elements of the vector Commonly used methods are : method explanation getSelectedIndex returns the index of selected item of the list getSelectedValue returns the selected value of the element of the list setSelectedIndex int i sets the selected index of the list to i setSelectionBackground Color c sets the background Color of the list setSelectionForeground Color c Changes the foreground color of the list setListData E [ ] l Changes the elements of the list to the elements of l.
Skip to content. Change Language. Related Articles. Table of Contents. JavaTpoint offers too many high quality services. Mail us on [email protected] , to get more information about given services. Please mail your requirement at [email protected] Duration: 1 week to 2 week. FlowLayout; import javax. JButton; import javax. JFrame; import javax.
JLabel; import javax. Next Topic Java JComponent. Reinforcement Learning. R Programming. React Native. Python Design Patterns. Python Pillow. Python Turtle.
0コメント