简体   繁体   English

不同结构的Jtable

[英]Jtable with Different Structure

I have jTable with default(Rectangular or square) structure.I want to make corner of the jTable rounder. 我有jTable默认(矩形或方形)结构。我想制作jTable圆角。

Is there any method or way available for that? 有没有可用的方法或方法?

I have already checked the JTable API but i didn't find any thing useable. 我已经检查过JTable API,但我没有找到任何可用的东西。

For a reference I have attached this image. 作为参考,我附上了这张图片。

在此输入图像描述

Description of the image - 图像描述 -

I want to make highlighted areas rounder. 我想要突出显示区域更圆。

Searching the JTable APIs for the look and feel is the wrong place to search. 搜索JTable API的外观是错误的搜索位置。 The JTable class is concerned with the implementation of the table related properties. JTable类关注表相关属性的实现。 TableUI would be the class that could define the look and feel. TableUI将是可以定义外观的类。 Check out the look and feel in java tutorials. 查看java教程中的外观

public class JtableExample {

     public static void main(String args[]) {
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

            Object rowData[][] = { { "Row1-Column1", "Row1-Column2", "Row1-Column3" },
                { "Row2-Column1", "Row2-Column2", "Row2-Column3" } };
            Object columnNames[] = { "Column One", "Column Two", "Column Three" };
            JTable table = new JTable(rowData, columnNames);

            JScrollPane scrollPane = new JScrollPane(table);
            frame.add(scrollPane, BorderLayout.CENTER);
            Border roundedBorder = new LineBorder(Color.black, 5, true); // the third parameter - true, says it's round
            scrollPane.setBorder(roundedBorder);
            frame.setSize(300, 150);
            frame.setVisible(true);

          }


}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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