當前位置: 首頁>>代碼示例>>Java>>正文


Java JList.setFont方法代碼示例

本文整理匯總了Java中javax.swing.JList.setFont方法的典型用法代碼示例。如果您正苦於以下問題:Java JList.setFont方法的具體用法?Java JList.setFont怎麽用?Java JList.setFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JList的用法示例。


在下文中一共展示了JList.setFont方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateScrollPane

import javax.swing.JList; //導入方法依賴的package包/類
public JScrollPane generateScrollPane()
{	
	JScrollPane newScroll = new JScrollPane();
	JList list = new JList(listModel);
	list.setFont( new Font("monospaced", Font.PLAIN, 12) );
	newScroll.setViewportView(list);
	
	Dimension listSize = new Dimension(400, 150);
	newScroll.setSize(listSize);
	newScroll.setMaximumSize(listSize);
	newScroll.setPreferredSize(listSize);
	
	newScroll.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {  
        public void adjustmentValueChanged(AdjustmentEvent e) {  
            e.getAdjustable().setValue(e.getAdjustable().getMaximum());  
        }
    }); 
	return newScroll;
}
 
開發者ID:TeamRedFox,項目名稱:PointOfSale,代碼行數:20,代碼來源:Cart.java

示例2: addFileList

import javax.swing.JList; //導入方法依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" })
private void addFileList() {
	fileModel = new DefaultListModel();
	fileList = new JList(fileModel);
	fileList.setFont(new Font(Font.SANS_SERIF, 0, 12));
	JScrollPane sp = new JScrollPane(fileList);
	sp.setBounds(5, 35, 350, 200);
	frame.getContentPane().add(sp);
}
 
開發者ID:JudgeGlass,項目名稱:Install_Builder_Universal,代碼行數:10,代碼來源:InstallBuilderWindow.java

示例3: addDirList

import javax.swing.JList; //導入方法依賴的package包/類
@SuppressWarnings({ "rawtypes", "unchecked" })
private void addDirList() {
	dirModel = new DefaultListModel();
	dirList = new JList(dirModel);
	dirList.setFont(new Font(Font.SANS_SERIF, 0, 12));
	JScrollPane sp = new JScrollPane(dirList);
	sp.setBounds(445, 35, 360, 200);
	frame.getContentPane().add(sp);
}
 
開發者ID:JudgeGlass,項目名稱:Install_Builder_Universal,代碼行數:10,代碼來源:InstallBuilderWindow.java

示例4: logFilesList

import javax.swing.JList; //導入方法依賴的package包/類
private JList<String> logFilesList() {
	
	
	file = new File(System.getProperty("user.dir") + File.separator + "Logging Store/");
	
	final JFileChooser fileChooser = new JFileChooser();
	fileChooser.setCurrentDirectory(file);
	fileChooser.setMultiSelectionEnabled(true);

	final DefaultListModel<String> model = new DefaultListModel<String>();
	
	final JList<String> list = new JList<String>(model);
	list.setPreferredSize(new Dimension(85, 480));
	list.setFont(new Font("Dialog", Font.PLAIN, 12));
	list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	list.setSelectedIndex(0);
	list.setFixedCellHeight(18);
	list.addMouseListener(new MouseAdapter() {
		@Override
		public void mousePressed(MouseEvent e) {
			if (e.getClickCount() == 2) {
				selectedItem = list.getSelectedValue();
				getSelectedFileName();
			}
		}
	});
	
	list.setCellRenderer(new LogRecordsListRenderer());

	File[] selectedFiles = fileChooser.getCurrentDirectory().listFiles();

	for (File f : selectedFiles) {
		if (f.getName().indexOf(".log") != -1) {
			model.addElement(f.getName());
		}else {
			continue;
		}
	}
	if(model.isEmpty()) {
		model.addElement("List is empty!");
	}
	
	return list;
}
 
開發者ID:Coder-ACJHP,項目名稱:Hotel-Properties-Management-System,代碼行數:45,代碼來源:ReadLogsWindow.java

示例5: HistoryViewer

import javax.swing.JList; //導入方法依賴的package包/類
/**
 * Create the frame.
 */
public HistoryViewer(String[] transactions) {
    this.transactions = transactions;

    int screenPositionX = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - 210;
    int screenPositionY = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2 - 290;
    setTitle("Bank Simulator");
    setResizable(false);
    setSize(419, 584);
    setLocation(screenPositionX, screenPositionY);
    setDefaultCloseOperation(HIDE_ON_CLOSE);

    JPanel panel = new JPanel();
    panel.setBackground(new Color(255, 255, 255));
    getContentPane().add(panel, BorderLayout.CENTER);
    panel.setLayout(null);

    JLabel lblBankSimulator = new JLabel("Bank Simulator");
    lblBankSimulator.setHorizontalAlignment(SwingConstants.CENTER);
    lblBankSimulator.setFont(new Font("Century Gothic", Font.BOLD, 36));
    lblBankSimulator.setForeground(new Color(0, 204, 153));
    lblBankSimulator.setBounds(79, 56, 265, 51);
    panel.add(lblBankSimulator);

    JLabel lblUsername = new JLabel("Reacent Transactions");
    lblUsername.setHorizontalAlignment(SwingConstants.CENTER);
    lblUsername.setForeground(new Color(0, 204, 153));
    lblUsername.setFont(new Font("Century Gothic", Font.BOLD, 21));
    lblUsername.setBounds(79, 133, 265, 45);
    panel.add(lblUsername);

    JList list = new JList();
    list.setFont(new Font("Tahoma", Font.BOLD, 13));
    list.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 204, 102)));
    list.setModel(new AbstractListModel() {

        public int getSize() {
            return transactions.length;
        }

        public Object getElementAt(int index) {
            return transactions[index];
        }
    });
    list.setForeground(new Color(0, 204, 102));
    list.setBounds(79, 214, 265, 279);
    panel.add(list);


}
 
開發者ID:oussamabonnor1,項目名稱:Java_event_Bank,代碼行數:53,代碼來源:HistoryViewer.java


注:本文中的javax.swing.JList.setFont方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。