Adding User Controls

Components.listImportantElements() {

//returns:

  • JButton A button that shows text and can do something when you click it.

  • JLabel An element used generally for holding textual messages.

  • JTextField Like an HTML <input>, this component allows the user to enter text.

  • JEditorPane This lets the user enter text or display text-based files.

  • JScrollPane A container that scrolls. Use it by creating content in a different panel and then adding that panel to the scroll pane.

  • JTabbedPane A container that holds tabbed panes.

/*

Let's talk about a few different, important Swing components in turn. They're just objects, so after you are familiar with their general behavior, you can create them, call setX() methods on them to specify their ...

Get Java Garage now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.