本文整理匯總了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());
}
}
}