mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
misc_swing_components.md: cleanup
This commit is contained in:
parent
a359b38603
commit
8f64824df7
@ -6,33 +6,36 @@
|
|||||||
|
|
||||||
### `Messages`
|
### `Messages`
|
||||||
|
|
||||||
The [`Messages`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/ui/Messages.java) class provides a way to show simple message boxes, input dialogs (modal dialogs with a text field), and chooser dialogs (modal dialogs with a combo box).
|
[`Messages`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/ui/Messages.java) provides a way to show simple
|
||||||
The function of different methods of the class should be clear from their names.
|
message boxes, input dialogs (modal dialogs with a text field), and chooser dialogs (modal dialogs with a combo box).
|
||||||
When running on macOS, the message boxes shown by the `Messages` class use the native UI.
|
On macOS, the message boxes use the native UI.
|
||||||
|
|
||||||
The `showCheckboxMessageDialog()` function provides an easy way to implement a _Do not show this again_ checkbox on messages.
|
The `showCheckboxMessageDialog()` function provides an easy way to implement a <control>Do not show this again</control> checkbox on messages.
|
||||||
|
|
||||||
Note that it is recommended to use non-modal notifications instead of modal message boxes whenever it's appropriate.
|
> It is recommended to use non-modal notifications instead of modal message boxes whenever appropriate.
|
||||||
Please refer to the [Notifications](notifications.md) topic for more information.
|
> Refer to the [](notifications.md) topic for more information.
|
||||||
|
>
|
||||||
|
{title="Avoid Modal Dialogs"}
|
||||||
|
|
||||||
### `JBSplitter`
|
### `JBSplitter`
|
||||||
|
|
||||||
The [`JBSplitter`](%gh-ic%/platform/platform-api/src/com/intellij/ui/JBSplitter.java) class is JetBrains' replacement for the standard [`JSplitPane`](https://docs.oracle.com/javase/8/docs/api/javax/swing/JSplitPane.html) class.
|
[`JBSplitter`](%gh-ic%/platform/platform-api/src/com/intellij/ui/JBSplitter.java) is a replacement for the standard [`JSplitPane`](https://docs.oracle.com/javase/8/docs/api/javax/swing/JSplitPane.html) class.
|
||||||
Unlike some other JetBrains-enhanced Swing components, it's not a drop-in replacement and has a different API.
|
Unlike some other JetBrains-enhanced Swing components, it is not a drop-in replacement and has a different API.
|
||||||
However, to achieve a consistent user experience, it's recommended to use `JBSplitter` instead of the standard `JSplitPane`.
|
However, to achieve a consistent user experience, it is recommended to use `JBSplitter` instead of the standard `JSplitPane`.
|
||||||
|
|
||||||
To add components to the splitter, call the `setFirstComponent()` and `setSecondComponent()` methods.
|
To add components to the splitter, call the `setFirstComponent()` and `setSecondComponent()` methods.
|
||||||
|
|
||||||
`JBSplitter` supports automatic remembering of the split proportion.
|
`JBSplitter` supports automatic remembering of the split proportion.
|
||||||
To enable it, call the `setSplitterProportionKey()` method and pass the ID under which the proportion will be stored.
|
To enable it, call the `setSplitterProportionKey()` method and pass the unique ID under which the proportion will be stored.
|
||||||
|
|
||||||
### `JBTabs`
|
### `JBTabs`
|
||||||
|
|
||||||
The [`JBTabs`](%gh-ic%/platform/platform-api/src/com/intellij/ui/tabs/JBTabs.java) class is JetBrains' implementation of the tab control, used for editor tabs and a few other components.
|
[`JBTabs`](%gh-ic%/platform/platform-api/src/com/intellij/ui/tabs/JBTabs.java) is an implementation of the tab control, used for editor tabs and a few other components.
|
||||||
It has a significantly different look & feel compared to the standard Swing tabs, and looks less native on the macOS platform, so it's up to the developer to choose which tab control would be more appropriate.
|
It has a significantly different look & feel compared to the standard Swing tabs and looks less native on the macOS platform,
|
||||||
|
so it's up to the developer to choose which tab control would be more appropriate.
|
||||||
|
|
||||||
### Toolbars
|
### Toolbars
|
||||||
|
|
||||||
See [](toolbar.md) in the UI Guidelines for an overview.
|
See [](toolbar.md) in the UI Guidelines for an overview.
|
||||||
|
|
||||||
[Building UI from Actions](basic_action_system.md#building-ui-from-actions) covers creating `AnAction`-based toolbars.
|
[](basic_action_system.md#building-ui-from-actions) covers creating `AnAction`-based toolbars.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user