public Dimension resize(final Dimension pendingResize, final RequestOrigin origin) { final int oldHeight = myTerminalHeight; if (pendingResize.width <= MIN_WIDTH) { pendingResize.setSize(MIN_WIDTH, pendingResize.height); } final Dimension pixelSize = myDisplay.requestResize( pendingResize, origin, myCursorY, new ResizeHandler() { @Override public void sizeUpdated(int termWidth, int termHeight, int cursorY) { myTerminalWidth = termWidth; myTerminalHeight = termHeight; myCursorY = cursorY; myCursorX = Math.min(myCursorX, myTerminalWidth - 1); myTabulator.resize(myTerminalWidth); } }); myScrollRegionBottom += myTerminalHeight - oldHeight; return pixelSize; }
public Container CreateContentPane() { // Create the content-pane-to-be. JPanel contentPane = new JPanel(new BorderLayout()); contentPane.setOpaque(true); // the log panel log = new JTextPane(); log.setEditable(false); log.setBackground(Color.BLACK); logPane = new JScrollPane(log); kit = new HTMLEditorKit(); doc = new HTMLDocument(); log.setEditorKit(kit); log.setDocument(doc); DefaultCaret c = (DefaultCaret) log.getCaret(); c.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); ClearLog(); // the preview panel previewPane = new DrawPanel(); previewPane.setPaperSize(paper_top, paper_bottom, paper_left, paper_right); // status bar statusBar = new StatusBar(); Font f = statusBar.getFont(); statusBar.setFont(f.deriveFont(Font.BOLD, 15)); Dimension d = statusBar.getMinimumSize(); d.setSize(d.getWidth(), d.getHeight() + 30); statusBar.setMinimumSize(d); // layout Splitter split = new Splitter(JSplitPane.VERTICAL_SPLIT); split.add(previewPane); split.add(logPane); split.setDividerSize(8); contentPane.add(statusBar, BorderLayout.SOUTH); contentPane.add(split, BorderLayout.CENTER); // open the file if (recentFiles[0].length() > 0) { OpenFileOnDemand(recentFiles[0]); } // connect to the last port ListSerialPorts(); if (Arrays.asList(portsDetected).contains(recentPort)) { OpenPort(recentPort); } return contentPane; }