本文整理汇总了Java中javax.swing.JScrollPane.setColumnHeaderView方法的典型用法代码示例。如果您正苦于以下问题:Java JScrollPane.setColumnHeaderView方法的具体用法?Java JScrollPane.setColumnHeaderView怎么用?Java JScrollPane.setColumnHeaderView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JScrollPane
的用法示例。
在下文中一共展示了JScrollPane.setColumnHeaderView方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureEnclosingScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/** Overridden - JTable's implementation of the method will
* actually attach (and leave behind) a gratuitous border
* on the enclosing scroll pane. */
protected final void configureEnclosingScrollPane() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
JViewport viewport = scrollPane.getViewport();
if ((viewport == null) || (viewport.getView() != this)) {
return;
}
scrollPane.setColumnHeaderView(getTableHeader());
}
}
}
示例2: unconfigureEnclosingScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
@Override
protected void unconfigureEnclosingScrollPane() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
// Make certain we are the viewPort's view and not, for
// example, the rowHeaderView of the scrollPane -
// an implementor of fixed columns might do this.
JViewport viewport = scrollPane.getViewport();
if (viewport == null || viewport.getView() != this) {
return;
}
scrollPane.setColumnHeaderView(null);
scrollPane.setRowHeaderView(null);
viewport.removeChangeListener(scrollListener);
rowHeader.uninstall();
}
}
}
示例3: unconfigureEnclosingScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
@Override
protected void unconfigureEnclosingScrollPane() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
// Make certain we are the viewPort's view and not, for
// example, the rowHeaderView of the scrollPane -
// an implementor of fixed columns might do this.
JViewport viewport = scrollPane.getViewport();
if (viewport == null || viewport.getView() != this) {
return;
}
scrollPane.setColumnHeaderView(null);
scrollPane.setRowHeaderView(null);
viewport.removeChangeListener(scrollListener);
rowHeader.uninstall();
}
}
}
示例4: configureEnclosingScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* duplicated to avoid repeating the same checks multiple times
*/
@Override
protected void configureEnclosingScrollPane() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
// Make certain we are the viewPort's view and not, for
// example, the rowHeaderView of the scrollPane -
// an implementor of fixed columns might do this.
JViewport viewport = scrollPane.getViewport();
if (viewport == null || viewport.getView() != this) {
return;
}
scrollPane.setColumnHeaderView(getTableHeader());
Border border = scrollPane.getBorder();
if (border == null || border instanceof UIResource) {
scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder"));
}
//rowHeader=new RowHeader(dataModel);
rowHeader.setRowHeight(CommonConstants.ROW_HEIGHT);
rowHeader.install(this, scrollPane);
installLabels(scrollPane);
installSelectAllButton(scrollPane);
viewport.addChangeListener(scrollListener);
}
}
}
示例5: configureEnclosingScrollPane
import javax.swing.JScrollPane; //导入方法依赖的package包/类
/**
* duplicated to avoid repeating the same checks multiple times
*/
@Override
protected void configureEnclosingScrollPane() {
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
// Make certain we are the viewPort's view and not, for
// example, the rowHeaderView of the scrollPane -
// an implementor of fixed columns might do this.
JViewport viewport = scrollPane.getViewport();
if (viewport == null || viewport.getView() != this) {
return;
}
scrollPane.setColumnHeaderView(getTableHeader());
Border border = scrollPane.getBorder();
if (border == null || border instanceof UIResource) {
scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder"));
}
//rowHeader=new RowHeader(dataModel);
rowHeader.install(this, scrollPane);
installLabels(scrollPane);
installSelectAllButton(scrollPane);
viewport.addChangeListener(scrollListener);
}
}
}
示例6: 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());
}
}
}
示例7: PanelCourses
import javax.swing.JScrollPane; //导入方法依赖的package包/类
public PanelCourses(Student student,CourseOutline courseoutline) throws Exception{
this.co=courseoutline;
setLayout(new BorderLayout(0, 0));
cmdao=new CourseMappingDAO();
/*JScrollPane scrollPane = new JScrollPane();
add(scrollPane, BorderLayout.CENTER);*/
JLabel lblCoursesTaken = new JLabel("Courses Taken");
//scrollPane.setColumnHeaderView(lblCoursesTaken);
StudentCourseOutlineDAO sctodao = new StudentCourseOutlineDAO(student);
ArrayList<String> course = sctodao.Coursedata(student);
/* DefaultListModel<String> model = new DefaultListModel<>();
int size = course.size();
for(int i=0; i<size; i++){
model.addElement(course.get(i));
}
JList list = new JList(model);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent arg0) {
String course_name=(String)list.getSelectedValue();
//System.out.println("Course id is::"+course_name);
//System.out.println("Batch is ::"+student.getBatch());
String path=cmdao.getDirectoryPath(course_name, student.getBatch());
//System.out.println("Path is::"+path);
//System.out.println(path);
co.c_panel.curr_subject=course_name;
try {
co.c_panel.resetPanes(student, path);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
jb=(JLabel)co.panel.getComponent(7);
jb_c=(JLabel)co.panel.getComponent(6);
jb.setVisible(true);
jb_c.setVisible(true);
jb.setText(course_name);
CardLayout card=(CardLayout)co.panel_1.getLayout();
co.panel_2.getComponent(0).setEnabled(true);
card.show(co.panel_1, "CoursePanel");
}
});
scrollPane.setViewportView(list);*/
TableCellRenderer buttonRenderer = new ButtonRenderer();
model=new CourseTableModel(course,this,student);
table = new JTable();
table.setRowHeight(30);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setDefaultRenderer(JButton.class,buttonRenderer);
table.addMouseListener(new JTableButtonMouseListener(table));
table.setModel(model);
JScrollPane scrollPane = new JScrollPane(table,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
//resizeColumnWidth(table);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
TableColumnModel tcm = table.getColumnModel();
tcm.getColumn(0).setPreferredWidth(800);
tcm.getColumn(1).setPreferredWidth(200);
scrollPane.setBounds(10, 57, 1320, 450);
scrollPane.setColumnHeaderView(lblCoursesTaken);
add(scrollPane, BorderLayout.CENTER);
}