X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fdemos%2FDemoMsgBoxWindow.java;h=ee2bca1ef35993df63dfe9255461cbf0ca1ae8c4;hb=615a0d99fd0aa4437116dd083147f9150d5e6527;hp=77bc33199d16208f351ebb16b08ac7ef63a9d206;hpb=2ce6dab2bbd951e6d0f09f94759efda5ee4b65ac;p=fanfix.git diff --git a/src/jexer/demos/DemoMsgBoxWindow.java b/src/jexer/demos/DemoMsgBoxWindow.java index 77bc331..ee2bca1 100644 --- a/src/jexer/demos/DemoMsgBoxWindow.java +++ b/src/jexer/demos/DemoMsgBoxWindow.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2016 Kevin Lamonte + * Copyright (C) 2017 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -37,6 +37,10 @@ import static jexer.TKeypress.*; */ public class DemoMsgBoxWindow extends TWindow { + // ------------------------------------------------------------------------ + // Constructors ----------------------------------------------------------- + // ------------------------------------------------------------------------ + /** * Constructor. * @@ -55,7 +59,7 @@ public class DemoMsgBoxWindow extends TWindow { DemoMsgBoxWindow(final TApplication parent, final int flags) { // Construct a demo window. X and Y don't matter because it // will be centered on screen. - super(parent, "Message Boxes", 0, 0, 60, 16, flags); + super(parent, "Message Boxes", 0, 0, 64, 18, flags); int row = 1; @@ -133,7 +137,7 @@ public class DemoMsgBoxWindow extends TWindow { ); row += 2; - addLabel("Input box", 1, row); + addLabel("Input box 1", 1, row); addButton("Open &input box", 35, row, new TAction() { public void DO() { @@ -148,6 +152,25 @@ public class DemoMsgBoxWindow extends TWindow { } } ); + row += 2; + + addLabel("Input box 2", 1, row); + addButton("Cance&llable input box", 35, row, + new TAction() { + public void DO() { + TInputBox in = getApplication().inputBox("Input Box", +"This is an example of an InputBox.\n" + +"\n" + +"Note that the InputBox text can span multiple\n" + +"lines.\n" + +"This one has both OK and Cancel buttons.\n", + "some input text", TInputBox.Type.OKCANCEL); + getApplication().messageBox("Your InputBox Answer", + "You entered: " + in.getText() + " and pressed " + + in.getResult()); + } + } + ); addButton("&Close Window", (getWidth() - 14) / 2, getHeight() - 4, new TAction() {