本文整理匯總了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;
}