Hi, I am working with components in my node, which have a Scroll implemented, so I do not need the Scroll that is added in its configuration window.
I would like to know how to remove it and leave a fixed size to the window?
I dont think you can remove it, but you could call setHorizontalScrollBarPolicy()
and setVerticalScrollBarPolicy()
, setting them to HORIZONTAL_SCROLLBAR_NEVER
and VERTICAL_SCROLLBAR_NEVER
on it once you have added a DialogComponent (call getComponent().getParent()
on the dialog component once you have called addDialogComponent()
)
Steve
Ok thank you, but
once I have added the DialogComponent (call getComponent().getParent()
on the dialog component addDialogComponent()
)
However dont give the options…
setHorizontalScrollBarPolicy()
and setVerticalScrollBarPolicy()
, setting them to HORIZONTAL_SCROLLBAR_NEVER
and VERTICAL_SCROLLBAR_NEVER
. Can you help me please…
The following code works, assuming you are in the default ‘Options’ tab:
JScrollPane tabScrollPane = (JScrollPane) getTab("Options").getParent().getParent();
tabScrollPane.setHorizontalScrollBarPolicy(
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
tabScrollPane.setVerticalScrollBarPolicy(
ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
If you dont want to use the DialogComponent
subclasses, but instead create your own dialog from Swing components, then you can also do:
final JPanel tabPanel = new JPanel();
addTab("Test", tabPanel, false);
tabPanel.add(new JLabel("Test label")); //Example!
In this case a new tab, ‘Test’ is added with a JPanel
as the top level component. Adding a simple JLabel
is added as an example
Steve
Many thanks. That was precisely what I needed. Regards.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.