项目:incubator-netbeans
文件:Utilities.java
/**
* Finds out the monitor where the user currently has the input focus.
* This method is usually used to help the client code to figure out on
* which monitor it should place newly created windows/frames/dialogs.
*
* @return the GraphicsConfiguration of the monitor which currently has the
* input focus
*/
private static GraphicsConfiguration getCurrentGraphicsConfiguration() {
Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (focusOwner != null) {
Window w = SwingUtilities.getwindowAncestor(focusOwner);
if (w != null) {
return w.getGraphicsConfiguration();
} else {
//#217737 - try to find the main window which Could be placed in secondary screen
for( Frame f : Frame.getFrames() ) {
if( "NbMainWindow".equals(f.getName())) { //NOI18N
return f.getGraphicsConfiguration();
}
}
}
}
return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
}
项目:AgentWorkbench
文件:OIDCAuthorization.java
/**
* Gets the authorization dialog.
*
* @param presetUsername username which should be shown preset when displaying the dialog
* @param owner the window to which the dialog should belong (to center etc.)
* @return the dialog
*/
public jdialog getDialog(String presetUsername,Window owner) {
authDialog = new jdialog(owner);
OIDCPanel oidcPanel = new OIDCPanel(this);
if (presetUsername != null) {
oidcPanel.getJTextFieldUsername().setText(presetUsername);
}
authDialog.setContentPane(oidcPanel);
authDialog.setSize(new Dimension(500,190));
authDialog.setLocationRelativeto(null);
return authDialog;
}
@Override
protected void addFSWindowListener(Window w) {
// if the window is not a toplevel (has an owner) we have to use the
// real toplevel to enter the full-screen mode with (4933099).
if (!(w instanceof Frame) && !(w instanceof Dialog) &&
(realFSWindow = getToplevelOwner(w)) != null)
{
ownerOrigBounds = realFSWindow.getBounds();
WWindowPeer fp = (WWindowPeer)realFSWindow.getPeer();
ownerWasVisible = realFSWindow.isVisible();
Rectangle r = w.getBounds();
// we use operations on peer instead of component because calling
// them on component will take the tree lock
fp.reshape(r.x,r.y,r.width,r.height);
fp.setVisible(true);
} else {
realFSWindow = w;
}
fsWindowWasAlwaysOnTop = realFSWindow.isAlwaysOnTop();
((WWindowPeer)realFSWindow.getPeer()).setAlwaysOnTop(true);
fsWindowListener = new D3DFSWindowAdapter();
realFSWindow.addWindowListener(fsWindowListener);
}
项目:VASSAL-src
文件:PrivMsgCommand.java
public void executeCommand() {
PrivateChatter chat = mgr.getChatterFor(p);
if (chat == null) {
return;
}
Window f = SwingUtilities.getwindowAncestor(chat);
if (!f.isVisible()) {
f.setVisible(true);
Component c = KeyboardFocusManager.getCurrentKeyboardFocusManager()
.getFocusOwner();
if (c == null || !SwingUtilities.isDescendingFrom(c,f)) {
java.awt.Toolkit.getDefaultToolkit().beep();
for (int i = 0,j = chat.getComponentCount(); i < j; ++i) {
if (chat.getComponent(i) instanceof JTextField) {
(chat.getComponent(i)).requestFocus();
break;
}
}
}
}
else {
f.toFront();
}
chat.show(msg);
}
public WindowNode(Window win) {
super(win);
Window[] wns = win.getownedWindows();
Vector<WindowNode> wwns = new Vector<>();
for (Window wn : wns) {
if (propDialog.showAll || wn.isVisible()) {
wwns.add(new WindowNode(wn));
}
}
wins = new WindowNode[wwns.size()];
for (int i = 0; i < wwns.size(); i++) {
wins[i] = wwns.get(i);
}
title = win.toString();
clss = win.getClass().getName();
BufferedImage image = null;
try {
image = new Robot().
createScreenCapture(new Rectangle(win.getLocationOnScreen(),win.getSize()));
} catch (AWTException e) {
e.printstacktrace();
}
setComponentimageProvider(new ComponentimageProvider(image,x,y));
}
private boolean accept(Component aComponent) {
if (!(aComponent.isVisible() && aComponent.isdisplayable() &&
aComponent.isFocusable() && aComponent.isEnabled())) {
return false;
}
// Verify that the Component is recursively enabled. disabling a
// heavyweight Container disables its children,whereas disabling
// a lightweight Container does not.
if (!(aComponent instanceof Window)) {
for (Container enableTest = aComponent.getParent();
enableTest != null;
enableTest = enableTest.getParent())
{
if (!(enableTest.isEnabled() || enableTest.isLightweight())) {
return false;
}
if (enableTest instanceof Window) {
break;
}
}
}
return true;
}
@Override
public void mouseDragged(MouseEvent e) {
Point newPos = e.getPoint();
SwingUtilities.convertPointToScreen(newPos,Sizegrip.this);
int xDelta = newPos.x - origPos.x;
int yDelta = newPos.y - origPos.y;
Window wind = SwingUtilities.getwindowAncestor(Sizegrip.this);
if (wind!=null) { // Should always be true
if (getComponentOrientation().isLeftToRight()) {
int w = wind.getWidth();
if (newPos.x>=wind.getX()) {
w += xDelta;
}
int h = wind.getHeight();
if (newPos.y>=wind.getY()) {
h += yDelta;
}
wind.setSize(w,h);
}
else { // RTL
int newW = Math.max(1,wind.getWidth()-xDelta);
int newH = Math.max(1,wind.getHeight()+yDelta);
wind.setBounds(newPos.x,wind.getY(),newW,newH);
}
// invalidate()/validate() needed pre-1.6.
wind.invalidate();
wind.validate();
}
origPos.setLocation(newPos);
}
项目:VASSAL-src
文件:PieceWindow.java
/**
* Expects to be added to a {@link GameModule}. When added,sets
* the containing window to visible */
public void addTo(Buildable parent) {
idMgr.add(this);
if (!hidden) {
String key = Positionoption.key + getConfigureName();
if ("PieceWindow0".equals(id) && GlobalOptions.getInstance().isUseSingleWindow()) { //$NON-NLS-1$
mainWindowDock = new ComponentSplitter().splitLeft(GameModule.getGameModule().getControlPanel(),root,false);
}
else {
final Window w = initFrame();
final Positionoption pos = new VisibilityOption(key,w);
GameModule.getGameModule().getPrefs().addOption(pos);
}
GameModule.getGameModule().getToolBar().add(launch);
}
setAttributeTranslatable(NAME,false);
}
项目:incubator-netbeans
文件:NbPlatformCustomizer.java
@Messages({
"CTL_ModulesTab=Modules","CTL_SourcesTab=Sources","CTL_JavadocTab=Javadoc","CTL_HarnessTab=Harness"
})
private void initTabs() {
if (platformsList.getModel().getSize() > 0) {
platformsList.setSelectedindex(0);
sourcesTab = new NbPlatformCustomizerSources();
modulesTab = new NbPlatformCustomizerModules();
javadocTab = new NbPlatformCustomizerJavadoc();
harnessTab = new NbPlatformCustomizerHarness();
detailPane.addTab(CTL_ModulesTab(),modulesTab);
detailPane.addTab(CTL_SourcesTab(),sourcesTab);
detailPane.addTab(CTL_JavadocTab(),javadocTab);
detailPane.addTab(CTL_HarnessTab(),harnessTab);
Container window = this.getTopLevelAncestor();
if (window != null && window instanceof Window) {
((Window) window).pack();
}
}
}
private static void enterFullScreenExclusive(Window w) {
X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
if (peer != null) {
enterFullScreenExclusive(peer.getContentwindow());
peer.setFullScreenExclusiveModeState(true);
}
}
项目:jdk8u-jdk
文件:X11GraphicsDevice.java
private static void enterFullScreenExclusive(Window w) {
X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
if (peer != null) {
enterFullScreenExclusive(peer.getwindow());
peer.setFullScreenExclusiveModeState(true);
}
}
项目:openjdk-jdk10
文件:FullScreenAfterSplash.java
private static void enableFullScreen(Window window) {
try {
Class<?> fullScreenUtilities = Class.forName("com.apple.eawt.FullScreenUtilities");
Method setwindowCanFullScreen = fullScreenUtilities.getmethod("setwindowCanFullScreen",Window.class,boolean.class);
setwindowCanFullScreen.invoke(fullScreenUtilities,window,true);
Class fullScreenListener = Class.forName("com.apple.eawt.FullScreenListener");
Object listenerObject = Proxy.newProxyInstance(fullScreenListener.getClassLoader(),new Class[]{fullScreenListener},(proxy,method,args) -> {
switch (method.getName()) {
case "windowEnteringFullScreen":
windowEnteringFullScreen = true;
break;
case "windowEnteredFullScreen":
windowEnteredFullScreen = true;
break;
}
return null;
});
Method addFullScreenListener = fullScreenUtilities.getmethod("addFullScreenListenerTo",fullScreenListener);
addFullScreenListener.invoke(fullScreenUtilities,listenerObject);
} catch (Exception e) {
throw new RuntimeException("FullScreen utilities not available",e);
}
}
项目:openjdk-jdk10
文件:PolicyTool.java
/**
* displays a dialog Box describing the status of an event
*/
void displayStatusDialog(Window w,String status) {
ToolDialog sd = new ToolDialog
(PolicyTool.getMessage("Status"),tool,this,true);
// find the location of the PolicyTool gui
Point location = ((w == null) ?
getLocationOnScreen() : w.getLocationOnScreen());
//sd.setBounds(location.x + 50,location.y + 50,500,100);
sd.setLayout(new GridBagLayout());
JLabel label = new JLabel(status);
addNewComponent(sd,label,1,0.0,GridBagConstraints.BOTH);
JButton okButton = new JButton(PolicyTool.getMessage("OK"));
ActionListener okListener = new StatusOKButtonListener(sd);
okButton.addActionListener(okListener);
addNewComponent(sd,okButton,GridBagConstraints.VERTICAL);
sd.getRootPane().setDefaultButton(okButton);
sd.getRootPane().registerKeyboardAction(okListener,escKey,JComponent.WHEN_IN_FOCUSED_WINDOW);
sd.pack();
sd.setLocationRelativeto(w);
sd.setVisible(true);
}
项目:incubator-netbeans
文件:TabControlButtonFactory.java
void addListeners(Component ancestor,boolean addToFirst) {
Component a;
firstInvisibleAncestor = null;
for (a = ancestor;
firstInvisibleAncestor == null;
a = a.getParent()) {
if (addToFirst || a != ancestor) {
a.addComponentListener(this);
if (a instanceof JComponent) {
JComponent jAncestor = (JComponent)a;
jAncestor.addPropertychangelistener(this);
}
}
if (!a.isVisible() || a.getParent() == null || a instanceof Window) {
firstInvisibleAncestor = a;
}
}
if (firstInvisibleAncestor instanceof Window &&
firstInvisibleAncestor.isVisible()) {
firstInvisibleAncestor = null;
}
}
项目:openjdk-jdk10
文件:SetShapeTest.java
private static void createUI() throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
background = new Frame();
background.setUndecorated(true);
background.setBackground(Color.blue);
background.setSize(300,300);
background.setLocation(100,100);
background.setVisible(true);
window = new Window(background);
window.setBackground(Color.red);
window.add(new Panel(),BorderLayout.CENTER);
window.setLocation(200,200);
window.setSize(100,100);
Area a = new Area();
a.add(new Area(new Rectangle2D.Double(0,100,100)));
window.setShape(a);
window.setVisible(true);
window.toFront();
}
});
}
项目:incubator-netbeans
文件:AutoResizingPanel.java
private void enlargeAsNecessary(int currentWidth,int currentHeight,int requestedWidth,int requestedHeight) {
if ((currentWidth >= requestedWidth) && (currentHeight >= requestedHeight)) {
/* the panel is large enough */
return;
}
Window window = SwingUtilities.getwindowAncestor(this);
if (window == null) {
return;
}
try {
requestedSize = new Dimension(requestedWidth,requestedHeight);
window.pack();
} finally {
requestedSize = null;
}
}
项目:incubator-netbeans
文件:UIHandler.java
@Override
public void actionPerformed(ActionEvent ev) {
JComponent c = (JComponent)ev.getSource();
Window w = SwingUtilities.windowForComponent(c);
if (w != null) {
w.dispose();
}
Installer.RP.post(this);
}
项目:openjdk-jdk10
文件:MultiMonPrintDlgTest.java
private void executetest() {
GraphicsDevice defDev = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
int x = 0;
Frame f = null;
for (x = 0; x < gd.length; x ++) {
if (gd[x] != defDev) {
secFrame = new Frame("Screen " + x + " - secondary",gd[x].getDefaultConfiguration());
f = secFrame;
} else {
primaryFrame = new Frame("Screen " + x + " - primary",gd[x].getDefaultConfiguration());
f = primaryFrame;
}
Button b = new Button("Print");
b.addActionListener(this);
f.add("South",b);
f.addWindowListener (new WindowAdapter() {
public void windowClosing(WindowEvent we) {
((Window) we.getSource()).dispose();
}
});
f.setSize(200,200);
f.setVisible(true);
}
}
项目:openjdk-jdk10
文件:XComponentPeer.java
@SuppressWarnings("deprecation")
public boolean isObscured() {
Container container = (target instanceof Container) ?
(Container)target : target.getParent();
if (container == null) {
return true;
}
Container parent;
while ((parent = container.getParent()) != null) {
container = parent;
}
if (container instanceof Window) {
XWindowPeer wpeer = AWTAccessor.getComponentAccessor()
.getPeer(container);
if (wpeer != null) {
return (wpeer.winAttr.visibilityState !=
XWindowAttributesData.AWT_UNOBSCURED);
}
}
return true;
}
项目:incubator-netbeans
文件:DocumentsDlg.java
public void removeNotify () {
// save dialog size on click at [x] in titlebar
Window dlg = SwingUtilities.getwindowAncestor(this);
if( null != dlg )
getDefault().prevIoUsDialogSize = dlg.getSize();
super.removeNotify();
explorer.removePropertychangelistener(this);
}
项目:jdk8u-jdk
文件:JOptionPane.java
private jdialog createDialog(Component parentComponent,String title,int style)
throws HeadlessException {
final jdialog dialog;
Window window = JOptionPane.getwindowForComponent(parentComponent);
if (window instanceof Frame) {
dialog = new jdialog((Frame)window,title,true);
} else {
dialog = new jdialog((Dialog)window,true);
}
if (window instanceof SwingUtilities.SharedOwnerFrame) {
WindowListener ownerShutdownListener =
SwingUtilities.getSharedOwnerFrameShutdownListener();
dialog.addWindowListener(ownerShutdownListener);
}
initDialog(dialog,style,parentComponent);
return dialog;
}
项目:jdk8u-jdk
文件:InputContext.java
private synchronized void addClientwindowListeners() {
Component client = getClientComponent();
if (client == null) {
return;
}
Window window = getComponentwindow(client);
if (window == null) {
return;
}
window.addComponentListener(this);
window.addWindowListener(this);
clientwindowListened = window;
}
项目:jdk8u-jdk
文件:Win32GraphicsDevice.java
@Override
public synchronized void setdisplayMode(displayMode dm) {
if (!isdisplayChangeSupported()) {
super.setdisplayMode(dm);
return;
}
if (dm == null || (dm = getMatchingdisplayMode(dm)) == null) {
throw new IllegalArgumentException("Invalid display mode");
}
if (getdisplayMode().equals(dm)) {
return;
}
Window w = getFullScreenWindow();
if (w != null) {
WWindowPeer peer = (WWindowPeer)w.getPeer();
configdisplayMode(screen,peer,dm.getWidth(),dm.getHeight(),dm.getBitDepth(),dm.getRefreshRate());
// resize the fullscreen window to the dimensions of the new
// display mode
Rectangle screenBounds = getDefaultConfiguration().getBounds();
w.setBounds(screenBounds.x,screenBounds.y,dm.getHeight());
// Note: no call to replaceSurfaceData is required here since
// replacement will be caused by an upcoming display change event
} else {
throw new IllegalStateException("Must be in fullscreen mode " +
"in order to set display mode");
}
}
项目:Equella
文件:EditorHelper.java
public static void listenForClosing(final Window window,final EditorInterface editor)
{
if( window instanceof JFrame )
{
((JFrame) window).setDefaultCloSEOperation(WindowConstants.DO_nothing_ON_CLOSE);
}
if( window instanceof jdialog )
{
((jdialog) window).setDefaultCloSEOperation(WindowConstants.DO_nothing_ON_CLOSE);
}
window.addWindowListener(new WindowAdapter()
{
@Override
public void windowClosing(WindowEvent e)
{
// If the spinner is showing,then something is happening and we
// do not
// want the window to be closed down.
if( !editor.getStatusBar().isspinnerVisible() )
{
if( !EditorHelper.onClose(editor,null) )
{
return;
}
}
window.setVisible(false);
window.dispose();
}
});
}
项目:openjdk-jdk10
文件:Win32GraphicsDevice.java
@Override
public synchronized void setdisplayMode(displayMode dm) {
if (!isdisplayChangeSupported()) {
super.setdisplayMode(dm);
return;
}
if (dm == null || (dm = getMatchingdisplayMode(dm)) == null) {
throw new IllegalArgumentException("Invalid display mode");
}
if (getdisplayMode().equals(dm)) {
return;
}
Window w = getFullScreenWindow();
if (w != null) {
WWindowPeer peer = AWTAccessor.getComponentAccessor().getPeer(w);
configdisplayMode(screen,dm.getHeight());
// Note: no call to replaceSurfaceData is required here since
// replacement will be caused by an upcoming display change event
} else {
throw new IllegalStateException("Must be in fullscreen mode " +
"in order to set display mode");
}
}
项目:RxJava2Swing
文件:WindowEventObservable.java
@Override
protected void ondispose(Window w) {
int f = flags;
if ((f & 1) != 0) {
w.removeWindowListener(this);
}
if ((f & 2) != 0) {
w.removeWindowFocusListener(this);
}
if ((f & 4) != 0) {
w.removeWindowStateListener(this);
}
}
protected void updateValue() {
final int style = Font.PLAIN |
(bold.booleanValue().booleanValue() ? Font.BOLD : 0) |
(italic.booleanValue().booleanValue() ? Font.ITALIC : 0);
final OutlineFont font = new OutlineFont(
(String) family.getSelectedItem(),Integer.parseInt(size.getValueString()),outline.booleanValue().booleanValue()
);
setValue(font);
demo.setFont(font);
final Window w = SwingUtilities.getwindowAncestor(getControls());
if (w != null) {
w.pack();
}
}
项目:openjdk-jdk10
文件:Test6541987.java
public static void main(String[] args) throws AWTException {
robot = new Robot();
// test escape after selection
start();
click(KeyEvent.VK_ESCAPE);
robot.waitForIdle();
// test double escape after editing
start();
click(KeyEvent.VK_1);
click(KeyEvent.VK_0);
click(KeyEvent.VK_ESCAPE);
click(KeyEvent.VK_ESCAPE);
robot.waitForIdle();
// all windows should be closed
for (Window window : Window.getwindows()) {
if (window.isVisible()) {
throw new Error("found visible window: " + window.getName());
}
}
}
项目:openjdk-jdk10
文件:jpopupmenuOperator.java
/**
* Waits for a window which contains jpopupmenu.
*
* @param chooser a component chooser specifying criteria for jpopupmenu.
* @return a window containing jpopupmenu.
* @throws TimeoutExpiredException
*/
public static Window waitJPopupWindow(ComponentChooser chooser) {
try {
return (new WindowWaiter()).waitwindow(new JPopupWindowFinder(chooser));
} catch (InterruptedException e) {
return null;
}
}
项目:jdk8u-jdk
文件:XComponentPeer.java
/****** DropTargetPeer implementation ********************/
public void addDropTarget(DropTarget dt) {
Component comp = target;
while(!(comp == null || comp instanceof Window)) {
comp = comp.getParent();
}
if (comp instanceof Window) {
XWindowPeer wpeer = (XWindowPeer)(comp.getPeer());
if (wpeer != null) {
wpeer.addDropTarget();
}
}
}
项目:openjdk-jdk10
文件:LWMouseInfoPeer.java
@Override
public boolean isWindowUnderMouse(Window w) {
if (w == null) {
return false;
}
LWWindowPeer windowPeer = AWTAccessor.getComponentAccessor().getPeer(w);
if (windowPeer == null) {
return false;
}
return LWToolkit.getLWToolkit().getPlatformWindowUnderMouse() == windowPeer.getPlatformWindow();
}
项目:QN-ACTR-Release
文件:Manager.java
/**
* Adds a new Window to be checked for termination before terminating JVM
* @param application application to be checked
*/
public static void addWindow(Window application) {
if (!windows.contains(application)) {
synchronized (windows) {
if (!windows.contains(application)) {
windows.add(application);
}
}
}
}
项目:incubator-netbeans
文件:ConnectPanel.java
/**
* Refreshes panel with options corresponding to the selected connector type.
* This method is called when a user selects new connector type.
*/
@Override
public void actionPerformed (ActionEvent e) {
int selectedindex = ((JComboBox) e.getSource ()).getSelectedindex ();
refresh (selectedindex,Properties.getDefault ().getProperties ("debugger"));
Window w = SwingUtilities.getwindowAncestor(this);
if (w != null) {
w.pack (); // ugly hack...
}
}
项目:openjdk-jdk10
文件:D3DSurfaceData.java
@Override
void restoreSurface() {
if (!peer.isAccelCapable()) {
throw new InvalidPipeException("Onscreen acceleration " +
"disabled for this surface");
}
Window fsw = graphicsDevice.getFullScreenWindow();
if (fsw != null && fsw != peer.getTarget()) {
throw new InvalidPipeException("Can't restore onscreen surface"+
" when in full-screen mode");
}
super.restoreSurface();
// if initialization was unsuccessful,an IPE will be thrown
// and the surface will remain lost
setSurfaceLost(false);
// This is to make sure the render target is reset after this
// surface is restored. The reason for this is that sometimes this
// surface can be restored from multiple threads (the screen update
// manager's thread and app's rendering thread) at the same time,// and when that happens the second restoration will create the
// native resource which will not be set as render target because
// the BufferedContext's validate method will think that since the
// surface data object didn't change then the current render target
// is correct and no rendering will appear on the screen.
D3DRenderQueue rq = D3DRenderQueue.getInstance();
rq.lock();
try {
getContext().invalidateContext();
} finally {
rq.unlock();
}
}
项目:openjdk-jdk10
文件:JComponentOperator.java
/**
* Looks for a first window-like container.
*
* @return either WindowOperator of JInternalFrameOperator
*/
public ContainerOperator<?> getwindowContainerOperator() {
Component resultComp;
if (getSource() instanceof Window) {
resultComp = getSource();
} else {
resultComp = getContainer(new ComponentChooser() {
@Override
public boolean checkComponent(Component comp) {
return (comp instanceof Window
|| comp instanceof JInternalFrame);
}
@Override
public String getDescription() {
return "";
}
});
}
ContainerOperator<?> result;
if (resultComp instanceof Window) {
result = new WindowOperator((Window) resultComp);
} else {
result = new ContainerOperator<>((Container) resultComp);
}
result.copyEnvironment(this);
return result;
}
项目:QN-ACTR-Release
文件:AboutDialogFactory.java
/**
* Shows JABA about window
* @param owner owner of this window (if null,window will not be modal)
*/
public static void showJABA(Window owner) {
title.setText(TITLE_START + "JABA" + TITLE_END);
title.setIcon(JMtimageLoader.loadImage(GraphStartScreen.IMG_JABAICON,new Dimension(50,50)));
addNames(JABA);
createDialog(owner,"About JABA").show();
}
项目:QN-ACTR-Release
文件:AboutDialogFactory.java
/**
* Creates a new modal JMTDialog with specified owner and with panel inside,displaying current text.
* @param owner owner of the dialog. If it's null or invalid,created dialog will not
* be modal
* @param title title of dialog to be created
* @return created dialog
*/
protected static JMTDialog createDialog(Window owner,String title) {
final JMTDialog dialog;
if (owner == null) {
dialog = new JMTDialog();
} else if (owner instanceof Dialog) {
dialog = new JMTDialog((Dialog) owner,true);
} else if (owner instanceof Frame) {
dialog = new JMTDialog((Frame) owner,true);
} else {
dialog = new JMTDialog();
}
dialog.setTitle(title);
dialog.getContentPane().setLayout(new BorderLayout());
dialog.getContentPane().add(panel,BorderLayout.CENTER);
// Sets text to be displayed
textArea.setText("<html><p><font size=\"-1\">" + WEBSITE + "<br><br>" + text + "</font></p></html>");
// Adds exit button
JButton exit = new JButton();
exit.setText("Close");
exit.addActionListener(new ActionListener() {
/**
* Invoked when an action occurs.
*/
public void actionPerformed(ActionEvent e) {
dialog.close();
}
});
JPanel bottom = new JPanel();
bottom.add(exit);
dialog.getContentPane().add(bottom,BorderLayout.soUTH);
dialog.centerWindow(450,500);
return dialog;
}
public void repack() {
if (panel != null) {
Window w = SwingUtilities.getwindowAncestor(panel);
if (w != null) {
w.pack();
}
}
rebuildViz();
}
项目:incubator-netbeans
文件:ProfilerPopup.java
private static ProfilerPopup create(Component invoker,Component content,int x,int y,int popupAlign,int resizeMode,Listener listener) {
Point location = new Point(x,y);
Dimension size = new Dimension();
Window owner = null;
if (invoker != null) {
SwingUtilities.convertPointToScreen(location,invoker);
size.setSize(invoker.getSize());
owner = SwingUtilities.getwindowAncestor(invoker);
}
return new ProfilerPopup(content,new Rectangle(location,size),popupAlign,owner,resizeMode,listener);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。