zoukankan      html  css  js  c++  java
  • JavaSwing JScrollPane的使用

    JavaSwing JScrollPane的使用:

    参考:http://duyz.blog.ifeng.com/article/340649.html

    package com.srie.test;
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.EventQueue;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.border.EmptyBorder;
    import javax.swing.JLabel;
    public class JFrame001 extends JFrame {
        private static final long serialVersionUID = -8298152118685661613L;
        private JPanel contentPane;
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        JFrame001 frame = new JFrame001();
                        frame.setVisible(true);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
        }
        /**
         * Create the frame.
         */
        public JFrame001() {
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setBounds(100, 100, 450, 300);
            contentPane = new JPanel();
            contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
            contentPane.setLayout(new BorderLayout(0, 0));
            setContentPane(contentPane);
            
            JScrollPane scrollPane = new JScrollPane();
            contentPane.add(scrollPane, BorderLayout.CENTER);
            
            JPanel panel = new JPanel();
            panel.setPreferredSize(new Dimension(800, 600));
            scrollPane.setViewportView(panel);
            JPanel panelColumn= new JPanel();
            scrollPane.setColumnHeaderView(panelColumn);
            
            JLabel lblNewLabel = new JLabel("New label");
            panelColumn.add(lblNewLabel);;
            JPanel panelRow = new JPanel();
            scrollPane.setRowHeaderView(panelRow);
            
            JLabel lblNewLabel_1 = new JLabel("New label");
            panelRow.add(lblNewLabel_1);
        }
    }
  • 相关阅读:
    创建数据库链
    redis命令
    redis.conf文件配置信息
    mybatis调用存储过程实现
    oracle游标使用遍历3种方法
    Proud Merchants
    Bag Problem
    Watch The Movie
    Accepted Necklace
    Bone Collector II
  • 原文地址:https://www.cnblogs.com/stono/p/5000494.html
Copyright © 2011-2022 走看看