emulator.writeRemote("\033[8;" + getHeight() + ";" +
getWidth() + "t");
}
+
+ // Pass the correct text cell width/height to the emulator
+ if (getScreen() != null) {
+ emulator.setTextWidth(getScreen().getTextWidth());
+ emulator.setTextHeight(getScreen().getTextHeight());
+ }
}
return;
onResize(new TResizeEvent(TResizeEvent.Type.WIDGET, getWidth(),
getHeight()));
- // Pass the correct text cell width/height to the emulator
- emulator.setTextWidth(getScreen().getTextWidth());
- emulator.setTextHeight(getScreen().getTextHeight());
-
// Hide mouse when typing option
if (System.getProperty("jexer.TTerminal.hideMouseWhenTyping",
"true").equals("false")) {
List<TWidget> widgets = null;
switch (menu.getId()) {
case TMenu.MID_SPLIT_VERTICAL:
+ if (children.size() == 0) {
+ break;
+ }
panel = new TPanel(null, x, y, width, height);
pane = new TSplitPane(null, x, y, width, height, true);
widgets = new ArrayList<TWidget>(children);
assert (panel.isActive() == true);
return;
case TMenu.MID_SPLIT_HORIZONTAL:
+ if (children.size() == 0) {
+ break;
+ }
panel = new TPanel(null, x, y, width, height);
pane = new TSplitPane(null, x, y, width, height, false);
widgets = new ArrayList<TWidget>(children);
/**
* Get this TWidget's parent TApplication.
*
- * @return the parent TApplication
+ * @return the parent TApplication, or null if not assigned
*/
public TApplication getApplication() {
- return window.getApplication();
+ if (window != null) {
+ return window.getApplication();
+ }
+ return null;
}
/**
* Get the Screen.
*
- * @return the Screen
+ * @return the Screen, or null if not assigned
*/
public Screen getScreen() {
- return window.getScreen();
+ if (window != null) {
+ return window.getScreen();
+ }
+ return null;
}
/**
import jexer.TApplication;
import jexer.TPanel;
import jexer.TSplitPane;
+import jexer.TTerminalWidget;
import jexer.TText;
import jexer.TWindow;
import jexer.layout.BoxLayoutManager;
TSplitPane pane = window.addSplitPane(0, 0, window.getWidth() - 2,
window.getHeight() - 2, true);
- pane.setLeft(new TText(null, TEXT, 0, 0, 10, 10));
- pane.setRight(new TText(null, TEXT, 0, 0, 10, 10));
+ // pane.setLeft(new TText(null, TEXT, 0, 0, 10, 10));
+ // pane.setRight(new TText(null, TEXT, 0, 0, 10, 10));
+
+ // For this demo, let's require ptypipe
+ System.setProperty("jexer.TTerminal.ptypipe", "true");
+ pane.setLeft(new TTerminalWidget(null, 0, 0));
+ pane.setRight(new TTerminalWidget(null, 0, 0));
app.run();
}