本文整理匯總了Java中javax.swing.JList.setFixedCellHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java JList.setFixedCellHeight方法的具體用法?Java JList.setFixedCellHeight怎麽用?Java JList.setFixedCellHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JList
的用法示例。
在下文中一共展示了JList.setFixedCellHeight方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ScrollBivariatePanel
import javax.swing.JList; //導入方法依賴的package包/類
public ScrollBivariatePanel(JWatBivariateStatsTable table) {
tab = table;
setViewportView(tab);
ListModel lm = new AbstractListModel() {
private static final long serialVersionUID = 1L;
String headers[] = ((JWatBivariateStatsTableModel) tab.getModel()).getNames();
public int getSize() {
return headers.length;
}
public Object getElementAt(int index) {
return headers[index];
}
};
JList rowHeader = new JList(lm);
rowHeader.setBackground(getBackground());
rowHeader.setFixedCellWidth(100);
rowHeader.setFixedCellHeight(tab.getRowHeight());
rowHeader.setCellRenderer(new RowHeaderRenderer(tab));
setRowHeaderView(rowHeader);
}
示例2: setNames
import javax.swing.JList; //導入方法依賴的package包/類
public void setNames() {
ListModel lm = new AbstractListModel() {
private static final long serialVersionUID = 1L;
String headers[] = ((JWatBivariateStatsTableModel) tab.getModel()).getNames();
public int getSize() {
return headers.length;
}
public Object getElementAt(int index) {
return headers[index];
}
};
JList rowHeader = new JList(lm);
rowHeader.setBackground(getBackground());
rowHeader.setFixedCellWidth(100);
rowHeader.setFixedCellHeight(tab.getRowHeight());
rowHeader.setCellRenderer(new RowHeaderRenderer(tab));
setRowHeaderView(rowHeader);
}
示例3: setNames
import javax.swing.JList; //導入方法依賴的package包/類
public void setNames() {
ListModel lm = new AbstractListModel() {
/**
*
*/
private static final long serialVersionUID = 1L;
String headers[] = ((JWatBivariateStatsTableModel) tab.getModel()).getNames();
public int getSize() {
return headers.length;
}
public Object getElementAt(int index) {
return headers[index];
}
};
JList rowHeader = new JList(lm);
rowHeader.setBackground(getBackground());
rowHeader.setFixedCellWidth(100);
rowHeader.setFixedCellHeight(tab.getRowHeight());
rowHeader.setCellRenderer(new RowHeaderRenderer(tab));
setRowHeaderView(rowHeader);
}
示例4: createNewConfigurableJList
import javax.swing.JList; //導入方法依賴的package包/類
/**
* Creates a new JList for a given source of a configurable
*
* @param source
* can be null for local configurables, otherwise name of the source
* @return the created JList
*/
private JList<Configurable> createNewConfigurableJList(String source) {
final JList<Configurable> createdConfigList = new JList<>();
createdConfigList.setModel(source == null ? localConfigListModel : remoteConfigListModels.get(source));
createdConfigList.setCellRenderer(new ConfigurableRenderer());
createdConfigList.setFixedCellHeight(40);
createdConfigList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
createdConfigList.setBackground(LIGHTER_GRAY);
return createdConfigList;
}
示例5: createNewInfoLabelJList
import javax.swing.JList; //導入方法依賴的package包/類
/**
* Creates a new JList for info labels of a source
*
* @param source
* can be null for local source, otherwise name of the source
* @return the created JList
*/
private JList<String> createNewInfoLabelJList(String source) {
final JList<String> createdInfoLabelList = new JList<>();
createdInfoLabelList.setModel(source == null ? localInfoLabelListModel : remoteInfoLabelListModels.get(source));
createdInfoLabelList.setCellRenderer(new ConfigurableInfoLabelRenderer());
createdInfoLabelList.setFixedCellHeight(20);
createdInfoLabelList.setBackground(LIGHTER_GRAY);
return createdInfoLabelList;
}
示例6: ScrollBivariatePanel
import javax.swing.JList; //導入方法依賴的package包/類
public ScrollBivariatePanel(JWatBivariateStatsTable table) {
tab = table;
setViewportView(tab);
ListModel lm = new AbstractListModel() {
/**
*
*/
private static final long serialVersionUID = 1L;
String headers[] = ((JWatBivariateStatsTableModel) tab.getModel()).getNames();
public int getSize() {
return headers.length;
}
public Object getElementAt(int index) {
return headers[index];
}
};
JList rowHeader = new JList(lm);
rowHeader.setBackground(getBackground());
rowHeader.setFixedCellWidth(100);
rowHeader.setFixedCellHeight(tab.getRowHeight());
rowHeader.setCellRenderer(new RowHeaderRenderer(tab));
setRowHeaderView(rowHeader);
}
示例7: 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;
}