开发者

scrollpane blocks buttons in BorderLayout?

开发者 https://www.devze.com 2023-04-11 20:54 出处:网络
I have a really weird problem with a JScrollPane and a BorderLayout. For short explaination: i have a JTable which is inside the JScrollPane and this is with a JPanel and the JTableHeader on a JTabbed

I have a really weird problem with a JScrollPane and a BorderLayout. For short explaination: i have a JTable which is inside the JScrollPane and this is with a JPanel and the JTableHeader on a JTabbedPane. Very Simple Layout. If i add just the JTable to my JPanel, the buttons are working. If i add the JScrollPane, the Buttons are n开发者_运维百科ot working anymore, so i cant click them! The ActionLister is never reached and i cant see the click-animation.

Some Sample code to explain:

d_pane = new JPanel();
d_button = new JPanel();
d_pane.add(table.getTableHeader(), BorderLayout.PAGE_START);
dl_scroll = new JScrollPane(table);
d_pane.add(dl_scroll, BorderLayout.CENTER);
// d_button is ridLayouted with 3 Buttons in there
d_pane.add(d_button, BorderLayout.PAGE_END);


1) The JScrollPane takes care of the table header itself. Don't add it to the pane.

2) the button does not seem to get the mouse events, probably because another component is above it - do you have other components/code in the setup?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号