Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » WindowBuilder Bean Properties Table Displays Getter Method for Custom Swing Component
WindowBuilder Bean Properties Table Displays Getter Method for Custom Swing Component [message #1827604] Tue, 19 May 2020 08:46
Avi Abrami is currently offline Avi AbramiFriend
Messages: 31
Registered: December 2017
Member
I am using Eclipse Oxygen (4.7.3a) and WindowBuilder 1.9.1.201710100405 on Windows 7 (32 bit) with Oracle JDK 1.8.0_201 (32 bit).

I wrote a class that extends javax.swing.JPanel. This class contains a single member which is javax.swing.JLayer. This JLayer decorates a javax.swing.JSplitPane because I wanted a special divider for the JSplitPane and I managed to implement the special divider using a combination of JLayer and another class that I wrote which extends javax.swing.plaf.LayerUI.

I then wrote a BeanInfo class for the above component. The BeanInfo class contains property descriptors for three properties:
1. the left component for the JSplitPane
2. the right component for the JSplitPane
3. the divider orientation for the JSplitPane

My class, that extends JPanel, does not have an actual left component member nor a right component member nor even an orientation member since these are all really properties of the JSplitPane. My class has getter and setter methods for these properties, as follows

public class MyPanel extends JPanel {
    private JLayer<JSplitPane>  jLayer;

    private JSplitPane getSplitPane() {
        JSplitPane splitPane = null;
        if (jLayer != null) {
            splitPane = jLayer.getView();
        }
        return splitPane;
    }

    public Component getLeftComponent() {
        Component leftCmpt = null;
        JSplitPane splitPane = getSplitPane();
        if (splitPane != null) {
            leftCmpt = splitPane.getLeftComponent();
        }
        return leftCmpt;
    }

    public void setLeftComponent(Component cmpt) {
        JSplitPane splitPane = getSplitPane();
        if (splitPane != null) {
            splitPane.setLeftComponent(cmpt);
        }
    }

    public Component getRightComponent() {
        Component rightCmpt = null;
        JSplitPane splitPane = getSplitPane();
        if (splitPane != null) {
            rightCmpt = splitPane.getRightComponent();
        }
        return rightCmpt;
    }

    public void setRightComponent(Component cmpt) {
        JSplitPane splitPane = getSplitPane();
        if (splitPane != null) {
            splitPane.setRightComponent(cmpt);
        }
    }

    public int getOrientation() {
        int orientation = JSplitPane.VERTICAL_SPLIT;
        JSplitPane splitPane = getSplitPane();
        if (splitPane != null) {
            orientation = splitPane.getOrientation();
        }
        return orientation;
    }

    public void setOrientation(int orientation) {
        JSplitPane splitPane = getSplitPane();
        if (splitPane != null) {
            splitPane.setOrientation(orientation);  //throws java.lang.IllegalArgumentException
        }
    }
}

In WindowBuilder, in the Bean properties table, there is a row in the table for the orientation property but no row for left component and no row for right component. I want to know why the Bean properties table does not contain a row for the left component and right component properties. I have uploaded a screen capture of my WindowBuilder showing my component.

Note that if I click on the Show advanced properties button in the Bean properties table, leftComponent and rightComponent do appear.
  • Attachment: wndwbldr.png
    (Size: 41.57KB, Downloaded 9 times)

[Updated on: Sun, 24 May 2020 04:30]

Report message to a moderator

Previous Topic:Installed WindowBuilder but not showing up
Next Topic:Classpath for custom components
Goto Forum:
  


Current Time: Sat Aug 08 12:59:07 GMT 2020

Powered by FUDForum. Page generated in 0.01687 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top