本文整理匯總了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();
}