本文整理汇总了Java中javax.swing.Popup.hide方法的典型用法代码示例。如果您正苦于以下问题:Java Popup.hide方法的具体用法?Java Popup.hide怎么用?Java Popup.hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.Popup
的用法示例。
在下文中一共展示了Popup.hide方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hideCurrentPopup
import javax.swing.Popup; //导入方法依赖的package包/类
public void hideCurrentPopup() {
Popup cur = curPopup;
if (cur != null) {
curPopup = null;
dragStart = null;
cur.hide();
}
}
示例2: run
import javax.swing.Popup; //导入方法依赖的package包/类
private void run() {
JPanel panel = new JPanel();
int count = 0;
long diffTime, initialDiffTime = 0;
while (count < ITERATION_NUMBER) {
robot.delay(ROBOT_DELAY);
PopupFactory factory = PopupFactory.getSharedInstance();
Popup popup = factory.getPopup(panel, textArea, editorPane.getLocation().x + 20,
editorPane.getLocation().y + 20);
long startTime = System.currentTimeMillis();
popup.show();
long endTime = System.currentTimeMillis();
diffTime = endTime - startTime;
if (count > 1) {
if (diffTime * HANG_TIME_FACTOR < (endTime - startTime)) {
throw new RuntimeException("The test is near to be hang: iteration count = " + count
+ " initial time = " + initialDiffTime
+ " current time = " + diffTime);
}
} else {
initialDiffTime = diffTime;
}
count++;
robot.delay(ROBOT_DELAY);
popup.hide();
}
}
示例3: show
import javax.swing.Popup; //导入方法依赖的package包/类
public void show() {
Point xy = computeXY();
Runnable runnable = new Runnable() {
@Override
public void run() {
Popup popup = null;
try {
Component useContents = contents;
if (opacity != null) {
JComponent tmp = new JComponent() {
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
AlphaComposite comp = AlphaComposite.getInstance(
AlphaComposite.SRC_OVER, opacity);
Composite save = g2d.getComposite();
g2d.setComposite(comp);
super.paintComponent(g);
g2d.setComposite(save);
}
};
tmp.add(contents);
useContents = tmp;
}
popup = PopupFactory.getSharedInstance().getPopup(owner, useContents, xy.x, xy.y);
popup.show();
Thread.sleep(durationMillis);
}
catch (InterruptedException ignore) { }
finally {
if (popup != null) {
popup.hide();
}
}
}
};
new Thread(runnable).start();
}