use of com.android.tools.adtui.common.RotatedLabel in project android by JetBrains.
the class BaseSegment method initializeComponents.
public void initializeComponents() {
setLayout(new BorderLayout());
FontMetrics metrics = getFontMetrics(AdtUiUtils.DEFAULT_FONT);
mLabelPanel = createSpacerPanel(metrics.getHeight() + LABEL_BORDER_WIDTH);
mLabelPanel.setBorder(LABEL_BORDER);
mLabel = new RotatedLabel();
mLabel.setFont(AdtUiUtils.DEFAULT_FONT);
mLabel.setText(myName);
mLabel.setBorder(SEGMENT_BORDER);
mLabelPanel.add(mLabel);
this.add(mLabelPanel, BorderLayout.WEST);
JBPanel panels = new JBPanel();
panels.setBorder(SEGMENT_BORDER);
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
panels.setLayout(new GridBagLayout());
gbc.weightx = 0;
gbc.weighty = 0;
//Setup the left panel
if (hasLeftContent()) {
mLeftPanel = createSpacerPanel(getSpacerWidth());
gbc.gridx = 0;
gbc.gridy = 1;
panels.add(mLeftPanel, gbc);
setLeftContent(mLeftPanel);
}
//Setup the top center panel.
JBPanel topPanel = new JBPanel();
topPanel.setLayout(new BorderLayout());
gbc.gridx = 1;
gbc.gridy = 0;
panels.add(topPanel, gbc);
setTopCenterContent(topPanel);
//Setup the right panel
if (hasRightContent()) {
mRightPanel = createSpacerPanel(getSpacerWidth());
gbc.gridx = 2;
gbc.gridy = 1;
panels.add(mRightPanel, gbc);
setRightContent(mRightPanel);
}
//Setup the center panel, the primary component.
//This component should consume all available space.
JBPanel centerPanel = new JBPanel();
centerPanel.setLayout(new BorderLayout());
gbc.weightx = 1;
gbc.weighty = 1;
gbc.gridx = 1;
gbc.gridy = 1;
panels.add(centerPanel, gbc);
setCenterContent(centerPanel);
add(panels, BorderLayout.CENTER);
// By default, starts in L1, this gives the Segment a chance to hide the right spacer panel and determine what it should rendered.
toggleView(false);
}
Aggregations