How to refresh the EditorTextField ui
Answered
This is my code
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull com.intellij.openapi.wm.ToolWindow toolWindow) {
EditorTextField requestUrlTextField = new EditorTextField();
requestUrlTextField.setOpaque(false);
MessageBusConnection busConnection = ApplicationManager.getApplication().getMessageBus().connect();
busConnection.subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {
@Override
public void globalSchemeChange(EditorColorsScheme scheme) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
requestUrlTextField.repaint();
requestUrlTextField.revalidate();
}
});
}
});
JPanel jPanel = new JPanel(new BorderLayout());
jPanel.add(requestUrlTextField);
JPanel root = new JPanel(new BorderLayout());
root.add(jPanel, BorderLayout.NORTH);
toolWindow.getContentManager().addContent(
toolWindow.getContentManager().getFactory().createContent(root, "", false)
);
}
When I switched themes, it became smaller and had no inner margins
But when I closed tool windows and reopened it, it returned to its original state
Please sign in to leave a comment.
Hi,
I don't understand what component provides margin. I suggest trying to repaint the component containing editor text field.