2013-03-14 47 views
0

我有默认的(矩形或方形)结构的jTable。我想制作jTable的圆角。不同结构的Jtable

是否有任何方法或方法可用于此?

我已经检查了JTable API但我没有找到任何可用的东西。

仅供参考,我附上了这张图片。图像的

enter image description here

描述 -

我想要强调的区域全才。

+1

转寄此http://today.java.net/pub/a/today/2008/03/18/translucent-and-shaped-swing-windows.html – Dhinakar 2013-03-14 06:44:38

回答

1
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); 

      } 


} 
+0

感谢您answer.Can我们做同样没有使用边框。 – 2013-03-21 12:52:47

1

搜索JTable API的外观和感觉是错误的搜索位置。 JTable类与表相关属性的实现有关。 TableUI将是可以定义外观和感觉的类。在java教程中查看look and feel