Disabling default close button in JFrame
hi,
in JFrame there are by default 'minimize', 'maximize' and 'close' button. is it possible to disable or not to show the 'close' button'
regards,
tom
If you want to control the closing of the frame you can use
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE)If you are interested in listening whether this button was clicked (for example as an alternative to a "Close" button you can register a WindowListener and handle the windowClosing(...) event
About disabling/hiding - maybe you will have to subclass the frame header UI class, which is L&F specific.
HTH
Mike
Similar Messages
-
Disabling the Close Button of JFrame or Frame
Dear Friends,
can anybody please help out to solve the problem i am having in disabling the close button of Jframe . Or try for hiding the close button from the screen
thanks kalyanto disable the close button
myFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE) -
How to remove close button of JFrame
Hey all,
Can anybody tell me how to remove the default close button of JFrame.I mean to say that i only need the minimize and restore button on the top-right corner of the JFrame.
Regards,
Sharad agarwalhttp://forum.java.sun.com/thread.jspa?threadID=623108&tstart=0
-
How to disable the close button(Cross) on a dialog
Hi,
Is there a way to disable the close button (cross on the right top of the dialog) on a dialog.
Thank youSince your posting in the swing project forum, I assume your talking about JDialog. If so, use JDialog.setDefaultCloseOperation( DO_NOTHING_ON_CLOSE ). Same method exists in JFrame as well, but not in JWindow.
-
Disabling windows close button in dialog
Hi,
I am using Jdev 10.1.3.x(10g)
I am opening a dialog pop up for a functionality. What i want is to force user to use cancel button provided inside dialog to come out of it and want user to not to use windows cance X button.
Is there any way by which i can hide the title bar or disable the close button or on click of widow close i actually click on cancel button throgh java script?
Main concern is i am passing some data from parent to dialog throgh process scope and i want to clear it on cancel. In my application there are many popup dialog which may lead to memeory issue so i seek solution to clear this data once it is not desired any more.
Also i tried Request object to pass the data but in popup it is not recognised.
Suggestion in any direction will be helpful.
Regards,
Kevin ChhedaHi,
answering this question for 10.1.3 since 11g is different and provides a af:dialog component to handle this case. In 10.1.3 the window you open is an external browser window. You cannot disable the close button here because it is part of the browser window that JavaScript cannot control
Frank -
Maximise,minimise and close button of Jframe to be disabled
Please help me out to to disable the close,maximise and minimise button of Jframe
Use the
setUndecorated(boolean ); method of JFrame
or
Use the Dialog
or
set resizable false -
Default CLOSE button (X) on the upper right hand corner
Hi All,
When Oracle Forms is launched, there are 3 default buttons on the right hand corner: Maximize,Minimize and Close button.
The maximize and minimize button on ALL of my forms are working PERFECTLY fine.
HOWEVER, the close(X) buttons do NOT work at all. When user clicks it, the forms blink once and do nothing.
My form version is: 9.0.2.11.0
How can I fix it?And take care if your form has multiple windows - you might not want all of them to exit the entire form. If you put your W-W-C trigger at form level you can determine which window is being closed using :system.event_window
-
This is possible to hide the Close button in JFrame
As title
If can, please let me know howYou can tell the frame not to decorate with JFrame.setFrameUndecorated() {or something like that,
look it up in the API}, or you can specify your own decorations. I'm guessing that you really don't
want to do either of those, though. -
How to disable close & minimize button of jframe?
how can i disable the close and minimize button of the Jframe?
to disable minimize
setResizeable(false);
to inactivate the close button
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); -
Disable/enable window close button?
I have a new Window() open and I want to disable the close button when the window has already been opened. Does anyone know how to do this in Flex?
Ok I got, it's an AIR app.
You can listen to event Closing and preventDefault on it. Check this:
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
closing="closingHandler(event)">
<fx:Script>
<![CDATA[
protected function closingHandler(event:Event):void
if(!forceClose.selected)
event.preventDefault();
]]>
</fx:Script>
<s:CheckBox id="forceClose" label="Force close" />
</s:WindowedApplication>
Regards,
Pablo Souza -
To disable close button of the UDF form
Hi,
I need to disable the close button of a UDF form. Can anyone help me pls.
Manu.Hi Manu,
Herewith a code example... This would disable the close button on the Sales Order window (and only the first window)
Dim oform As SAPbouiCOM.Form
<i>'loop through all the forms here if you need</i>
<i>'i am using "-FormType" here as the UDF window has the same UID as the normal form, but with negative sign</i>
oform = oApplication.Forms.GetForm("-139", 0)
Dim oItem As SAPbouiCOM.Item
<i>'Close button is 4</i>
oItem = oform.Items.Item("4")
<i>'Disable button</i>
oItem.Enabled = False
Hope it helps,
Adele -
How to disable close button during runtime
Hi everybody.,
Please help me how to disable the close button at top of the window during runtime. I dont want the user to use that button to close. I have used button called Exit in that form but sometimes users closing by clicking that button.
I am using Oracle form 10g R1.
Thanks in Advance,Hi,
Thanks Mr. Arif Khadas for your quick reply.
While running the form, in window there will be two close button, one is in form and another one is in Internet Explorer. By making changes on the property what you said above this will hide only the form's close button. I want to hide the internet explorer close button also.
Thanks in advance. -
Disable "Close" button of command prompt through LabVIEW using Win32 APIs
Hello all,
I am trying to disable the close button of a third party console application that I am invoking through LabVIEW. I tried using GetSystemMenu() and DeleteSystemMenu() from user32.dll, but somewhere I am doing it wrong.
Can anyone can suggest a solution to this?
Thanks!
FraggerFox
-FraggerFox!
Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
Solved!
Go to Solution.Do you have the handle to Window? Off hand, I don't know how to delete it, but here is some C# code that I used to grey out the close window button in another project:
[DllImport("user32.dll")]
private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
[DllImport("user32.dll")]
private static extern bool EnableMenuItem(IntPtr hMenu, uint uIDEnableItem,
uint uEnable);
private const Int32 SC_CLOSE = 0xF060;
private const UInt32 MF_BYCOMMAND =0x00000000;
private const UInt32 MF_ENABLED = 0x00000000;
private const UInt32 MF_GRAYED = 0x00000001;
private const UInt32 MF_DISABLED = 0x00000002;
private void EnableClose(bool enable)
IntPtr pSysMenu = GetSystemMenu(Handle, false);
if (pSysMenu != null)
EnableMenuItem(pSysMenu, SC_CLOSE, MF_BYCOMMAND | (enable ? MF_ENABLED : MF_DISABLED));
This was fairly easy to convert over once I had the handle (this is from a library I picked up somewhere).
Hope this helps.
A
Attachments:
WINUTIL.LLB 609 KB
DisableCloseButton.vi 44 KB -
Hiding FPM "Close" button in Portal/NWBC
Hello,
First some background, when you launch a WDA FPM application in the portal on of the standard buttons that it shows is the "Close" button. This button allows for the closing of the current browser window, When the FPM application is displayed inplace in the portal, this sort of behaviour is not very useful!
There was a thread : Re: Disable 'Close' button in Standard billing FPM Application in which Thomas Jung gave a detailed explanation of why this button was appearing and a very good suggestion on how to stop it.
I understand how I can hide this button - albeit a long winded process when the element is not available for personalisation unless you launch the application from NWBC or a portal (and with our dev portal not by default pointing to our configuration master client...) sigh...
I also understand that the WDA application is completely unaware that it is in an external portal window, or displayed inplace in the portal (although if it calls a new portal URL it can specify whether it should be displayed inplace or external).
What I don't understand is why this is the case - The portal has an API - Class AbstractNavigationConnectorNode method getShowType which returns whether the window is external or inplace, surely the WDA handler for the portal could query this and expose it to the WDA frameworkn through the interface IF_WD_PORTAL_INTEGRATION. Then it would be simple to hide the close button for inplace windows and show it for external windows.
Given that the portal allows users to launch whichever pages they want externally (although I tend to always turn off this option) it is very hard (i.e. not possible) for us to know for sure if the application will be launched inplace or externally - so "hard coding" the visibility of the close button by personalising the application is not a great solution.
WDJ is aware of the inplace/external nature of the portal window that it is running in and applications do code to support this. It seems to me an omission that WDA does not have this same level or knowledge of the portal environment that it is running in.
Are there any plans to extend the IF_WD_PORTAL_INTEGRATION interface to support this? Or are WDA applications destined to a less informed life than their WDJ cousins.
Sorry for the rant like nature of this post - but I hope that someone from SAP might be able to help me understand this problem.
Cheers,
ChrisHi Chris,
Sorry about the late reaction. I think that is because of the nature of the question and the person who is asking. You are one of the expert people who are in SDN to help people. If you ask such questions then it is mostly stay not answered :).
I have encountered this problem earlier this year and also we have had several emails between Thomas Jung. We are not coming further than to follow Thomas suggestion to Disable the close button in Portal.
regards
Senthivel -
How to restrict closing the tab in tabpane after clicking the close button.
Hi all,
Greetings.
I am implementing a TabPane with different 'user form's in each Tab. And all the tabs are *'closable'*.
If the user enters some data in the form, and tries to close the tab without saving the form , i need to show a confirm dialogue box that the user should go ahead or not.
If he clicks cancel, the tab should not close.
But currently i am searching for a method something like 'setOnClosing' method for tab.
There is only tab.setOnClosed() method, which will call the event after closing the tab.
Some thing the code is like below.
tab.setOnClosed(new EventHandler<javafx.event.Event>() {
@Override
public void handle(javafx.event.Event e) {
// TODO: Actions to be taken on close of tab.
// Logic to show the confirm dialouge box.
// if YES - close the tab
// if NO - don't close the tab.
});But my logic is executing after closing the tab. (ofcourse, as it is on setOnClosed() ;) ). Can anyone tell me how to get control before closing the tab ?
Thanks in Advance.
Sai Pradeep Dandem.Hi All,
Finally I managed to get the handler before closing the tab pane. :)
Though this is a bit weird work around, my requirement is fulfilled at-least.
Let me explain the workaround I did.
Tab tab = new Tab(title);
tab.setClosable(false); // This line of code makes sure that the “default” close button of the tab is not appeared.
setClosableButton(tab);Then I am setting the custom close button as a graphic to the label ( Title of the tab), and aligning that graphic position to make an effect, that it is rendered exactly at the position of “Close” button.
From this Custom Close Button, I am handling the events and if confirmed I am closing the tab manually, by calling the closeTab() method in the TabPaneBehavior class.
Below is the code that is implemented as per the above logic.
* Method to set the custom Closable Button to the given tab.
* @param tab - Tab
private void setClosableButton(final Tab tab,final boolean closeCheck){
final StackPane closeBtn = new StackPane(){
@Override
protected void layoutChildren() {
super.layoutChildren();
// Setting the orientation of graphic(button) to the right side.
((Label)((LabelSkin)getParent()).getSkinnable()).setStyle("-fx-content-display:right;");
closeBtn.getStyleClass().setAll(new String[] { "tab-close-button" });
closeBtn.setStyle("-fx-cursor:hand;");
closeBtn.setPadding(new Insets(0,7,0,7));
closeBtn.visibleProperty().bind(tab.selectedProperty());
final EventHandler<ActionEvent> closeEvent = new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent paramT) {
((TabPaneSkin)TabPaneComponent.this.getSkin()).getBehavior().closeTab(tab);
// Handler for the close button.
closeBtn.setOnMouseReleased(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent paramT) {
// My logic to handle the close event or not.
if( logic satisfied){
closeEvent.handle(null);
}else{
// Dont close the tab.
// Showing the close button if the tab is selected.
tab.selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> paramObservableValue,Boolean paramT1, Boolean isSelected) {
if(isSelected){
tab.setGraphic(closeBtn);
}else{
tab.setGraphic(null);
}There are some drawbacks in the above code. In practice, it is suggested not to use the classes (*LabelSkin* & TabPaneSkin) that are in com.sun.javafx package. But I couldn’t get a better solution other than using those classes. And another one is I could'nt set the actual graphic for tab, as i am already using that graphic property to show the close button.
I would like to thank Narayan, for giving some inputs which has helped me to think and get the above solution. :)
Maybe you are looking for
-
It's almost new, but I can't get all features of iOS 6
-
Third Party Processing in SRM 4.0
Hi, We are working on Third Party Processing in SRM4.0 & SAP R/3 4.7. We were able to transfer the Third party Requisition from Backend R/3 to SRM 4.0 Sourcing Cockpit as an External Requirement. When we try to process the Third Party External Requir
-
Changing Default Font in Acrobat 7 and/or Acrobat Reader 9
Anyone know how to change the Default Font in Acrobat 7 and/or Acrobat Reader 9? Whenever I open a PDF document the text defaults to a Times New Roman or basic font. Can we change the default font?
-
11.5.10: RETROACTIVE PRICING이 WORKFLOW를 통해 수행되지 않을 경우 처리 방법
제품 : MFG_PO 작성날짜 : 2006-05-30 11.5.10: RETROACTIVE PRICING이 WORKFLOW를 통해 수행되지 않을 경우 처리 방법 =========================================================== PURPOSE 11.5.10: Retroactive Pricing이 workflow form을 통해 수행되지 않을 경우 처리 방법을 기술하고자 합니다. Problem Descrip
-
WSREG-v3.0 This log file is reporting activity on a WM_SERVICE_START_EVENT event. WSREG-v3.0 While contacting the Work Station Import Service, an error -1 was encountered, and error description <Winsock gethostbyname() failed.> was reported. WSREG-v3