本文整理汇总了Java中com.intellij.util.ui.JBInsets.removeFrom方法的典型用法代码示例。如果您正苦于以下问题:Java JBInsets.removeFrom方法的具体用法?Java JBInsets.removeFrom怎么用?Java JBInsets.removeFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.ui.JBInsets
的用法示例。
在下文中一共展示了JBInsets.removeFrom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paint
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public void paint(final Graphics g) {
Rectangle bounds = new Rectangle(getWidth(), getHeight());
JBInsets.removeFrom(bounds, getInsets());
bounds.x += (bounds.width - myIcon.getIconWidth()) / 2;
bounds.y += (bounds.height - myIcon.getIconHeight()) / 2;
if (myBehavior.isHovered()) {
// todo
}
if (myBehavior.isPressedByMouse()) {
bounds.x++;
bounds.y++;
}
myIcon.paintIcon(this, g, bounds.x, bounds.y);
}
示例2: layout
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
private String layout(AbstractButton b, FontMetrics fm,
int width, int height) {
viewRect.setBounds(0, 0, width, height);
JBInsets.removeFrom(viewRect, b.getInsets());
textRect.x = textRect.y = textRect.width = textRect.height = 0;
iconRect.x = iconRect.y = iconRect.width = iconRect.height = 0;
// layout the text and icon
return SwingUtilities.layoutCompoundLabel(
b, fm, b.getText(), b.getIcon(),
b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
viewRect, iconRect, textRect,
b.getText() == null ? 0 : b.getIconTextGap());
}
示例3: moveToFit
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
public static void moveToFit(final Rectangle rectangle, final Rectangle container, @Nullable Insets padding) {
Rectangle move = new Rectangle(rectangle);
JBInsets.addTo(move, padding);
if (move.getMaxX() > container.getMaxX()) {
move.x = (int)container.getMaxX() - move.width;
}
if (move.getMinX() < container.getMinX()) {
move.x = (int)container.getMinX();
}
if (move.getMaxY() > container.getMaxY()) {
move.y = (int)container.getMaxY() - move.height;
}
if (move.getMinY() < container.getMinY()) {
move.y = (int)container.getMinY();
}
JBInsets.removeFrom(move, padding);
rectangle.setBounds(move);
}
示例4: showFrame
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
public void showFrame() {
final IdeFrameImpl frame = new IdeFrameImpl(ApplicationInfoEx.getInstanceEx(),
myActionManager, myDataManager,
ApplicationManager.getApplication());
myProject2Frame.put(null, frame);
if (myFrameBounds == null || !ScreenUtil.isVisible(myFrameBounds)) { //avoid situations when IdeFrame is out of all screens
myFrameBounds = ScreenUtil.getMainScreenBounds();
int xOff = myFrameBounds.width / 8;
int yOff = myFrameBounds.height / 8;
JBInsets.removeFrom(myFrameBounds, new Insets(yOff, xOff, yOff, xOff));
}
fixForOracleBug8007219(frame);
frame.setBounds(myFrameBounds);
frame.setExtendedState(myFrameExtendedState);
frame.setVisible(true);
}
示例5: paintComponent
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
public void paintComponent(Graphics g) {
Icon icon = getIcon();
FontMetrics fm = getFontMetrics(getFont());
Rectangle viewRect = new Rectangle(getSize());
JBInsets.removeFrom(viewRect, getInsets());
Rectangle iconRect = new Rectangle();
Rectangle textRect = new Rectangle();
String text = SwingUtilities.layoutCompoundLabel(this, fm, getText(), icon,
SwingConstants.CENTER, horizontalTextAlignment(),
SwingConstants.CENTER, horizontalTextPosition(),
viewRect, iconRect, textRect, iconTextSpace());
ActionButtonLook look = ActionButtonLook.IDEA_LOOK;
look.paintBackground(g, this);
look.paintIconAt(g, this, icon, iconRect.x, iconRect.y);
look.paintBorder(g, this);
UISettings.setupAntialiasing(g);
g.setColor(isButtonEnabled() ? getForeground() : getInactiveTextColor());
SwingUtilities2.drawStringUnderlineCharAt(this, g, text,
getMnemonicCharIndex(text),
textRect.x,
textRect.y + fm.getAscent());
}
示例6: doLayout
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public void doLayout() {
synchronized (getTreeLock()) {
int count = getComponentCount();
if (count == 1) {
Rectangle bounds = new Rectangle(getWidth(), getHeight());
JBInsets.removeFrom(bounds, getInsets());
Component child = getComponent(0);
child.setBounds(bounds);
if (child instanceof CellRendererPanel) {
((CellRendererPanel)child).invalidateLayout();
child.doLayout();
}
}
else {
invalidateLayout();
super.doLayout();
for (int i = 0; i < count; i++) {
Component c = getComponent(i);
if (c instanceof CellRendererPanel) {
c.doLayout();
}
}
}
}
}
示例7: calculateCheckBoxIndent
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
private static int calculateCheckBoxIndent() {
JCheckBox checkBox = new JCheckBox();
Icon icon = checkBox.getIcon();
int indent = 0;
if (icon == null) {
icon = UIManager.getIcon("CheckBox.icon");
}
if (UIUtil.isUnderDarcula() || UIUtil.isUnderIntelliJLaF()) {
icon = EmptyIcon.create(20, 18);
}
if (icon != null) {
final Rectangle r1 = new Rectangle(checkBox.getWidth(), checkBox.getHeight());
JBInsets.removeFrom(r1, checkBox.getInsets());
final Rectangle iconRect = new Rectangle();
SwingUtilities.layoutCompoundLabel(
checkBox, checkBox.getFontMetrics(checkBox.getFont()), checkBox.getText(), icon,
checkBox.getVerticalAlignment(), checkBox.getHorizontalAlignment(),
checkBox.getVerticalTextPosition(), checkBox.getHorizontalTextPosition(),
r1, new Rectangle(), iconRect,
checkBox.getText() == null ? 0 : checkBox.getIconTextGap());
indent = iconRect.x;
}
return indent + checkBox.getIconTextGap();
}
示例8: relayout
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
private void relayout() {
final Dimension size = myLayeredPane.getSize();
JBInsets.removeFrom(size, myInsets);
final Rectangle layoutRec = new Rectangle(new Point(myInsets.left, myInsets.top), size);
List<ArrayList<Balloon>> columns = createColumns(layoutRec);
while (columns.size() > 1) {
remove(myBalloons.get(0), true);
columns = createColumns(layoutRec);
}
ToolWindowPanelImplEx pane = UIUtil.findComponentOfType2(myParent, ToolWindowPanelImplEx.class);
JComponent layeredPane = pane != null ? pane.getMyLayeredPane() : null;
int eachColumnX = (layeredPane == null ? myLayeredPane.getWidth() : layeredPane.getX() + layeredPane.getWidth()) - 4;
newLayout(columns.get(0), eachColumnX + 4, (int)myLayeredPane.getBounds().getMaxY());
}
示例9: doLayout
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public void doLayout() {
int count = getComponentCount();
if (count == 1) {
Rectangle bounds = new Rectangle(getWidth(), getHeight());
JBInsets.removeFrom(bounds, getInsets());
Component child = getComponent(0);
child.setBounds(bounds);
if (child instanceof CellRendererPanel) {
((CellRendererPanel)child).invalidateLayout();
child.doLayout();
}
}
else {
invalidateLayout();
super.doLayout();
for (int i = 0; i < count; i++) {
Component c = getComponent(i);
if (c instanceof CellRendererPanel) {
c.doLayout();
}
}
}
}
示例10: paint
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
void paint(Graphics2D g) {
Rectangle r = new Rectangle(getSize());
JBInsets.removeFrom(r, getInsets());
if (r.height % 2 == 1) r.height++;
int arcSize = JBUI.scale(26);
JBInsets.removeFrom(r, new JBInsets(1, 1, 1, 1));
if (myTextArea.hasFocus()) {
g.setColor(myTextArea.getBackground());
RectanglePainter.FILL.paint(g, r.x, r.y, r.width, r.height, arcSize);
DarculaUIUtil.paintSearchFocusRing(g, r, myTextArea, arcSize);
}
else {
arcSize -= JBUI.scale(5);
RectanglePainter
.paint(g, r.x, r.y, r.width, r.height, arcSize, myTextArea.getBackground(), myTextArea.isEnabled() ? Gray._100 : Gray._83);
}
}
示例11: showFrame
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
public void showFrame() {
final IdeFrameImpl frame = new IdeFrameImpl(ApplicationInfoEx.getInstanceEx(), myActionManager, myDataManager, ApplicationManager.getApplication());
myProject2Frame.put(null, frame);
if (myFrameBounds == null || !ScreenUtil.isVisible(myFrameBounds)) { //avoid situations when IdeFrame is out of all screens
myFrameBounds = ScreenUtil.getMainScreenBounds();
int xOff = myFrameBounds.width / 8;
int yOff = myFrameBounds.height / 8;
JBInsets.removeFrom(myFrameBounds, new Insets(yOff, xOff, yOff, xOff));
}
frame.setBounds(myFrameBounds);
frame.setExtendedState(myFrameExtendedState);
frame.setVisible(true);
}
示例12: setLocationInTheCenterOfScreen
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
private void setLocationInTheCenterOfScreen() {
Rectangle bounds = getGraphicsConfiguration().getBounds();
if (SystemInfo.isWindows) {
JBInsets.removeFrom(bounds, ScreenUtil.getScreenInsets(getGraphicsConfiguration()));
}
setLocation(UIUtil.getCenterPoint(bounds, getSize()));
}
示例13: doLayout
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public void doLayout() {
Rectangle bounds = new Rectangle(getWidth(), getHeight());
JBInsets.removeFrom(bounds, getInsets());
for (Component component : getComponents()) {
component.setBounds(bounds);
}
}
示例14: paint
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
@Override
public synchronized void paint(Graphics g2d, JComponent c) {
Graphics2D g = (Graphics2D)g2d;
JCheckBox b = (JCheckBox) c;
final Dimension size = c.getSize();
final Font font = c.getFont();
g.setFont(font);
FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, font);
Rectangle viewRect = new Rectangle(size);
Rectangle iconRect = new Rectangle();
Rectangle textRect = new Rectangle();
JBInsets.removeFrom(viewRect, c.getInsets());
String text = SwingUtilities.layoutCompoundLabel(c, fm, b.getText(), getDefaultIcon(),
b.getVerticalAlignment(), b.getHorizontalAlignment(),
b.getVerticalTextPosition(), b.getHorizontalTextPosition(),
viewRect, iconRect, textRect, b.getIconTextGap());
//background
if (c.isOpaque()) {
g.setColor(b.getBackground());
g.fillRect(0, 0, size.width, size.height);
}
final boolean selected = b.isSelected();
final boolean enabled = b.isEnabled();
drawCheckIcon(c, g, b, iconRect, selected, enabled);
drawText(c, g, b, fm, textRect, text);
}
示例15: paintMenuItem
import com.intellij.util.ui.JBInsets; //导入方法依赖的package包/类
protected void paintMenuItem(Graphics g, JComponent c,
Icon checkIcon, Icon arrowIcon,
Color background, Color foreground,
int defaultTextIconGap) {
// Save original graphics font and color
Font holdf = g.getFont();
Color holdc = g.getColor();
JMenuItem mi = (JMenuItem) c;
g.setFont(mi.getFont());
Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight());
JBInsets.removeFrom(viewRect, mi.getInsets());
MenuItemLayoutHelper lh = new MenuItemLayoutHelper(mi, checkIcon,
arrowIcon, viewRect, defaultTextIconGap, "-", //todo[kb] use protected field BasicMenuItemUI.acceleratorDelimiter when we move to java 1.7
mi.getComponentOrientation().isLeftToRight(), mi.getFont(),
acceleratorFont, MenuItemLayoutHelper.useCheckAndArrow(menuItem),
getPropertyPrefix());
MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem();
paintBackground(g, mi, background);
paintCheckIcon(g, lh, lr, holdc, foreground);
paintIcon(g, lh, lr, holdc);
g.setColor(foreground);
paintText(g, lh, lr);
paintAccText(g, lh, lr);
paintArrowIcon(g, lh, lr, foreground);
// Restore original graphics font and color
g.setColor(holdc);
g.setFont(holdf);
}