本文整理汇总了Java中javax.swing.JTable.setBorder方法的典型用法代码示例。如果您正苦于以下问题:Java JTable.setBorder方法的具体用法?Java JTable.setBorder怎么用?Java JTable.setBorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JTable
的用法示例。
在下文中一共展示了JTable.setBorder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConstraintsTable
import javax.swing.JTable; //导入方法依赖的package包/类
public JTable createConstraintsTable(boolean rebuild) {
JTable table = new JTable(new VRPTableModel(rebuild));
table.setPreferredScrollableViewportSize(new Dimension(60, 60));
table.setAutoscrolls(true);
table.setAutoCreateColumnsFromModel(true);
table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
table.setMaximumSize(new Dimension(60, 60));
table.setBackground(Color.LIGHT_GRAY);
table.setBorder(BorderFactory.createCompoundBorder());
table.setForeground(Color.BLACK);
table.setShowGrid(true);
return table;
}
示例2: jbInit
import javax.swing.JTable; //导入方法依赖的package包/类
void jbInit() throws Exception {
setBorder(BorderList.etchedBorder5);
ActionListener actionEventHandler = new ActionEventHandler();
MouseListener mouseEventHandler = new MouseEventHandler();
addButton = new JButton("Add");
addButton.setActionCommand("Add");
addButton.addActionListener(actionEventHandler);
removeButton = new JButton("Remove");
removeButton.setActionCommand("Remove");
removeButton.addActionListener(actionEventHandler);
//by lila
JPanel p1 = new JPanel();
p1.setLayout(new FlowLayout(FlowLayout.CENTER));
p1.add(addButton);
p1.add(removeButton);
model = new MyFieldTableModel();
fieldTable = new JTable(model);
fieldTable.setRowSelectionAllowed(true);
fieldTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
fieldTable.addMouseListener(mouseEventHandler);
fieldTable.setBorder(BorderList.bebelBorder);
scrollpane = new JScrollPane(fieldTable);
scrollpane.setPreferredSize(new Dimension(550,220));
//by lila
JPanel p2 = new JPanel();
p2.setLayout(new BorderLayout(0,5));
TitledBorder border = new TitledBorder(new EtchedBorder(),"Field Table");
border.setTitleFont(FontList.regularFont);
border.setTitleColor(Color.black);
p2.setBorder(border);
p2.add(p1,BorderLayout.SOUTH);
p2.add(scrollpane,BorderLayout.CENTER);
p2.add(new JPanel(),BorderLayout.EAST);
p2.add(new JPanel(),BorderLayout.WEST);
setLayout(new FlowLayout(FlowLayout.CENTER));
add(p2);
}