本文整理了Java中javax.swing.Popup
类的一些代码示例,展示了Popup
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Popup
类的具体详情如下:
包路径:javax.swing.Popup
类名称:Popup
暂无
代码示例来源:origin: apache/geode
public void showPopupText(int x, int y, int xOnScreen, int yOnScreen) {
LifelineState state = getStateAt(x, y);
if (state == mouseoverState) {
return;
}
if (mouseover != null) {
mouseover.hide();
}
if (state == null) {
mouseover = null;
mouseoverState = null;
} else {
Component popupContents = state.getPopup();
mouseoverState = state;
mouseover =
PopupFactory.getSharedInstance().getPopup(this, popupContents, xOnScreen + 20, yOnScreen);
mouseover.show();
}
}
代码示例来源:origin: chatty/chatty
private void showNow() {
if (popup != null) {
return;
}
label.setText(text);
Point p = determinePosition();
if (p != null) {
position = p;
popup = PopupFactory.getSharedInstance().getPopup(textPane, label, p.x, p.y);
popup.show();
}
}
代码示例来源:origin: magefree/mage
@Override
public void componentHidden(ComponentEvent e) {
if (tooltipPopup != null) {
tooltipPopup.hide();
}
}
代码示例来源:origin: stackoverflow.com
PopupFactory factory = PopupFactory.getSharedInstance();
Popup popup = factory.getPopup(myButton, myPanel, x, y);
popup.show();
代码示例来源:origin: stackoverflow.com
public void actionPerformed(ActionEvent e) {
PopupFactory factory = PopupFactory.getSharedInstance();
final Popup popup = factory.getPopup(text1, new JLabel("POPUP"),frame.getX()+300,frame.getY()+300);
text1.addHierarchyListener(new HierarchyListener() {
public void hierarchyChanged(HierarchyEvent e) {
if (e.getID() == HierarchyEvent.HIERARCHY_CHANGED
&& (e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0) {
popup.hide();
}
}
});
popup.show();
}
代码示例来源:origin: stackoverflow.com
Popup popup = new Popup();
// add content (you can add as many nodes as you want)
popup.getContent().add(new Label("Hello Popup!"));
// show (move this to the double-click listener)
popup.show(primaryStage);
// hide (move this to the click listener)
popup.hide();
代码示例来源:origin: ron190/jsql-injection
/**
* Makes the {@code Popup} visible. If the popup has a
* heavy-weight container, we try to snapshot the background.
* If the {@code Popup} is currently visible, it remains visible.
*/
@Override
public void show() {
if (this.heavyWeightContainer != null) {
this.snapshot();
}
this.popup.show();
}
代码示例来源:origin: stackoverflow.com
Popup popup = new Popup();
popup.getContent().add(label);
label.setText("Value: ---");
popup.setAnchorX(e.getScreenX());
popup.setAnchorY(e.getScreenY() + offset);
});
slider.setOnMouseEntered(e -> popup.show(slider, e.getScreenX(), e.getScreenY() + offset));
slider.setOnMouseExited(e -> popup.hide());
代码示例来源:origin: JDatePicker/JDatePicker
/**
* Called internally to popup the dates.
*/
private void showPopup() {
if (popup == null) {
PopupFactory fac = new PopupFactory();
Point xy = getLocationOnScreen();
datePanel.setVisible(true);
popup = fac.getPopup(this, datePanel, (int) xy.getX(), (int) (xy.getY() + this.getHeight()));
popup.show();
}
}
代码示例来源:origin: stackoverflow.com
final Popup p = PopupFactory.getSharedInstance().getPopup(myComponent, new JLabel("Here is my popup!"), x, y);
p.show();
// create a timer to hide the popup later
Timer t = new Timer(5000, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
p.hide();
}
});
t.setRepeats(false);
t.start();
代码示例来源:origin: stackoverflow.com
public TextFieldCaretControlSkin(TextField textField, Stage stage) {
super(textField);
Popup popup = new Popup();
popup.setAnchorLocation(PopupWindow.AnchorLocation.CONTENT_BOTTOM_LEFT);
popup.setAutoFix(true);
popup.getContent().add(new ListView<String>());
public void changed(ObservableValue<? extends Bounds> observable,
Bounds oldValue, Bounds newValue) {
popup.hide();
popup.show(textField,
p.getX() + caretPath.getScene().getX() +
caretPath.getScene().getWindow().getX(),
代码示例来源:origin: stackoverflow.com
rectangle.setEffect(new DropShadow());
final Popup pop = new Popup();
pop.getContent().add(rectangle);
pop.setHeight(100);
pop.setWidth(100);
@Override
public void handle(MouseEvent t) {
pop.setX(t.getScreenX());
pop.setY(t.getScreenY() - 50);
pop.show(stage);
@Override
public void handle(MouseEvent t) {
pop.hide();
代码示例来源:origin: stackoverflow.com
Popup popup = new Popup();
Button closeButton = new Button("Close");
closeButton.setOnAction(event -> popup.hide());
StackPane container = new StackPane(closeButton);
container.setStyle("-fx-background-color: steelblue;");
double y = event.getScreenY();
double deltaY = y - mouseLocation.get().getY() ;
popup.setX(popup.getX() + deltaX);
popup.setY(popup.getY() + deltaY);
mouseLocation.set(new Point2D(x, y));
popup.getScene().setRoot(container);
popup.show(owner);
代码示例来源:origin: stackoverflow.com
popUpVBox.getChildren().add(cencel);
final Popup popup = new Popup();
popup.setAutoFix(false);
popup.setHideOnEscape(true);
popup.getContent().addAll(popUpVBox);
popup.setX(250);
popup.setY(175);
popup.hide();
if (popup.isShowing()) {
popup.hide();
} else {
hello.setText("hello.."+name.getText());
popup.show(stage);
代码示例来源:origin: stackoverflow.com
popup.valueProperty().addListener((obs, oldDate, newDate) -> {
dateLabel.setText(newDate.toString());
});
Bounds buttonBds = changeButton.getBoundsInLocal();
Point2D loc = changeButton.localToScreen(buttonBds.getMaxX(), buttonBds.getMinY());
popup.showPopup(primaryStage, loc.getX(), loc.getY());
});
Button okButton = new Button("OK");
okButton.setOnAction(event -> {
popup.hide();
value.set(picker.getValue());
});
root.setBottom(buttons);
popup = new Popup();
popup.getContent().add(root);
popup.show(owner, x, y);
代码示例来源:origin: stackoverflow.com
private void showContextMenu() // showContextMenu(MouseEvent event)
{
Popup popup = new Popup();
VBox content = new VBox();
Button b = new Button("Click Me!");
b.setOnAction(new EventHandler<ActionEvent>() { });
content.getChildren().addAll(b);
popup.getContent().add(content);
popup.setX(0); // or get mouse event x and y
popup.setY(0); // event.getY()
popup.setAutoHide(true);
popup.show(your popup owner);
}
代码示例来源:origin: stackoverflow.com
Popup pu = new Popup();
pu.getContent().add(your_node);
pu.show(ownerStage);
代码示例来源:origin: stackoverflow.com
Popup popup = new Popup(getBaseContext());
popup.setOnDismissListener(new OnDismissListener(){
public void onDismiss(){
//do what you need to here
}
});
popup.show(arg1);
代码示例来源:origin: stackoverflow.com
public static void showWarningPopup( Node owner, String message, double screenX, double screenY )
{
// create error image
ImageView image = new ImageView( "/resources/error-14.png" );
image.getStyleClass().add( "image-view" );
// create content
Label label = new Label( message, image );
label.setBackground(
new Background(
new BackgroundFill(
Color.ORANGE,
new CornerRadii( 10 ),
new Insets( -10 )
)
)
);
// create and show the popup
Popup popup = new Popup();
popup.setHideOnEscape( true );
popup.setAutoHide( true );
popup.setAutoFix( true );
popup.getContent().add( label );
popup.show( owner, screenX, screenY );
}
代码示例来源:origin: net.officefloor.tool/officetool_demo
@Override
public synchronized void runMacroTask(MacroTaskContext context) {
// Create text area to display information
JTextArea information = new JTextArea(this.information);
information.setEditable(false);
information.setBorder(new LineBorder(Color.LIGHT_GRAY));
information.setBackground(new Color(255, 255, 180));
// Create the popup to show the information
final Point absoluteLocation = context
.getAbsoluteLocation(this.location);
this.popup = PopupFactory.getSharedInstance().getPopup(null,
information, absoluteLocation.x, absoluteLocation.y);
// Show the information
this.popup.show();
}
内容来源于网络,如有侵权,请联系作者删除!