The Project        Download   Javadoc   SourceForge   Donate

Modal

Adds a component as modal to a JFrame or JDialog.

Each JFrame or JDialog may have more than one component as modal, but only one component can be visible at once.

JFrame frame = ...
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout(5, 5));
panel.setBackground(Color.WHITE);
Border out = BorderFactory.createLineBorder(Color.BLACK);
Border in = BorderFactory.createEmptyBorder(5, 5, 5, 5);
panel.setBorder(BorderFactory.createCompoundBorder(out, in));
panel.add(new JLabel("Modal: Loading..."), BorderLayout.NORTH);

JProgressBar pb = new JProgressBar();
pb.setValue(40);
panel.add(pb, BorderLayout.CENTER);

Modal.addModal(frame, panel);