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
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package collisiondemo; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
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
// Create the window | |
JFrame window = new JFrame("Window Title"); | |
// Make the program exit when the window is closed | |
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
// Add the components to the window | |
window.add(new JButton()); | |
window.pack(); | |
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
// Create the font and pass it to the Graphics context | |
g2.setFont(new Font("Monospaced", Font.BOLD, 24)); | |
// Get measures needed to center the message | |
FontMetrics fm = g2.getFontMetrics(); | |
// How many pixels wide is the string | |
int msg_width = fm.stringWidth(msg); |
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
// Create the variable for the image's URL | |
URL spaceshipImageURL; | |
// Get the URL of the image | |
spaceshipImageURL = getClass().getResource("my_spaceship.png"); | |
// Create the variable for the image | |
Image spaceshipImage; | |
// Load the image from the URL | |
spaceshipImage = ImageIO.read(spaceshipImageURL); |
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
require File.dirname(__FILE__) + '/../spec_helper.rb' | |
def describe_project(name, &block) | |
describe name do | |
before(:each) do | |
@project = File.dirname(__FILE__) + "/../../test_data/#{name}/#{name}.xcodeproj" | |
@reader = XcodeprojReader::Reader.new(@project) | |
end | |
yield | |
end |
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
Scenario Outline: Religious menus | |
Given the customer is "<Religion>" | |
When he asks for the menu | |
Then he should see pork selections if <Pork> | |
And he should see lamb selections if <Lamb> | |
And he should see veal selections if <Veal> | |
Scenarios: | |
| Religion | Pork | Lamb | Veal | | |
| Christian | Y | Y | Y | |
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
JOptionPane.showInputDialog("Hello <Name>"); |
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 iphonedemo; | |
import org.xmlvm.iphone.CGRect; | |
import org.xmlvm.iphone.UIApplication; | |
import org.xmlvm.iphone.UILabel; | |
import org.xmlvm.iphone.UIScreen; | |
import org.xmlvm.iphone.UITextAlignment; | |
import org.xmlvm.iphone.UIView; | |
import org.xmlvm.iphone.UIWindow; |
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
AudioClip mySound = JApplet.newAudioClip(getClass().getResource("MySound.aiff")); | |
mySound.play(); |
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
@Override | |
protected void setUp() throws Exception { | |
super.setUp(); | |
// Create a Context for our content provider that will use the test.* | |
// database instead of the production database | |
final String filenamePrefix = "test."; | |
final RenamingDelegatingContext testDatabaseContext = new RenamingDelegatingContext( | |
getInstrumentation().getTargetContext(), getInstrumentation() | |
.getTargetContext(), filenamePrefix); |
OlderNewer