本文整理汇总了Java中com.intellij.codeInsight.hint.HintUtil.createAdComponent方法的典型用法代码示例。如果您正苦于以下问题:Java HintUtil.createAdComponent方法的具体用法?Java HintUtil.createAdComponent怎么用?Java HintUtil.createAdComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.hint.HintUtil
的用法示例。
在下文中一共展示了HintUtil.createAdComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAdText
import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
@Override
public void setAdText(@NotNull final String s, int alignment) {
if (myAdComponent == null) {
myAdComponent = HintUtil.createAdComponent(s, JBUI.Borders.empty(1, 5), alignment);
JPanel wrapper = new JPanel(new BorderLayout()) {
@Override
protected void paintComponent(Graphics g) {
g.setColor(Gray._135);
g.drawLine(0, 0, getWidth(), 0);
super.paintComponent(g);
}
};
wrapper.setOpaque(false);
wrapper.setBorder(JBUI.Borders.emptyTop(1));
wrapper.add(myAdComponent, BorderLayout.CENTER);
myContent.add(wrapper, BorderLayout.SOUTH);
pack(false, true);
} else {
myAdComponent.setText(s);
myAdComponent.setHorizontalAlignment(alignment);
}
}
示例2: setAdText
import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
@Override
public void setAdText(@NotNull final String s, int alignment) {
if (myAdComponent == null) {
myAdComponent = HintUtil.createAdComponent(s, BorderFactory.createEmptyBorder(1, 5, 1, 5), alignment);
JPanel wrapper = new JPanel(new BorderLayout()) {
@Override
protected void paintComponent(Graphics g) {
g.setColor(Gray._135);
g.drawLine(0, 0, getWidth(), 0);
super.paintComponent(g);
}
};
wrapper.setOpaque(false);
wrapper.setBorder(new EmptyBorder(1, 0, 0, 0));
wrapper.add(myAdComponent, BorderLayout.CENTER);
myContent.add(wrapper, BorderLayout.SOUTH);
pack(false, true);
} else {
myAdComponent.setText(s);
myAdComponent.setHorizontalAlignment(alignment);
}
}
示例3: setAdText
import com.intellij.codeInsight.hint.HintUtil; //导入方法依赖的package包/类
@Override
public void setAdText(@Nonnull final String s, int alignment) {
if (myAdComponent == null) {
myAdComponent = HintUtil.createAdComponent(s, JBUI.Borders.empty(1, 5), alignment);
JPanel wrapper = new JPanel(new BorderLayout()) {
@Override
protected void paintComponent(Graphics g) {
g.setColor(Gray._135);
UIUtil.drawLine(g, 0, 0, getWidth(), 0);
super.paintComponent(g);
}
};
wrapper.setOpaque(false);
wrapper.setBorder(JBUI.Borders.emptyTop(1));
wrapper.add(myAdComponent, BorderLayout.CENTER);
myContent.add(wrapper, BorderLayout.SOUTH);
pack(false, true);
}
else {
myAdComponent.setText(s);
myAdComponent.setHorizontalAlignment(alignment);
}
}