Universal Robots Forum

How to change the main panel

Hi
I would like to switch from the panel on the current frame to the new panel, just like when I press the Load Program Button.
How to change the panel of the current frame in the installation view?

Is it impossible?
Please reply…

The supported actions here are listed in the com.ur.urcap.api.domain.userinteraction API package.
Check out the API reference for more details on what actions are supported.

Are there any examples?

Ellipse shows both RobotPositionCallback and RobotMovement.

Umm…
I want to know how to switch the ui screen just like pressing the Load Program.

This is currently not supported.

Is there any way to update the buildUI’s jPanel on ui?
jPanel revalidate, repaint did not update yet …

Whilst you cant alter any of the properties of the panel that buildUI() takes as an argument, if you add another panel to the base panel, then use that as the basis for your UI, you can have full control over what it does, something like this

private JPanel myPanel;

buildUI(JPanel basePanel, ContributionProvider<MyNodeContribution> provider)
{
    myPanel = new JPanel();
    basePanel.add(myPanel);
}

You have full control over what myPanel looks like and how it behaves, you can set background colours etc via methods like myPanel.setBackground(colour) etc.

2 Likes

As you said, I added my panel to the base panel, but nothing on the panel.

@sam.hilton
When I add my panel to the base panel as you said, it is still visible only in the program or installation node view. Nothing happens on the base panel. I guess I should use another class or interface, not ProgramNodeView or InstallationNodeView?

It is only possible to add UI components to either a ProgramNodeView, InstallationNodeView or Toolbar.
It is not supported to add UI components elsewhere in the UI (API 1.5)

As Jacob said, any UI components should be defined and controlled in a view or toolbar class, or accessed via a getter/setter from a contribution class. I’m not sure where else you would want your URCap to be visible?

I would want to add my own panel to the Run Tab in order to create something like HMI panel with buttons for operator. I may do it by the Toolbar but its width is not changable and it’s too tight for HMI.

This is not possible with the current API and has been requested. See this feature request

Thank you.
So maybe there is a possibility to change the Toolbar’s width?

I’m afraid I don;t have any experience in coding a toolbar, have a look through the API and see what you can find. I’d have thought that the size of the toolbar will be the size of the JPanel passed as an argument in buildUI(), have a play with resizing this panel and see what happens.

1 Like