package de.abas.examples.inputbox;

import de.abas.erp.api.gui.InputBox;
import de.abas.erp.db.DbContext;
import de.abas.examples.common.AbstractAjoAccess;

public class InputBoxExample extends AbstractAjoAccess {
	

	@Override
	public int run(String[] args) {
		DbContext ctx = getDbContext();
		
		InputBox inputBox = new InputBox(ctx, "Normal Text goes here:");
		String input = inputBox.read();
		ctx.out().println("You entered: " + input);
		
		InputBox viewProtectedInputBox = new InputBox(ctx, "View Protected Text goes here:");
		String viewProtectedInput = viewProtectedInputBox.read(true);
		ctx.out().println("It was view protected, but I can still read it. You entered: " + viewProtectedInput);
		
		return 0;
	}
	
}

package de.abas.examples.inputbox;

import de.abas.erp.api.gui.InputBox;
import de.abas.erp.db.DbContext;
import de.abas.examples.common.AbstractAjoAccess;

public class InputBoxExample extends AbstractAjoAccess {
	
	DbContext ctx;

	@Override
	public int run(String[] args) {
		ctx = getDbContext();
		
		InputBox inputBox = new InputBox(ctx, "Normal Text goes here:");
		String input = inputBox.read();
		ctx.out().println("You entered: " + input);
		
		InputBox viewProtectedInputBox = new InputBox(ctx, "View Protected Text goes here:");
		String viewProtectedInput = viewProtectedInputBox.read(true);
		ctx.out().println("It was view protected, but I can still read it. You entered: " + viewProtectedInput);
		
		return 0;
	}
	
}

--- 
+++ 
@@ -6,11 +6,10 @@
 
 public class InputBoxExample extends AbstractAjoAccess {
 	
-	DbContext ctx;
 
 	@Override
 	public int run(String[] args) {
-		ctx = getDbContext();
+		DbContext ctx = getDbContext();
 		
 		InputBox inputBox = new InputBox(ctx, "Normal Text goes here:");
 		String input = inputBox.read();
Refactor InputBox example: make DbContext local to method