本文整理汇总了Java中com.intellij.ui.components.JBScrollPane.setPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JBScrollPane.setPreferredSize方法的具体用法?Java JBScrollPane.setPreferredSize怎么用?Java JBScrollPane.setPreferredSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.components.JBScrollPane
的用法示例。
在下文中一共展示了JBScrollPane.setPreferredSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SettingsPanel
import com.intellij.ui.components.JBScrollPane; //导入方法依赖的package包/类
public SettingsPanel(final ArrayList<PluginSettings.SearchEngine> searchEngines) {
super();
setLayout(new BorderLayout());
// title
add(titleLabel, BorderLayout.PAGE_START);
// search engines
searchEnginePanel.setLayout(new BoxLayout(searchEnginePanel, BoxLayout.Y_AXIS));
addSearchEngines(searchEngines);
JBScrollPane sp = new JBScrollPane(searchEnginePanel);
sp.setPreferredSize(new Dimension(512, 32));
add(sp, BorderLayout.CENTER);
// add search engine button
addSearchEngineButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
addSearchEngineEntry(null);
}
});
add(addSearchEngineButton, BorderLayout.PAGE_END);
this.revalidate();
}
示例2: createUIComponents
import com.intellij.ui.components.JBScrollPane; //导入方法依赖的package包/类
private void createUIComponents() {
contexts = new JBTable(new ModuleTableModel());
contexts.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
contexts.setDefaultRenderer(String.class, new ModuleCellRenderer());
contexts.getColumnModel().getColumn(0).setPreferredWidth(25);
tableScrollPane = new JBScrollPane();
tableScrollPane.setViewportView(contexts);
tableScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
tableScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
tableScrollPane.setPreferredSize(new Dimension(400, 100));
tableScrollPane.setSize(new Dimension(400, 100));
}
示例3: ErrorDialog
import com.intellij.ui.components.JBScrollPane; //导入方法依赖的package包/类
public ErrorDialog(String message, String detail) {
super(JOptionPane.getRootFrame(), "Error", true);
JButton ok = new JButton("OK");
ok.addActionListener(this);
JPanel buttons = new JPanel(new FlowLayout(FlowLayout.CENTER));
buttons.add(ok);
JTextPane detailPane = new JTextPane();
detailPane.setText(detail);
final JBScrollPane pane = new JBScrollPane(detailPane);
pane.setPreferredSize(new Dimension(600, 300));
getContentPane().add(buttons, BorderLayout.SOUTH);
final JPanel content = new JPanel();
content.add(new JLabel(IconLoader.getIcon("/general/errorDialog.png")));
content.add(new JLabel(message));
final LinkLabel showMoreLink = new LinkLabel("(show details)", null);
LinkListener showMoreListener = new LinkListener() {
public void linkSelected(LinkLabel aSource, Object aLinkData) {
content.remove(showMoreLink);
getContentPane().add(pane, BorderLayout.CENTER);
setResizable(true);
pack();
}
};
showMoreLink.setListener(showMoreListener, null);
content.add(showMoreLink);
getContentPane().add(content, BorderLayout.NORTH);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
pack();
setResizable(false);
setLocationRelativeTo(getOwner());
}
示例4: createCenterPanel
import com.intellij.ui.components.JBScrollPane; //导入方法依赖的package包/类
@Override
protected JComponent createCenterPanel() {
final JBScrollPane pane = new JBScrollPane(myCheckBoxList);
pane.setPreferredSize(new Dimension(500, 200));
return pane;
}
示例5: RepositoryPanel
import com.intellij.ui.components.JBScrollPane; //导入方法依赖的package包/类
RepositoryPanel() {
projectRootNode = new DefaultMutableTreeNode("root");
treeModel = new DefaultTreeModel(projectRootNode);
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
repositoryTree = new Tree(treeModel);
repositoryTree.setRowHeight(0);
repositoryTree.setRootVisible(false);
repositoryTree.setOpaque(false);
repositoryTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
repositoryTree.expandRow(0);
RepositorySelectorRenderer renderer = new RepositorySelectorRenderer();
renderer.setOpenIcon(GoogleCloudToolsIcons.CLOUD);
renderer.setClosedIcon(GoogleCloudToolsIcons.CLOUD);
renderer.setLeafIcon(null);
repositoryTree.setCellRenderer(renderer);
repositoryTree.addTreeSelectionListener(
event -> {
DefaultMutableTreeNode node =
(DefaultMutableTreeNode) repositoryTree.getLastSelectedPathComponent();
if (node != null && node instanceof RepositoryModelItem) {
RepositoryModelItem repoNode = (RepositoryModelItem) node;
RepositorySelector.this.setText(repoNode.getRepositoryId());
ApplicationManager.getApplication().invokeLater(RepositorySelector.this::hidePopup);
}
});
JBScrollPane scrollPane = new JBScrollPane();
scrollPane.setPreferredSize(new Dimension(getPopupWidth(), getPreferredPopupHeight()));
scrollPane.setViewportView(repositoryTree);
scrollPane.setBorder(BorderFactory.createEmptyBorder());
add(scrollPane);
JPanel bottomPane = new JPanel();
JPanel buttonPanel = new JPanel();
bottomPane.setLayout(new BorderLayout());
bottomPane.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, JBColor.LIGHT_GRAY));
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
if (canCreateRepository) {
JButton newRepositoryButton = new JButton();
newRepositoryButton.setText(GctBundle.message("cloud.repository.selector.create.button"));
newRepositoryButton.addActionListener(
event -> {
try {
Desktop.getDesktop()
.browse(URI.create(PANETHEON_CREATE_REPO_URL_PREFIX + cloudProject));
} catch (IOException e) {
logger.error(GctBundle.message("cloud.repository.selector.create.url.error"));
}
});
buttonPanel.add(newRepositoryButton);
}
JButton refreshButton = new JButton();
refreshButton.setIcon(GoogleCloudToolsIcons.REFRESH);
refreshButton.addActionListener(event -> refresh());
buttonPanel.add(Box.createHorizontalGlue());
buttonPanel.add(refreshButton);
bottomPane.add(buttonPanel, BorderLayout.PAGE_END);
add(bottomPane);
refresh();
}
示例6: createPane
import com.intellij.ui.components.JBScrollPane; //导入方法依赖的package包/类
private JBScrollPane createPane(Component component) {
JBScrollPane pane = new JBScrollPane(component);
pane.setPreferredSize(new Dimension(600, 30));
pane.setMinimumSize(new Dimension(300, 30));
return pane;
}