















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This lecture was delivered by Aniruddh Parmar at B. R. Ambedkar Bihar University for Data Transfer Programming course. It includes: GUI, Event, Driven, Programming, Portability, Library, Classes, Platform, Hierarchy, Container, Helper, Swing, Components
Typology: Slides
1 / 23
This page cannot be seen from the preview
Don't miss anything!
















Swing Components in the javax.swing package Lightweight Heavyweight Classes in the java.awt package 1 LayoutManager
Swing Components in the javax.swing package Lightweight Heavyweight Classes in the java.awt package 1 LayoutManager
JMenuItem JCheckBoxMenuItem
JMenu JRadioButtonMenuItem JToggleButton (^) JCheckBox JRadioButton JComboBox JInternalFrame JLayeredPane JList JMenuBar JOptionPane JPopupMenu JProgressBar JFileChooser JScrollBar JSplitPane JSeparator JScrollPane JSlider JTabbedPane JTable JTableHeader JTextComponent JTextField JTextArea JToolBar (^) JToolTip JTree JRootPane JPanel JPasswordField JColorChooser JLabel JEditorPane JSpinner JButton
TextComponent
LayoutManager
frame.getContentPane().add(new JButton(“OK”));
frame.add(new JButton(“OK”));
FlowLayout GridLayout BorderLayout GridBagLayout The order in which objects are added matters to FlowLayout and GridLayout layout managers
setBackground(Color c) setForeground(Color c)
Font font = new Font(name, style, pointSize);
Font f1 = new Font(“Serif”, Font.PLAIN, 12); Font f2 = new Font(“SansSerif”, Font.BOLD, 16); Font f3 = new Font(“Monospaced”, Font.BOLD + Font.ITALIC, 16); Font f4 = new Font(“Times New Roman”, Font.PLAIN, 16);
EventObject AWTEvent AdjustmentEvent ComponentEvent TextEvent ItemEvent ActionEvent InputEvent WindowEvent MouseEvent KeyEvent ContainerEvent FocusEvent PaintEvent ListSelectionEvent
Source Event Type User Action Object Generated Click a button JButton ActionEvent Click a check box JCheckBox ItemEvent, ActionEvent Click a radio button JRadioButton ItemEvent, ActionEvent Press return on a text field JTextField ActionEvent Select a new item JComboBox ItemEvent, ActionEvent Window opened, closed, etc. Window WindowEvent Mouse pressed, released, etc. Component MouseEvent Key released, pressed, etc. Component KeyEvent
java.awt.event.MouseEvent +getButton(): int +getClickCount(): int +getPoint(): java.awt.Point +getX(): int +getY(): int Indicates which mouse button has been clicked. Returns the number of mouse clicks associated with this event. Returns a Point object containing the x and y coordinates. Returns the x-coordinate of the mouse point. Returns the y-coordinate of the mouse point. java.awt.event.InputEvent +getWhen(): long +isAltDown(): boolean +isControlDown(): boolean +isMetaDown(): boolean +isShiftDown(): boolean Returns the timestamp when this event occurred. Returns whether or not the Alt modifier is down on this event. Returns whether or not the Control modifier is down on this event. Returns whether or not the Meta modifier is down on this event Returns whether or not the Shift modifier is down on this event.