JScrollPane: setColumnHeaderView(Component view) : JScrollPane « javax.swing « Java by API






JScrollPane: setColumnHeaderView(Component view)

  
import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JScrollPane;

public class MainClass {

  public static void main(final String args[]) {
    String labels[] = { "A", "B", "C", "D", "E" };
    JFrame frame = new JFrame("Selection Modes");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JList list1 = new JList(labels);
    JScrollPane sp1 = new JScrollPane(list1);
    sp1.setColumnHeaderView(new JLabel("List"));
    frame.add(sp1, BorderLayout.CENTER);
    frame.setSize(300, 200);
    frame.setVisible(true);

  }
}

           
         
    
  








Related examples in the same category

1.JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS
2.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS
3.new JScrollPane(Component view, int vsbPolicy, int hsbPolicy)
4.JScrollPane: getHorizontalScrollBar()
5.JScrollPane: getHorizontalScrollBarPolicy()
6.JScrollPane: getVerticalScrollBar()
7.JScrollPane: getVerticalScrollBarPolicy()
8.JScrollPane: setCorner(String key, Component corner)
9.JScrollPane: setRowHeaderView(Component com)
10.JScrollPane: setViewportView(Component view)