hm..is it possible if i my popup window not have 'x' button at right top of it? thx
Printable View
hm..is it possible if i my popup window not have 'x' button at right top of it? thx
The only way I can think of, is setting the default close operation to DO_NOTHING_ON_CLOSE. It will disable it, sort of. The button will still be there, but it won't do nothing when clicked.
Right i know this isn't stricly a window, but i wanted to get the the close button and remove the title bar area, then put the close button elsewhere.
it was in a JInternalPane, you can get the UI for it, then get the north panel and then you can roam around this to find the contents. not the cleanest of approaches but it worked non the less, i removed the close button, and used it elsewhere......
just thought i'd mention it..
heres the code if your interested:
Code:
/**
* Extract the Close Button from the Internal Frame UI
* (Easier than drawing one ourselves, as this will default to the
* correct look and feel setting! Cunning aye?);
*/
InternalFrameUI ui = this.getUI();
{
BasicInternalFrameUI bfui = (BasicInternalFrameUI) ui;//
JComponent title = bfui.getNorthPane();
bfui.setNorthPane(null);
int compCount = title.getComponentCount();
this.closeButton = (JButton) title.getComponent(compCount-1);
/**
* Override the ActionListener
* so we can force a hide rather than a close
* as te set default close operation dosen't seem to
* work once you wrench the Close button from the title
* bar area.
*/
this.closeButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
System.err.println("Close button action performed");
setVisible(!isVisible());
}
});
}
That's really cool. I figured there was a way to do this, but I didn't know how.
thanks System_Error and Andy_Hollywood..
is it possible to do it via Javascript?
erickwidya, what type of window is your popup?, i've played around with having alsorts of window popup, and inthe end just made is a JWindow, rather that a JFrame which has the title bar area in it...
If its s JPopup then note that you can't really add components into it that will also use the popup, like combo boxes, as this causes weirdities, if its a popup component you want, I have one written that responds like a combo box, i.e. closes when you click outside of it, and it allows popupable components ont he inside of it....
Andy
Do you know the difference between Java and Javascript?Quote:
Originally Posted by erickwidya
thx vbNeo and Andy_Holywood
i'm afraid i don't know about it and this question were ask from my friend..so plz forgive me if the question or comment sound stupid :)Quote:
Do you know the difference between Java and Javascript?
Andy..thank for the code and explanation.
hm..now gonna told my friend about it..
FYI
EDIT : he ask me how to make the popup window not have close button at top right..
he can open it via javascript using window.open..
thx
Since it seems unresolved, and that you changed your mind from Java, too JavaScript I moved your thread to the right location, so you will probably get a better answer.
ØØ
the window.open has a property.. um titlebar=No which turns off the titlebar as the window is created.
Of course this means you need some other way to close the window...
Do a google or yahoo search for the window.open properties :)
:thumb:
Vince
Use this window desinger:
http://www.batfink.clara.co.uk/js_html/designwin.html
If you untick the "title bar" box it shouldn't have a x.
Edit: The titlebar=no attribute doesn't seem to work in FF ir IE. Maybe it worked in older versions of IE.
I think you'll instead have to write a script which can simulate a window. Basically, you'd make a DIV that is draggable.