use of com.intellij.ui.components.JBScrollPane in project android by JetBrains.
the class DeepLinkChooserDialog method createCenterPanel.
@Nullable
@Override
protected JComponent createCenterPanel() {
JScrollPane scrollPane = new JBScrollPane(myList);
myList.setSelectedIndex(0);
new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent e) {
int index = myList.locationToIndex(e.getPoint());
if (index != -1 && myList.getModel().getElementAt(index) != null) {
myList.setSelectedIndex(index);
doOKAction();
}
return false;
}
}.installOn(myList);
return scrollPane;
}
use of com.intellij.ui.components.JBScrollPane in project azure-tools-for-java by Microsoft.
the class ActivityLogToolWindowFactory method createToolWindowContent.
@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
this.project = project;
table = new TableView<DeploymentTableItem>(new ListTableModel<DeploymentTableItem>(DESC, PROGRESS, STATUS, START_TIME));
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// add mouse listener for links in table
table.addMouseListener(createTableMouseListener());
toolWindow.getComponent().add(new JBScrollPane(table));
registerDeploymentListener();
}
use of com.intellij.ui.components.JBScrollPane in project android by JetBrains.
the class ThreadsSegment method setCenterContent.
@Override
protected void setCenterContent(@NotNull JPanel panel) {
JLayeredPane centerPane = new JBLayeredPane();
JScrollPane scrollPane = new JBScrollPane(mThreadsList);
centerPane.add(scrollPane);
centerPane.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
JLayeredPane host = (JLayeredPane) e.getComponent();
if (host != null) {
Dimension dim = host.getSize();
for (Component c : host.getComponents()) {
c.setBounds(0, 0, dim.width, dim.height);
}
}
}
});
panel.add(centerPane, BorderLayout.CENTER);
}
use of com.intellij.ui.components.JBScrollPane in project android by JetBrains.
the class NetworkCaptureSegment method setCenterContent.
@Override
protected void setCenterContent(@NotNull JPanel panel) {
myCaptureTable = createCaptureTable();
panel.add(new JBScrollPane(myCaptureTable), BorderLayout.CENTER);
}
use of com.intellij.ui.components.JBScrollPane in project android by JetBrains.
the class DeviceConfiguratorPanel method createUIComponents.
private void createUIComponents() {
myQualifierOptionsPanel = new JPanel(new CardLayout());
final JPanel leftPanel = new JPanel(new BorderLayout(JBUI.scale(5), JBUI.scale(5)));
myAvailableQualifiersList = new JBList();
myAvailableQualifiersList.setMinimumSize(JBUI.size(10, 10));
JBLabel label = new JBLabel(AndroidBundle.message("android.layout.preview.edit.configuration.available.qualifiers.label"));
label.setLabelFor(myAvailableQualifiersList);
leftPanel.add(label, BorderLayout.NORTH);
leftPanel.add(new JBScrollPane(myAvailableQualifiersList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER);
final JPanel rightPanel = new JPanel(new BorderLayout(JBUI.scale(5), JBUI.scale(5)));
myChosenQualifiersList = new JBList();
myChosenQualifiersList.setMinimumSize(JBUI.size(10, 10));
label = new JBLabel(AndroidBundle.message("android.layout.preview.edit.configuration.choosen.qualifiers.label"));
label.setLabelFor(myChosenQualifiersList);
rightPanel.add(label, BorderLayout.NORTH);
rightPanel.add(new JBScrollPane(myChosenQualifiersList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER);
final JPanel buttonsPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.MIDDLE, 0, 0, true, false));
myAddQualifierButton = new JButton(">>");
buttonsPanel.add(myAddQualifierButton);
myRemoveQualifierButton = new JButton("<<");
buttonsPanel.add(myRemoveQualifierButton);
final int gap = 5;
final JPanel listsPanel = new JPanel(new AbstractLayoutManager() {
@SuppressWarnings("NonPrivateFieldAccessedInSynchronizedContext")
@Override
public Dimension preferredLayoutSize(Container target) {
synchronized (target.getTreeLock()) {
final Dimension leftPref = leftPanel.getPreferredSize();
final Dimension rightPref = rightPanel.getPreferredSize();
final Dimension middlePref = buttonsPanel.getPreferredSize();
final Insets insets = target.getInsets();
final int width = leftPref.width + middlePref.width + rightPref.width + insets.left + insets.right + gap * 2;
final int height = Math.max(leftPref.height, Math.max(rightPref.height, middlePref.height)) + insets.top + insets.bottom;
return new Dimension(width, height);
}
}
@SuppressWarnings("NonPrivateFieldAccessedInSynchronizedContext")
@Override
public void layoutContainer(Container target) {
synchronized (target.getTreeLock()) {
final Insets insets = target.getInsets();
int top = insets.top;
int bottom = target.getHeight() - insets.bottom;
int left = insets.left;
int right = target.getWidth() - insets.right;
final int middleWidth = buttonsPanel.getPreferredSize().width + gap * 2;
final int listWidth = (right - left - middleWidth) / 2;
final int height = bottom - top;
leftPanel.setSize(listWidth, height);
rightPanel.setSize(listWidth, height);
buttonsPanel.setSize(middleWidth, height);
leftPanel.setBounds(left, top, listWidth, height);
rightPanel.setBounds(right - listWidth, top, listWidth, height);
buttonsPanel.setBounds(left + listWidth + gap, top, middleWidth - gap * 2, height);
}
}
});
listsPanel.add(leftPanel);
listsPanel.add(buttonsPanel);
listsPanel.add(rightPanel);
add(listsPanel, BorderLayout.CENTER);
add(myQualifierOptionsPanel, BorderLayout.EAST);
}
Aggregations