1/19
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
to create a top level window
What is the primary function of a jframe in jswing?
set size()
Which method is use to set size?
JFrame.EXIT_ON_CLOSE)
How do you ensure that a jframe closes when the user clicks the close button?
To show progress while loading content.
What is the purpose of a loading screen?
JProgressBar
Which Swing component is commonly used to create a loading screen?
setValue(int value)
Which method is used to update the progress in a JProgressBar?
Worker thread (SwingWorker).
JProgressBar is commonly used in combination with which type of Java thread?
To organize multiple panel tabs
What is the main purpose of JTabbedPane?
tabbedPane.addTab("Title", component).
How do you add a new tab to a JTabbedPane?
setEnabledAt(index, false).
If you want to disable a specific tab in JTabbedPane, what should you do?
JTable
Which Swing component is used to display a manipulable table?
DefaultTableModel.
Which class is used to handle the data model for a JTable?
defaultTableModel.addRow(new Object[]{rowData}).
How do you add a new row to a JTable using DefaultTableModel?
MouseListener.
Which interface must be implemented to detect mouse clicks in Swing?
mouseClicked(MouseEvent e).
Which method is triggered when a user clicks a component in MouseListener?
KeyAdapter.
If you want to detect keyboard input in a JTextField, which class should you use?
keyReleased(KeyEvent e).
Which method in KeyListener is called when a key is released?
ActionListener.
If you want to listen for an action event triggered by a button click, which interface should you use?
button.addActionlistener(newaction)
How do you attach an ActionListener to a button?
ActionListener is optimized for button interaction.
What is the main advantage of using ActionListener?