/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-import javax.swing.border.EmptyBorder;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
ActionLink registerLink = new ActionLink("Register", register);
registerLink.setNormalColor(getLinkNormalColor());
NonOpaquePanel button = new NonOpaquePanel(new BorderLayout());
- button.setBorder(IdeBorderFactory.createEmptyBorder(4, 10, 4, 10));
+ button.setBorder(JBUI.Borders.empty(4, 10, 4, 10));
button.add(registerLink);
installFocusable(button, register, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, true);
NonOpaquePanel wrap = new NonOpaquePanel();
- wrap.setBorder(IdeBorderFactory.createEmptyBorder(0, 10, 0, 0));
+ wrap.setBorder(JBUI.Borders.empty(0, 10, 0, 0));
wrap.add(button);
panel.add(wrap, BorderLayout.WEST);
registeredVisible = true;
panel.add(toolbar, BorderLayout.EAST);
- panel.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 8, 11));
+ panel.setBorder(JBUI.Borders.empty(0, 0, 8, 11));
return panel;
}
ref.get().setPaintUnderline(false);
ref.get().setNormalColor(getLinkNormalColor());
NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout());
- panel.setBorder(IdeBorderFactory.createEmptyBorder(4, 6, 4, 6));
+ panel.setBorder(JBUI.Borders.empty(4, 6, 4, 6));
panel.add(ref.get());
panel.add(createArrow(ref.get()), BorderLayout.EAST);
installFocusable(panel, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, focusListOnLeft);
private JComponent createActionPanel() {
JPanel actions = new NonOpaquePanel();
- actions.setBorder(IdeBorderFactory.createEmptyBorder(0, 10, 0, 0));
+ actions.setBorder(JBUI.Borders.empty(0, 10, 0, 0));
actions.setLayout(new BoxLayout(actions, BoxLayout.Y_AXIS));
ActionManager actionManager = ActionManager.getInstance();
ActionGroup quickStart = (ActionGroup)actionManager.getAction(IdeActions.GROUP_WELCOME_SCREEN_QUICKSTART);
for (AnAction action : group.getChildren(null)) {
JPanel button = new JPanel(new BorderLayout());
button.setOpaque(false);
- button.setBorder(IdeBorderFactory.createEmptyBorder(8, 20, 8, 20));
+ button.setBorder(JBUI.Borders.empty(8, 20, 8, 20));
Presentation presentation = action.getTemplatePresentation();
action.update(new AnActionEvent(null, DataManager.getInstance().getDataContext(this),
ActionPlaces.WELCOME_SCREEN, presentation, ActionManager.getInstance(), 0));
NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout());
ApplicationInfoEx app = ApplicationInfoEx.getInstanceEx();
JLabel logo = new JLabel(IconLoader.getIcon(app.getWelcomeScreenLogoUrl()));
- logo.setBorder(new EmptyBorder(30,0,10,0));
+ logo.setBorder(JBUI.Borders.empty(30,0,10,0));
logo.setHorizontalAlignment(SwingConstants.CENTER);
panel.add(logo, BorderLayout.NORTH);
JLabel appName = new JLabel(ApplicationNamesInfo.getInstance().getFullProductName());
Map<Icon, Icon> scaled = new HashMap<Icon, Icon>();
{
- label.setBorder(new EmptyBorder(new Insets(3, 7, 3, 7)));
+ label.setBorder(JBUI.Borders.empty(3, 7, 3, 7));
}
@NotNull
actionsListPanel.add(pane, BorderLayout.CENTER);
if (backAction != null) {
final JLabel back = new JLabel(AllIcons.Actions.Back);
- back.setBorder(new EmptyBorder(new Insets(3, 7, 10, 7)));
+ back.setBorder(JBUI.Borders.empty(3, 7, 10, 7));
back.setHorizontalAlignment(SwingConstants.LEFT);
new ClickListener() {
@Override
Object value = list.getSelectedValue();
if (value instanceof AbstractActionWithPanel) {
JPanel panel = ((AbstractActionWithPanel)value).createPanel();
- panel.setBorder(new EmptyBorder(7, 10, 7, 10));
+ panel.setBorder(JBUI.Borders.empty(7, 10, 7, 10));
selected.set(panel);
main.add(selected.get());
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import com.intellij.openapi.wm.WelcomeScreen;
import com.intellij.ui.components.JBList;
import com.intellij.ui.speedSearch.ListWithFilter;
+import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nullable;
JScrollPane scrollPane = UIUtil.findComponentOfType(this, JScrollPane.class);
if (scrollPane != null) {
scrollPane.setBackground(FlatWelcomeFrame.getProjectsBackground());
- scrollPane.setSize(245, 460);
- scrollPane.setMinimumSize(new Dimension(245, 460));
- scrollPane.setPreferredSize(new Dimension(245, 460));
+ scrollPane.setSize(JBUI.size(245, 460));
+ scrollPane.setMinimumSize(JBUI.size(245, 460));
+ scrollPane.setPreferredSize(JBUI.size(245, 460));
}
ListWithFilter panel = UIUtil.findComponentOfType(this, ListWithFilter.class);
if (panel != null) {
nameCell.weightx = 1.0;
nameCell.weighty = 1.0;
nameCell.anchor = GridBagConstraints.FIRST_LINE_START;
- nameCell.insets = new Insets(6, 5, 1, 5);
+ nameCell.insets = JBUI.insets(6, 5, 1, 5);
pathCell.gridx = 0;
pathCell.gridy = 1;
- pathCell.insets = new Insets(1, 5, 6, 5);
+ pathCell.insets = JBUI.insets(1, 5, 6, 5);
pathCell.anchor = GridBagConstraints.LAST_LINE_START;
closeButtonCell.gridx = 1;
closeButtonCell.gridy = 0;
closeButtonCell.anchor = GridBagConstraints.FIRST_LINE_END;
- closeButtonCell.insets = new Insets(7, 7, 7, 7);
+ closeButtonCell.insets = JBUI.insets(7, 7, 7, 7);
closeButtonCell.gridheight = 2;
//closeButtonCell.anchor = GridBagConstraints.WEST;
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import com.intellij.ui.speedSearch.ListWithFilter;
import com.intellij.util.Function;
import com.intellij.util.SystemProperties;
+import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
protected final UniqueNameBuilder<ReopenProjectAction> myPathShortener;
protected AnAction removeRecentProjectAction;
private int myHoverIndex = -1;
- private static final int closeButtonInset = 7;
+ private final int closeButtonInset = JBUI.scale(7);
private Icon currentIcon = AllIcons.Welcome.RemoveRecentProject;
private final JPanel myCloseButtonForEditor = new JPanel() {
}
protected Dimension getPreferredScrollableViewportSize() {
- return new Dimension(250, 400);
+ return JBUI.size(250, 400);
}
protected void addMouseMotionListener() {
JPanel title = new JPanel() {
@Override
public Dimension getPreferredSize() {
- return new Dimension(super.getPreferredSize().width, 28);
+ return new Dimension(super.getPreferredSize().width, JBUI.scale(28));
}
};
title.setBorder(new BottomLineBorder());
protected RecentProjectItemRenderer(UniqueNameBuilder<ReopenProjectAction> pathShortener) {
super(new VerticalFlowLayout());
myShortener = pathShortener;
- myPath.setFont(myPath.getFont().deriveFont(SystemInfo.isMac ? 10f : 11f));
+ myPath.setFont(JBUI.Fonts.label(SystemInfo.isMac ? 10f : 11f));
setFocusable(true);
layoutComponents();
}
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
- return new Dimension(Math.min(size.width, 245), size.height);
+ return new Dimension(Math.min(size.width, JBUI.scale(245)), size.height);
}
}
}