⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cardlistpanel.java

📁 java绘图 java awt 经典绘图的例子,对于初学awt模块的人非常有帮助.
💻 JAVA
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package cardmanager;import java.awt.BorderLayout;import javax.swing.BorderFactory;import javax.swing.DefaultListModel;import javax.swing.JFrame;import javax.swing.JList;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.ListSelectionModel;import javax.swing.event.ListSelectionEvent;import javax.swing.event.ListSelectionListener;/** * * @author zhaolin */public class CardListPanel extends JPanel{    private JList list;    private DefaultListModel model;    public CardListPanel(){        initConponent();    }    private void initConponent() {        this.setLayout(new BorderLayout());        this.setBorder(BorderFactory.createTitledBorder("名片列表"));        list = new JList();        list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);        list.setModel(CardManagerModel.getInstance().getListModel());        list.addListSelectionListener(new ListSelectionListener(){            public void valueChanged(ListSelectionEvent e) {                Card selectedCard = (Card)list.getSelectedValue();                CardManagerModel.getInstance().setCurrentCard(selectedCard);                CardManagerFrame cmf = (CardManagerFrame)getTopLevelAncestor();                cmf.fireCardChanged();            }        });        this.add(new JScrollPane(list));    }        public static void main(String[] args) {        JFrame f = new JFrame();        f.setContentPane(new CardListPanel());        f.pack();        f.setVisible(true);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -