This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package images; | |
import static org.junit.Assert.*; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.Test; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lesson01.joptionpane; | |
import javax.swing.JOptionPane; | |
public class MessageDialog { | |
public static void main(String[] args) { | |
JOptionPane.showMessageDialog(null, "This is a message dialog"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This class is a demo of how to implement for-loops correctly, declaring the loop variables | |
* inside of the for-loops, to limit their scope so that the loop variables can't be used outside | |
* of the loop where the values are too big to be valid array indexes and an ArrayIndexOutOfBoundsException | |
* is thrown. | |
* | |
* @author kaydell | |
* | |
*/ | |
public class ForLoopIndexDemo { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import javax.swing.filechooser.FileNameExtensionFilter; | |
import java.awt.*; | |
import java.io.File; | |
/** | |
* This class is a demo of a background image in a JFrame. | |
* | |
* This code was derived from the following source: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Dimension; | |
import java.awt.FlowLayout; | |
import javax.swing.JFrame; | |
import javax.swing.JList; | |
import javax.swing.JScrollPane; | |
import javax.swing.SwingUtilities; | |
/** | |
* This class is a study in learning how to get scroll bars to work for a JList using a JScrollPane. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class AverageThreeInts { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
int inputs = 2; | |
int[] values = new int[3]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This method executes an AppleScript given the source-code, using the command-line tool called osascript | |
// Note that this is a demo and doesn't do any error-checking yet such as for AppleScript syntax errors | |
// and AppleScript runtime errors. | |
+ (void)execute:(NSString *)source | |
{ | |
@try { | |
NSTask *task = [[NSTask alloc] init]; | |
[task setLaunchPath:@"/usr/bin/osascript"]; | |
NSString *arguments = [NSString stringWithFormat:@"-e %@", source]; | |
[task setArguments:[NSArray arrayWithObjects:arguments, nil]]; |
NewerOlder