简体   繁体   中英

Java create table with a button on the first row

I'm trying to create a table where the first row contains 1 button, and the other rows contain multiple columns. Example picture:

在此处输入图片说明

How could I make this?

I've attempted the following: add button to table but that only allows you to add a button like this: 例子2

I've looked at other stackOverflow posts, but those answers contain dead links, which are no help to me.

This is relatively easy by placing the button outside the table. Here is how to go about it:

Create a panel with a BorderLayout . Add the table (to a scroll pane) to the CENTER of the border layout. Add the button to the PAGE_START of the border layout. Job done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM