本文整理汇总了Java中com.intellij.util.ui.JBUI.insets方法的典型用法代码示例。如果您正苦于以下问题:Java JBUI.insets方法的具体用法?Java JBUI.insets怎么用?Java JBUI.insets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.ui.JBUI
的用法示例。
在下文中一共展示了JBUI.insets方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCenterPanel
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel root = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.weightx = 2.0;
constraints.weighty = 0.0;
constraints.anchor = GridBagConstraints.NORTHWEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.gridwidth = GridBagConstraints.REMAINDER;
GridBagConstraints labelConstraint = new GridBagConstraints();
labelConstraint.anchor = GridBagConstraints.EAST;
labelConstraint.insets = JBUI.insets(5, 10);
GridBagConstraints txtConstraint = new GridBagConstraints();
txtConstraint.weightx = 2.0;
txtConstraint.fill = GridBagConstraints.HORIZONTAL;
txtConstraint.gridwidth = GridBagConstraints.REMAINDER;
Label lblVersion = new Label("Fixed in Version");
cmbVersions = new ComboBox<>();
for(MantisVersion version : new MantisSoapAPI(ConnectionSettings.getInstance(project)).getVersions(ConnectionSettings.getInstance(project).getProjectID())) {
cmbVersions.addItem(version.getName());
}
cmbVersions.addItem("");
cmbVersions.setSelectedItem("");
JPanel basicsPanel = new JPanel(new GridBagLayout());
basicsPanel.add(lblVersion, labelConstraint);
basicsPanel.add(cmbVersions, txtConstraint);
root.add(basicsPanel);
return root;
}
示例2: createCenterPanel
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel panel = new JPanel(new GridBagLayout());
Insets insets = JBUI.insets(0, 5, 5, 5);
GridBagConstraints gbc = new GridBagConstraints(0, 1, 2, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insets, 0, 0);
panel.add(textfield, gbc);
textfield.setPreferredSize(new Dimension(350, textfield.getPreferredSize().height));
return panel;
}
示例3: paintComponent
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Override
protected void paintComponent(final Graphics g) {
final Rectangle bounds = getBounds();
final Insets insets = JBUI.insets(getInsets());
if (myIcon != null) {
final int iconWidth = myIcon.getIconWidth();
final int iconHeight = myIcon.getIconHeight();
myIcon.paintIcon(this, g, insets.left + (bounds.width - insets.left - insets.right - iconWidth) / 2,
insets.top + (bounds.height - insets.top - insets.bottom - iconHeight) / 2);
}
}
示例4: layoutEditor
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Override
protected void layoutEditor(@NotNull JComponent editor) {
int w = spinner.getWidth();
int h = spinner.getHeight();
JBInsets insets = JBUI.insets(spinner.getInsets());
editor.setBounds(insets.left + 5, insets.top + 5, w - 5 - 26 - insets.width(), h - insets.height() - 10);
}
示例5: getBorderInsets
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Override
public Insets getBorderInsets(Component c) {
if (c.getParent() instanceof ActionToolbar) {
return JBUI.insets(4, 16, 4, 16);
}
if (DarculaButtonUI.isSquare(c)) {
return JBUI.insets(2, 0, 2, 0).asUIResource();
}
return JBUI.insets(8, 16, 8, 14).asUIResource();
}
示例6: getWrapperPanelInsets
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Override
public Insets getWrapperPanelInsets(Insets insets) {
final JBInsets result = JBUI.insets(insets);
if (shouldPaintWrapperPanel()) {
result.top += JBUI.scale(1);
}
return result;
}
示例7: CustomCreateFileFromTemplateDialog
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
protected CustomCreateFileFromTemplateDialog(@NotNull Project project) {
super(project, true);
myPanel = new JPanel();
myNameLabel = new JLabel("Name:");
myNameField = new JTextField("");
myUpDownHint = new JLabel();
myKindLabel = new JLabel("Kind:");
myKindCombo = new TemplateKindCombo();
myPanel.setLayout(new GridBagLayout());
myPanel.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
// c.gridwidth = 1;
c.weightx = 0.3;
c.gridx = 0;
c.gridy = 0;
myPanel.add(myNameLabel, c);
c.weightx = 4;
c.gridx = 1;
c.gridy = 0;
myPanel.add(myNameField, c);
c.weightx = 0.3;
c.gridx = 2;
c.gridy = 0;
c.insets = JBUI.insetsLeft(12);
myPanel.add(myUpDownHint, c);
c.insets = JBUI.insets(10, 0);
c.gridx = 0;
c.gridy = 1;
myPanel.add(myKindLabel, c);
c.gridx = 1;
c.gridwidth = 2;
c.gridy = 1;
c.insets = JBUI.insets(10, 0, 10, 12);
myPanel.add(myKindCombo, c);
myKindLabel.setLabelFor(myKindCombo);
myKindCombo.registerUpDownHint(myNameField);
myUpDownHint.setIcon(PlatformIcons.UP_DOWN_ARROWS);
setTemplateKindComponentsVisible(false);
init();
myKindCombo.getComboBox().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
for (GravConfigurationFileType each : GravFileTypes.CONFIGURATION_FILE_TYPES) {
if (getKindCombo().getSelectedName().equalsIgnoreCase(each.getCorrespondingTemplateFile())) {
disableEnableFields(each.needsFilename());
if (!each.needsFilename()) {
getNameField().setText(each.getDefaultFilename());
} else {
getNameField().setText("");
}
}
}
}
});
}
示例8: createCenterPanel
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel root = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.anchor = GridBagConstraints.NORTHWEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.weightx = 2.0;
constraints.weighty = 0.0;
constraints.gridwidth = GridBagConstraints.REMAINDER;
GridBagConstraints labelConstraint = new GridBagConstraints();
labelConstraint.anchor = GridBagConstraints.EAST;
labelConstraint.insets = JBUI.insets(5, 10);
GridBagConstraints txtConstraint = new GridBagConstraints();
txtConstraint.weightx = 2.0;
txtConstraint.fill = GridBagConstraints.HORIZONTAL;
txtConstraint.gridwidth = GridBagConstraints.REMAINDER;
txtFixed = new JBTextField();
txtFixed.setName("txtSummary");
txtFixed.setPreferredSize(new Dimension(150, 200));
cmbState = new ComboBox<>();
cmbState.setName("cmbState");
for(ObjectRef item : new MantisSoapAPI(ConnectionSettings.getInstance(project)).getEnum("view_states")) {
cmbState.addItem(item.getName());
}
java.awt.Label lblFixed = new java.awt.Label("Check In");
java.awt.Label lblState = new java.awt.Label("Status");
JPanel basicsPanel = new JPanel(new GridBagLayout());
basicsPanel.add(lblFixed, labelConstraint);
basicsPanel.add(txtFixed, txtConstraint);
basicsPanel.add(lblState, labelConstraint);
basicsPanel.add(cmbState, txtConstraint);
root.add(basicsPanel);
return root;
}
示例9: createCenterPanel
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel root = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.weightx = 2.0;
constraints.weighty = 0.0;
constraints.anchor = GridBagConstraints.NORTHWEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.gridwidth = GridBagConstraints.REMAINDER;
GridBagConstraints labelConstraint = new GridBagConstraints();
labelConstraint.anchor = GridBagConstraints.EAST;
labelConstraint.insets = JBUI.insets(5, 10);
GridBagConstraints txtConstraint = new GridBagConstraints();
txtConstraint.weightx = 2.0;
txtConstraint.fill = GridBagConstraints.HORIZONTAL;
txtConstraint.gridwidth = GridBagConstraints.REMAINDER;
txtName = new JBTextField();
txtName.setName("txtName");
txtName.setPreferredSize(new Dimension(150, 25));
txtDateOrder = new JBTextField();
txtDateOrder.setText(new SimpleDateFormat("dd-MM-yyyy hh:mm").format(new Date()));
txtDateOrder.setName("txtDateOrder");
txtDateOrder.setPreferredSize(new Dimension(150, 25));
txtDescription = new JTextArea();
txtDescription.setName("txtDescription");
txtDescription.setPreferredSize(new Dimension(150, 100));
chkReleased = new JCheckBox("Released");
chkReleased.setName("chkReleased");
chkObsolete = new JCheckBox("Obsolete");
chkObsolete.setName("chkObsolete");
cmdDelete = new JButton("Delete");
cmdDelete.setName("cmdDelete");
cmdDelete.addActionListener(e -> {
api.deleteVersion(version.getId());
if(this.getButton(this.getOKAction())!=null)
this.getButton(this.getOKAction()).doClick();
});
java.awt.Label lblName = new java.awt.Label("Name");
java.awt.Label lblDateOrder = new java.awt.Label("Date");
java.awt.Label lblDescription = new java.awt.Label("Description");
JPanel basicsPanel = new JPanel(new GridBagLayout());
basicsPanel.add(lblName, labelConstraint);
basicsPanel.add(txtName, txtConstraint);
basicsPanel.add(lblDateOrder, labelConstraint);
basicsPanel.add(txtDateOrder, txtConstraint);
basicsPanel.add(lblDescription, labelConstraint);
basicsPanel.add(txtDescription, txtConstraint);
basicsPanel.add(chkReleased, labelConstraint);
basicsPanel.add(chkObsolete, txtConstraint);
basicsPanel.add(cmdDelete);
root.add(basicsPanel);
return root;
}
示例10: createCenterPanel
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Nullable
@Override
protected JComponent createCenterPanel() {
JPanel root = new JPanel(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.anchor = GridBagConstraints.NORTHWEST;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.weightx = 2.0;
constraints.weighty = 0.0;
constraints.gridwidth = GridBagConstraints.REMAINDER;
GridBagConstraints labelConstraint = new GridBagConstraints();
labelConstraint.anchor = GridBagConstraints.EAST;
labelConstraint.insets = JBUI.insets(5, 10);
GridBagConstraints txtConstraint = new GridBagConstraints();
txtConstraint.weightx = 2.0;
txtConstraint.fill = GridBagConstraints.HORIZONTAL;
txtConstraint.gridwidth = GridBagConstraints.REMAINDER;
txtPlatform = new JBTextField();
txtPlatform.setName("txtPlatform");
txtPlatform.setPreferredSize(new Dimension(200, 50));
txtOS = new JBTextField();
txtOS.setName("txtOS");
txtOS.setPreferredSize(new Dimension(200, 50));
txtBuild = new JBTextField();
txtBuild.setName("txtBuild");
txtBuild.setPreferredSize(new Dimension(200, 50));
java.awt.Label lblPlatform = new java.awt.Label("Platform");
java.awt.Label lblOS = new java.awt.Label("OS");
java.awt.Label lblBuild = new java.awt.Label("Build");
JPanel basicsPanel = new JPanel(new GridBagLayout());
basicsPanel.add(lblPlatform, labelConstraint);
basicsPanel.add(txtPlatform, txtConstraint);
basicsPanel.add(lblOS, labelConstraint);
basicsPanel.add(txtOS, txtConstraint);
basicsPanel.add(lblBuild, labelConstraint);
basicsPanel.add(txtBuild, txtConstraint);
root.add(basicsPanel);
return root;
}
示例11: FlatWelcomeFrame
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
public FlatWelcomeFrame() {
final JRootPane rootPane = getRootPane();
myScreen = new FlatWelcomeScreen();
final IdeGlassPaneImpl glassPane = new IdeGlassPaneImpl(rootPane) {
@Override
public void addNotify() {
super.addNotify();
rootPane.remove(getProxyComponent());
//noinspection SSBasedInspection
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JBProtocolCommand.handleCurrentCommand();
}
});
}
};
setGlassPane(glassPane);
glassPane.setVisible(false);
//setUndecorated(true);
setContentPane(myScreen.getWelcomePanel());
setTitle("Welcome to " + ApplicationNamesInfo.getInstance().getFullProductName());
AppUIUtil.updateWindowIcon(this);
final int width = RecentProjectsManager.getInstance().getRecentProjectsActions(false).length == 0 ? 666 : 777;
setSize(JBUI.size(width, 460));
setResizable(false);
//int x = bounds.x + (bounds.width - getWidth()) / 2;
//int y = bounds.y + (bounds.height - getHeight()) / 2;
Point location = DimensionService.getInstance().getLocation(WelcomeFrame.DIMENSION_KEY, null);
Rectangle screenBounds = ScreenUtil.getScreenRectangle(location != null ? location : new Point(0, 0));
setLocation(new Point(
screenBounds.x + (screenBounds.width - getWidth()) / 2,
screenBounds.y + (screenBounds.height - getHeight()) / 3
));
//setLocation(x, y);
ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
@Override
public void projectOpened(Project project) {
dispose();
}
});
myBalloonLayout = new BalloonLayoutImpl(rootPane, JBUI.insets(8));
WelcomeFrame.setupCloseAction(this);
MnemonicHelper.init(this);
Disposer.register(ApplicationManager.getApplication(), new Disposable() {
@Override
public void dispose() {
FlatWelcomeFrame.this.dispose();
}
});
}
示例12: setIconInsets
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
public void setIconInsets(@Nullable Insets insets) {
myInsets = insets != null ? JBUI.insets(insets) : new Insets(0,0,0,0);
}
示例13: MacRadioButtonBorder
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
public MacRadioButtonBorder() {
super(JBUI.insets(0, 7));
}
示例14: MacCheckBoxBorder
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
public MacCheckBoxBorder() {
super(JBUI.insets(0, 7));
}
示例15: createNorthPanel
import com.intellij.util.ui.JBUI; //导入方法依赖的package包/类
@Override
protected JComponent createNorthPanel() {
final List<NamedScope> scopeList = new ArrayList<NamedScope>();
final Project project = myManager.getProject();
final NamedScopesHolder[] scopeHolders = NamedScopeManager.getAllNamedScopeHolders(project);
for (final NamedScopesHolder scopeHolder : scopeHolders) {
final NamedScope[] scopes = scopeHolder.getScopes();
Collections.addAll(scopeList, scopes);
}
CustomScopesProviderEx.filterNoSettingsScopes(project, scopeList);
for (final NamedScope scope : scopeList) {
myScopeNames.put(scope.getName(), scope);
}
myScopeComboBox = new JComboBox(ArrayUtil.toStringArray(myScopeNames.keySet()));
myScopeComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateCustomButton();
updateOKButton();
}
});
final JLabel pathLabel = new JLabel("Scope:");
pathLabel.setDisplayedMnemonic('S');
pathLabel.setLabelFor(myScopeComboBox);
final JLabel colorLabel = new JLabel("Color:");
JPanel result = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = JBUI.insets(5);
gbc.gridx = 0;
result.add(pathLabel, gbc);
result.add(colorLabel, gbc);
gbc.gridx = 1;
gbc.weightx = 1;
result.add(myScopeComboBox, gbc);
result.add(myColorSelectionComponent, gbc);
return result;
}