Swing Core Components

Site Admin · 11 Sep 2026 · 1 views

The Component Set

Swing covers everything AWT does and much more, all in javax.swing:

  • JButton, JLabel - basic output and actions.
  • JTextField, JTextArea - input.
  • JPanel - grouping container.
  • JComboBox, JList - selections.
  • JTable, JTree - rich data views.

Demo

JButton save = new JButton("Save");
JLabel msg = new JLabel("Ready");
JTextField name = new JTextField(12);
JTextArea body = new JTextArea(5, 20);
JComboBox<String> city = new JComboBox<>(new String[]{"Delhi","Mumbai","Pune"});
JList<String> skills = new JList<>(new String[]{"Java","Spring","SQL"});

Swing JButton demo

Swing JLabel demo

Swing JTextArea demo

Swing text area output

Swing JPanel grouping

Swing JComboBox demo

Swing JList demo

Swing JTable demo

Swing JTree demo

Key Points

  • All Swing controls start with J and live in javax.swing.
  • JTable and JTree take a model (data) and render it automatically.
  • JPanel with its own layout groups complex forms.
Share this post:

Comments (0)

Please login or register to comment.