How to keep the window of a node of a fixed size?

#1

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?

0 Likes

#2

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

2 Likes

#3

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…

0 Likes

#4

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

3 Likes

#5

Many thanks. That was precisely what I needed. Regards.

3 Likes