IST240 Exam 2 Study Guide

IST240 Exam 2 Study Guide - caption Greetings? JLabel...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
IST240 Exam 2 Study Guide - Chapter 5 o Define a class, instance variables public class Student{ o Write constructors public Student(){ o Know what the keyword this refers to the reason for using this construct [this] is that we have a situation that is known as name overloading - the same name being used for two different entities o Be able to write a toString method (that overrides methods inherited from Object class) public String toString(){ return ; - Chapter 6 o public class MainPanel extends JPanel o How do we get the GUI to do something when a button is clicked? rollButton.addActionListener(new ButtonListener()); private class ButtonListener implements ActionListener { public void actionPerformed(ActionEvent evt) { if (evt.getSource() == rollButton) handleRollButton(); if (evt.getSource() == closeButton) System.exit(0); } } o How do you write the code to make a new JLabel (or JButton) with the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: caption Greetings? JLabel myLabel = new JLabel(Greetings); o Layout Managers: What do they do? You should be able to distinguish GridLayout, BorderLayout, FlowLayout. GridLayout - Organizes components into a grid of rows and columns BorderLayout - Organizes components into five areas (North, South, East, West, and Center) FlowLayout - Organizes components from left to right, starting new rows as necessary-Chapter 7 o Define an array of type t int scores = new int[10]; o Each array object has a public constant called length that stores the size of the array o It is referenced using the array name o scores.length o Note that length holds the number of elements, not the largest index o scores[2] = 45;-Chapter 8 o...
View Full Document

Page1 / 2

IST240 Exam 2 Study Guide - caption Greetings? JLabel...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online