Search code examples
javaswingjinternalframe

get components inside jscrollpane in a jinternal frame


How to get any content inside a j scroll pane which is added to a j internal frame

Basically, what i have a j table which is made from data in sql...the j internal frame has the name of the table...i want to get the name of the table whenever user wants to edit table....j table is in j scroll pane..and that scroll pane is inside j internal frame... i want to get selected j internal frame from the desktop pane...get the scroll pane inside it...and then get the j table inside the scrollpane


Solution

  • ... i want to get selected j internal frame from the desktop pane...

    Read the JDesktopPane API. You will find a method that gets the currently selected internal frame.

    get the scroll pane inside it

    Components are added to the "content pane" of the internal frame. So you need to get the content pane and then you can get the components added to it. Read the JInternalFrame and Container API's for the methods to get the content pane and then the components.

    and then get the j table inside the scrollpane

    Read the JScrollPane API. You will find a method that allows you to get the component added to the "viewport" of the scroll pane.

    I would start with the "getter" methods.