本文整理汇总了Java中javax.swing.JScrollPane.setRowHeader方法的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.setRowHeader方法的具体用法?Java JScrollPane.setRowHeader怎么用?Java JScrollPane.setRowHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.setRowHeader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: install
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public void install(JTable table, JScrollPane jsp) {
if (this.table != null) {
throw new RuntimeException("already installed");
}
JViewport jv = new JViewport() {
/**
*
*/
private static final long serialVersionUID = 1L;
/* keeps the thing from growing */
@Override
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.width = width;
return d;
}
};
jv.setView(this);
jsp.setRowHeader(jv);
this.table = table;
if (dataModel instanceof DefaultRowHeaderModel) {
((DefaultRowHeaderModel) dataModel).setTable(table);
}
update();
}
示例2: install
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public void install(JTable table, JScrollPane jsp) {
if (this.table != null) {
throw new RuntimeException("already installed");
}
JViewport jv = new JViewport() {
/**
*
*/
private static final long serialVersionUID = 1L;
/* keeps the #@�$*& thing from growing */
@Override
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.width = width;
return d;
}
};
jv.setView(this);
jsp.setRowHeader(jv);
this.table = table;
if (dataModel instanceof DefaultRowHeaderModel) {
((DefaultRowHeaderModel) dataModel).setTable(table);
}
update();
}
示例3: processSideBars
import javax.swing.JScrollPane; //导入方法依赖的package包/类
private static void processSideBars(Map sideBars, JComponent ec, JScrollPane scroller) {
// Remove all existing sidebars
ec.removeAll();
// Add the scroller and the new sidebars
ec.add(scroller);
scroller.setRowHeader(null);
scroller.setColumnHeaderView(null);
// final MouseDispatcher mouse = new MouseDispatcher((JTextComponent) ec.getClientProperty(JTextComponent.class));
for (Iterator entries = sideBars.entrySet().iterator(); entries.hasNext(); ) {
Map.Entry entry = (Map.Entry) entries.next();
SideBarPosition position = (SideBarPosition) entry.getKey();
JComponent sideBar = (JComponent) entry.getValue();
// if (position.getPosition() == SideBarPosition.WEST) {
// JPanel p = new JPanel(new BorderLayout()) {
//
// @Override
// public void addNotify() {
// super.addNotify();
// infiltrateContainer(this, mouse, true);
// }
//
// @Override
// public void removeNotify() {
// infiltrateContainer(this, mouse, false);
// super.removeNotify();
// }
//
// };
// p.add(sideBar, BorderLayout.CENTER);
// sideBar = p;
// }
if (position.isScrollable()) {
if (position.getPosition() == SideBarPosition.WEST) {
scroller.setRowHeaderView(sideBar);
} else {
if (position.getPosition() == SideBarPosition.NORTH) {
scroller.setColumnHeaderView(sideBar);
} else {
throw new IllegalArgumentException("Unsupported side bar position, scrollable = true, position=" + position.getBorderLayoutPosition()); // NOI18N
}
}
} else {
ec.add(sideBar, position.getBorderLayoutPosition());
}
}
}