Thanks, that’s what I get for not using layout:
This works on Mac and Windows; replaced panel with a toolbar(no layout) other components used BorderLayout():
import javax.swing.*;
import java.awt.*;
import org.fife.ui.rsyntaxtextarea.*;
import org.fife.ui.rtextarea.*;
RSyntaxTextArea txtArea;
RTextScrollPane txtScrlPane;
JFrame frame;
JToolBar toolbar;
final int _wndW = 750;
final int _wndH = 700;
void setup() {
surface.setVisible(false);
txtArea = new RSyntaxTextArea();
txtArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
txtScrlPane = new RTextScrollPane(txtArea);
frame = new JFrame("Editor");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
toolbar = new JToolBar();
toolbar.setFloatable(false);
toolbar.setLayout(null);
toolbar.setRollover(true);
toolbar.setPreferredSize(new Dimension(_wndW, 50));
frame.add(toolbar, BorderLayout.NORTH);
frame.add(txtScrlPane, BorderLayout.CENTER);
frame.setBounds(100, 100, _wndW, _wndH);
frame.setVisible(true);
SwingUtilities.invokeLater(() -> {
//buildWnd(); // Build components on EventDispatchThread(EDT).
}
);
}
This obviates the need for component listeners to handle resizes and vertical scroller is full width on Windows 11. Thanks for the suggestion.