Dialog: Choose Option

Keywords: JAVA, dialog, options, JOptionPane, showOptionDialog, save, cancel, case
// Confirm save
            
// Text to put on the buttons
String[] choices = {"Enterprise", "Department A", "Cancel Save"};
            
int dialogResult = JOptionPane.showOptionDialog(
null                        // Center in window.
, "Which layer would you like to save this sketch to?"    // Message
, "Save Sketch"               // Title in titlebar
, JOptionPane.YES_NO_OPTION   // Option type
, JOptionPane.PLAIN_MESSAGE   // messageType
, null                        // Icon (none)
, choices                     // Button text as above.
, "Community"                 // Default button's label
);
            
logger.debug("Selected Save Option: " + dialogResult);
            
// Switch statement to check which button was clicked
switch (dialogResult) {
	case 0: 
		// Enterprise Layer
                    
		// Write sketch to DB        
		this.sketchTool.writeToLayerMultiple("Enterprise");                
		this.sketchTool.alMovePoints.clear();
		this.sketchTool.alSavedSketches.clear();
		this.sketchTool = null;
                    
		break;
	case 1:
		// Department A Layer
                    
		// Write sketch to DB                
		this.sketchTool.writeToLayerMultiple("Test_Treat");                
		this.sketchTool.alMovePoints.clear();
		this.sketchTool.alSavedSketches.clear();
		this.sketchTool = null;
                    
		break;
	case 2:
		// Cancel
                    
		appViewer.getAppGui().getToolPanel().setButtonEnabled("sketch_tool", false);
		appViewer.getAppGui().getToolPanel().setButtonEnabled("sketch_tool_end", true);
                    
		break;
	case -1:
		// Close box handled here
		System.exit(0);
	default:
		// If we get here, something is wrong
		JOptionPane.showMessageDialog(null, "Unexpected response " + dialogResult);
}

Dialog: Yes/No/Cancel

Keywords: JAVA, popup, yes no cancel, confirm, showConfirmDialog, JOptionPane
// Confirm save
int dialogResult = JOptionPane.showConfirmDialog(
this.appViewer,
"Are you sure you want to save this sketch?",
"Save Sketch", JOptionPane.YES_NO_CANCEL_OPTION);
            
logger.debug("User Chose: " + dialogResult);

if (dialogResult == JOptionPane.YES_OPTION) {
	// Write sketch to DB                
	this.sketchTool.writeToLayerMultiple();                
	this.sketchTool.alMovePoints.clear();
	this.sketchTool.alSavedSketches.clear();
 	this.sketchTool = null;
}
else if (dialogResult == JOptionPane.NO_OPTION) {
	// Do not save
	logger.debug("User chose NO");
	this.sketchTool.alMovePoints.clear();
	this.sketchTool.alSavedSketches.clear();
	this.sketchTool = null;                
}
else {
	// Cancel
	logger.debug("User chose CANCEL");
	appViewer.getAppGui().getToolPanel().setButtonEnabled("sketch_tool", false);
	appViewer.getAppGui().getToolPanel().setButtonEnabled("sketch_tool_end", true);
}

Eclipse

Keywords: JAVA, Eclipse, IDE, tutorial, videos

Eclipse IDE for Java Developers (85 MB)
http://www.eclipse.org/downloads/packages/

 

Eclipse and Java Video Tutorials

http://sourceforge.net/projects/eclipsetutorial/files/

JCreator

Keywords: JAVA, JCreator, IDE, Xinox
JCreator is a Java IDE created by Xinox Software. Its interface is similar to that of Microsoft's Visual Studio. It is programmed entirely in C++, (with exception to the first version (0.1) which was Java-based [1] ). JCreator has two editions: Lite Edition (LE): freeware, Pro Edition (Pro): shareware that costs $89 after a 30-day trial.
JCreator.com/

Subversion

Keywords: JAVA, Subversion, version control, TortoiseSVN
TortoiseSVN
http://tortoisesvn.net/downloads

To use TortoiseSVN to check out your project, open a Windows Explorer instance. Right click anywhere outside of an existing SVN tree and choose SVN Checkout.... Specify the link and the destination directory.