本文整理了Java中javax.swing.JList.setFixedCellWidth()
方法的一些代码示例,展示了JList.setFixedCellWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JList.setFixedCellWidth()
方法的具体详情如下:
包路径:javax.swing.JList
类名称:JList
方法名:setFixedCellWidth
暂无
代码示例来源:origin: pmd/pmd
private JComponent createXPathResultPanel() {
xpathResults.addElement("No XPath results yet, run an XPath Query first.");
xpathResultList.setBorder(BorderFactory.createLineBorder(Color.black));
xpathResultList.setFixedCellWidth(300);
xpathResultList.setCellRenderer(new ASTListCellRenderer());
xpathResultList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
xpathResultList.getSelectionModel().addListSelectionListener(new ASTSelectionListener());
JScrollPane scrollPane = new JScrollPane();
scrollPane.getViewport().setView(xpathResultList);
return scrollPane;
}
代码示例来源:origin: libgdx/libgdx
imageListModel = new DefaultListModel<String>();
imageList = new JList<String>(imageListModel);
imageList.setFixedCellWidth(250);
imageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
imagesPanel.add(imageList, new GridBagConstraints(0, 0, 1, 3, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
代码示例来源:origin: libgdx/libgdx
imageListModel = new DefaultListModel<String>();
imageList = new JList<String>(imageListModel);
imageList.setFixedCellWidth(250);
imageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
imagesPanel.add(imageList, new GridBagConstraints(0, 0, 1, 3, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
代码示例来源:origin: pmd/pmd
public DFAPanel() {
super();
setLayout(new BorderLayout());
JPanel leftPanel = new JPanel();
nodeList = new JList(nodes);
nodeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
nodeList.setFixedCellWidth(150);
nodeList.setBorder(BorderFactory.createLineBorder(Color.black));
nodeList.addListSelectionListener(this);
leftPanel.add(nodeList);
add(leftPanel, BorderLayout.WEST);
dfaCanvas = new DFACanvas();
dfaCanvas.setBackground(Color.WHITE);
dfaCanvas.setPreferredSize(new Dimension(900, 1400));
JScrollPane scrollPane = new JScrollPane(dfaCanvas);
add(scrollPane, BorderLayout.CENTER);
}
代码示例来源:origin: org.netbeans.api/org-openide-dialogs
@Override
public void run() {
list.ensureIndexIsVisible(index);
// Fix of #10787.
// This is workaround for swing bug - BasicListUI doesn't ask for preferred
// size of rendered list cell as a result of property selectedIndex change.
// It does only on certain JList property changes (e.g. fixedCellWidth).
// Maybe subclassing BasicListUI could be better fix.
list.setFixedCellWidth(0);
list.setFixedCellWidth(-1);
}
}
代码示例来源:origin: stackoverflow.com
imageList.setVisibleRowCount(-1);
imageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
imageList.setFixedCellWidth(240);
imageList.setFixedCellHeight(120);
代码示例来源:origin: stackoverflow.com
list.setFixedCellWidth(80);
list.setFixedCellHeight(80);
list.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
代码示例来源:origin: cmu-phil/tetrad
private JComponent createPredictorVarListbox() {
predictorVarListbox = new JList(new DefaultListModel());
predictorVarListbox.setVisibleRowCount(4);
predictorVarListbox.setFixedCellWidth(100);
predictorVarListbox.setSelectionMode(
ListSelectionModel.SINGLE_SELECTION);
predictorVarListbox.setSelectedIndex(0);
return new JScrollPane(predictorVarListbox);
}
代码示例来源:origin: cmu-phil/tetrad
private JComponent createPredictorVarListbox() {
predictorVarListbox = new JList(new DefaultListModel());
predictorVarListbox.setVisibleRowCount(4);
predictorVarListbox.setFixedCellWidth(100);
predictorVarListbox.setSelectionMode(
ListSelectionModel.SINGLE_SELECTION);
predictorVarListbox.setSelectedIndex(0);
//JLabel listboxTitle = new JLabel(" Variables");
//scrollPane.setColumnHeaderView(listboxTitle);
//listboxTitle.setBackground(Color.DARK_GRAY);
return new JScrollPane(predictorVarListbox);
}
代码示例来源:origin: cmu-phil/tetrad
private JComponent createVarListbox() {
availableVarsList = new JList(new DefaultListModel());
DefaultListModel varsModel =
(DefaultListModel) availableVarsList.getModel();
for (String varName : varNames) {
varsModel.addElement(varName);
}
availableVarsList.setVisibleRowCount(5);
availableVarsList.setFixedCellWidth(100);
availableVarsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
availableVarsList.setSelectedIndex(0);
return new JScrollPane(availableVarsList);
}
代码示例来源:origin: cmu-phil/tetrad
private JComponent createVarListbox() {
//varsList = new Vector(varNames);
//availableVarsList = new JList(varsList); ORIG
availableVarsList = new JList(new DefaultListModel());
DefaultListModel varsModel =
(DefaultListModel) availableVarsList.getModel();
for (Object varName : varNames) {
varsModel.addElement(varName);
}
//availableVarsList.setModel(new DefaultListModel());
availableVarsList.setVisibleRowCount(5);
availableVarsList.setFixedCellWidth(100);
availableVarsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
availableVarsList.setSelectedIndex(0);
//JLabel listboxTitle = new JLabel(" Variables");
//scrollPane.setColumnHeaderView(listboxTitle);
//listboxTitle.setBackground(Color.DARK_GRAY);
return new JScrollPane(availableVarsList);
}
代码示例来源:origin: stackoverflow.com
JList jlist = new JList(model);
jlist.setVisibleRowCount(10);
jlist.setFixedCellHeight(15);
jlist.setFixedCellWidth(100);
代码示例来源:origin: net.sourceforge.pmd/pmd-core
private JComponent createXPathResultPanel() {
xpathResults.addElement("No XPath results yet, run an XPath Query first.");
xpathResultList.setBorder(BorderFactory.createLineBorder(Color.black));
xpathResultList.setFixedCellWidth(300);
xpathResultList.setCellRenderer(new ASTListCellRenderer());
xpathResultList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
xpathResultList.getSelectionModel().addListSelectionListener(new ASTSelectionListener());
JScrollPane scrollPane = new JScrollPane();
scrollPane.getViewport().setView(xpathResultList);
return scrollPane;
}
代码示例来源:origin: Refinitiv/Elektron-SDK
public NewsHeadlineViewer(NewsStoryViewer storyViewer, Font font, NewsHandler MPHandler)
{
_filterSelector = new NewsFilterSelector(this);
_headlinesList = new Vector<Headline>();
_headlineModel = new DefaultListModel<Headline>();
_headlines = new JList<Headline>(_headlineModel);
_headlines.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
_headlines.setFont(font);
_headlines.setFixedCellWidth(700);
_headlines.addMouseListener(new NewsHeadlineListener(storyViewer, MPHandler));
_scroll = new JScrollPane(_headlines);
_scroll.setAutoscrolls(true);
}
代码示例来源:origin: sing-group/GC4S
private void init() throws InvalidClassException {
unselectedListModel = new ExtendedDefaultListModel<E>();
unselectedListModel.addElements(unselected);
JList<E> unselectedList = new JList<>(unselectedListModel);
unselectedList.setFixedCellWidth(200);
selectedListModel = new ExtendedDefaultListModel<E>();
selectedListModel.addElements(selected);
JList<E> selectedList = new JList<>(selectedListModel);
selectedList.setFixedCellWidth(200);
JParallelListsPanel<E> parallelLists = new JParallelListsPanel<>(
unselectedList, selectedList, unselectedItemsTitle,
selectedItemsTitle, false, false
);
this.inputComponents.setBorder(createEmptyBorder(5, 5, 5, 5));
this.inputComponents.add(parallelLists, BorderLayout.CENTER);
}
代码示例来源:origin: senbox-org/snap-desktop
private JComponent createPanel() {
final JPanel contentPane = new JPanel(new GridBagLayout());
final GridBagConstraints gbc = DialogUtils.createGridBagConstraints();
gbc.gridy++;
DialogUtils.addComponent(contentPane, gbc, "Land Cover Model:", landCoverNamesList);
gbc.gridy++;
externalFileList.setFixedCellWidth(500);
DialogUtils.addInnerPanel(contentPane, gbc, new JLabel("External Files"), externalFileList, externalFileBrowseButton);
gbc.gridy++;
DialogUtils.addComponent(contentPane, gbc, "Resampling Method:", resamplingMethodCombo);
gbc.gridy++;
gbc.gridx = 1;
contentPane.add(new JLabel("Integer data types will use nearest neighbour"), gbc);
DialogUtils.fillPanel(contentPane, gbc);
return contentPane;
}
代码示例来源:origin: stackoverflow.com
listaCopia.setFixedCellWidth(100);
listaCopia.setFixedCellHeight(15);
add(new JScrollPane(listaCopia));
代码示例来源:origin: stackoverflow.com
@Override
protected ComboPopup createPopup() {
return new BasicComboPopup(comboBox) {
@Override
protected JList createList() {
JList list = super.createList();
Object prototypeValue = comboBox.getPrototypeDisplayValue();
if (prototypeValue != null) {
ListCellRenderer renderer = comboBox.getRenderer();
Component rendererComponent = renderer
.getListCellRendererComponent(list, prototypeValue, 0, false, false);
if (rendererComponent instanceof JLabel) {
// Preferred size of the renderer itself is (-1,-1) at this point,
// so we need this hack
Dimension prototypeSize = new JLabel(((JLabel) rendererComponent)
.getText()).getPreferredSize();
list.setFixedCellHeight(prototypeSize.height);
list.setFixedCellWidth(prototypeSize.width);
}
}
return list;
}
};
}
代码示例来源:origin: net.sourceforge.pmd/pmd-core
public DFAPanel() {
super();
setLayout(new BorderLayout());
JPanel leftPanel = new JPanel();
nodeList = new JList(nodes);
nodeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
nodeList.setFixedCellWidth(150);
nodeList.setBorder(BorderFactory.createLineBorder(Color.black));
nodeList.addListSelectionListener(this);
leftPanel.add(nodeList);
add(leftPanel, BorderLayout.WEST);
dfaCanvas = new DFACanvas();
dfaCanvas.setBackground(Color.WHITE);
dfaCanvas.setPreferredSize(new Dimension(900, 1400));
JScrollPane scrollPane = new JScrollPane(dfaCanvas);
add(scrollPane, BorderLayout.CENTER);
}
代码示例来源:origin: senbox-org/snap-desktop
paramList.setFixedCellWidth(200);
paramList.setMinimumSize(new Dimension(50, 4));
内容来源于网络,如有侵权,请联系作者删除!