CLOSE icon

hello,
i have a problem with event KEY-EXIT
this event doesn't include the CLOSE icon (right top of all windows)
and users can exit without execute the code in KEY-EXIT event
in fact KEY-EXIT is trigger only by the icon exit in the tool bar
How can I trigger my code on system CLOSE icon????
Thanks for your help
@Rosagio
I work under designer 9i who generate forms 9i

KEY-EXIT triggers fires only when the "Key" associated with the trigger is pressed or DO_KEY('EXIT_FORM') is executed.
You can use the WHEN-WINDOW-CLOSED trigger on your window and after you finish the standard processing you have (or not) issue a DO_KEY('EXIT_FORM'); this will simulate the EXIT key bein pressed.
Tony

Similar Messages

  • How to handle the "cancel" button and "close" icon of a popup ?

    Hi,
    I have a popup with "cancel button" and "close icon"(on the top right corner of the popup), I want the same operations to be performed on clicking of any of these two components.
    Is there a way to handle such situation ?
    I read about 2 cases to look into this but they didn't work too well for me.
    1. I read about the "popcancellistener" but that listener is called whenever the popup closes, so suppose I have an "ok button" on the popup to create a record, after the record is created, the popup closes and goes into the "popcancellistener", now the question is "how do we know if it came there because of the 'ok button' or 'some other event'".
    2. I even checked the "DialogListener", now I'm able to distinguish between the 'OK' and 'CANCEL' button in the dialoglistener using the "Dialog.Outcome.ok/cancel", but when a user clicks on the close icon, we do not enter the "DialogListener" at all, so in this case "how do we handle the close icon click event"
    Do let me know if you need any more information from my side.
    Thanks for the help in advance.

    The following mechanism responds to any of the following events: <Esc> key, Close icon ('x'), Cancel button
    JavaScript part:
    function popupClosedListener(event){
                  var source = event.getSource();
                  var popupId = source.getClientId();
                  var params = {};
                  params['popupId'] = popupId;
                  var type = "serverPopupClosed";
                  var immediate = true;
                  AdfCustomEvent.queue(source, type, params, immediate);
    }JSF part:
             <af:popup ....>
                  <af:clientListener method="popupClosedListener"
                                           type="popupClosed"/>
                  <af:serverListener type="serverPopupClosed"
                                          method="#{myBean.serverPopupClosedMetod}"/>
            </af:popup>Finally, Java part:
    public void serverPopupClosedMetod(ClientEvent event){
    }

  • Disable close icon on title bar

    Is it possible to disable the close icon on the title bar (right hand corner) in a swing window?
    Fai.

    Example:
    frameNameHere.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    There is also the option to take away the "window-frame" alltogether with:
    frameNameHere.setUndecorated(true);
    Though if you do that you should probably use the "DO_NOTHING_ON_CLOSE" anyway, since otherwise it can still be closed with Alt F4 for instance.

  • Help with disabling close icon of last opened tab in JTabbedPane

    Hello
    Would someone help me out ? I have 3 tabs opened in a JTabbedPane, each with close icon "X". I am looking for a way to tell my program: if the user closes 2 tabs and only 1 remain, disable the close icon "X" of the last opened tab so that the user is unable to close the last tab. I have searched the forum, most I have run into are how to create the close icon. Would someone give me some insight into how to go about doing this? or if you have come across a forum that discusses this, do please post the link. Also, I am using java 1.6.
    Thanks very much in advance

    On each close, look how many tabs are remaining open in the JTabbedPane (getTabCount).
    If there is only one left, set its close button to invisible. Something like this:
    if (pane.getTabCount() == 1) {
        TabCloseButton tcb = (TabCloseButton) pane.getTabComponentAt(0);
        tcb.getBtClose().setVisible(false);
    }

  • JTabbedPane with close Icons

    Ok, so I was trying to get a JTabbedPane with 'X' icons on each tab. Searched this site, and found no answers, but loads of questions on how to do it. I've done it now, and here's my code.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    * A JTabbedPane which has a close ('X') icon on each tab.
    * To add a tab, use the method addTab(String, Component)
    * To have an extra icon on each tab (e.g. like in JBuilder, showing the file type) use
    * the method addTab(String, Component, Icon). Only clicking the 'X' closes the tab.
    public class JTabbedPaneWithCloseIcons extends JTabbedPane implements MouseListener {
      public JTabbedPaneWithCloseIcons() {
        super();
        addMouseListener(this);
      public void addTab(String title, Component component) {
        this.addTab(title, component, null);
      public void addTab(String title, Component component, Icon extraIcon) {
        super.addTab(title, new CloseTabIcon(extraIcon), component);
      public void mouseClicked(MouseEvent e) {
        int tabNumber=getUI().tabForCoordinate(this, e.getX(), e.getY());
        if (tabNumber < 0) return;
        Rectangle rect=((CloseTabIcon)getIconAt(tabNumber)).getBounds();
        if (rect.contains(e.getX(), e.getY())) {
          //the tab is being closed
          this.removeTabAt(tabNumber);
      public void mouseEntered(MouseEvent e) {}
      public void mouseExited(MouseEvent e) {}
      public void mousePressed(MouseEvent e) {}
      public void mouseReleased(MouseEvent e) {}
    * The class which generates the 'X' icon for the tabs. The constructor
    * accepts an icon which is extra to the 'X' icon, so you can have tabs
    * like in JBuilder. This value is null if no extra icon is required.
    class CloseTabIcon implements Icon {
      private int x_pos;
      private int y_pos;
      private int width;
      private int height;
      private Icon fileIcon;
      public CloseTabIcon(Icon fileIcon) {
        this.fileIcon=fileIcon;
        width=16;
        height=16;
      public void paintIcon(Component c, Graphics g, int x, int y) {
        this.x_pos=x;
        this.y_pos=y;
        Color col=g.getColor();
        g.setColor(Color.black);
        int y_p=y+2;
        g.drawLine(x+1, y_p, x+12, y_p);
        g.drawLine(x+1, y_p+13, x+12, y_p+13);
        g.drawLine(x, y_p+1, x, y_p+12);
        g.drawLine(x+13, y_p+1, x+13, y_p+12);
        g.drawLine(x+3, y_p+3, x+10, y_p+10);
        g.drawLine(x+3, y_p+4, x+9, y_p+10);
        g.drawLine(x+4, y_p+3, x+10, y_p+9);
        g.drawLine(x+10, y_p+3, x+3, y_p+10);
        g.drawLine(x+10, y_p+4, x+4, y_p+10);
        g.drawLine(x+9, y_p+3, x+3, y_p+9);
        g.setColor(col);
        if (fileIcon != null) {
          fileIcon.paintIcon(c, g, x+width, y_p);
      public int getIconWidth() {
        return width + (fileIcon != null? fileIcon.getIconWidth() : 0);
      public int getIconHeight() {
        return height;
      public Rectangle getBounds() {
        return new Rectangle(x_pos, y_pos, width, height);
    }You can also specify an extra icon to put on each tab. Read my comments on how to do it.

    With the following code you'll be able to have use SCROLL_TAB_LAYOUT and WRAP_TAB_LAYOUT. With setCloseIcons() you'll be able to set images for the close-icons.
    The TabbedPane:
    import javax.swing.Icon;
    import javax.swing.JComponent;
    import javax.swing.JTabbedPane;
    import javax.swing.JViewport;
    import javax.swing.SwingUtilities;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.FontMetrics;
    import java.awt.Graphics;
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import javax.swing.event.EventListenerList;
    import javax.swing.plaf.basic.BasicTabbedPaneUI;
    import javax.swing.plaf.metal.MetalTabbedPaneUI;
    * A JTabbedPane which has a close ('X') icon on each tab.
    * To add a tab, use the method addTab(String, Component)
    * To have an extra icon on each tab (e.g. like in JBuilder, showing the file
    * type) use the method addTab(String, Component, Icon). Only clicking the 'X'
    * closes the tab.
    public class CloseableTabbedPane extends JTabbedPane implements MouseListener,
      MouseMotionListener {
       * The <code>EventListenerList</code>.
      private EventListenerList listenerList = null;
       * The viewport of the scrolled tabs.
      private JViewport headerViewport = null;
       * The normal closeicon.
      private Icon normalCloseIcon = null;
       * The closeicon when the mouse is over.
      private Icon hooverCloseIcon = null;
       * The closeicon when the mouse is pressed.
      private Icon pressedCloseIcon = null;
       * Creates a new instance of <code>CloseableTabbedPane</code>
      public CloseableTabbedPane() {
        super();
        init(SwingUtilities.LEFT);
       * Creates a new instance of <code>CloseableTabbedPane</code>
       * @param horizontalTextPosition the horizontal position of the text (e.g.
       * SwingUtilities.TRAILING or SwingUtilities.LEFT)
      public CloseableTabbedPane(int horizontalTextPosition) {
        super();
        init(horizontalTextPosition);
       * Initializes the <code>CloseableTabbedPane</code>
       * @param horizontalTextPosition the horizontal position of the text (e.g.
       * SwingUtilities.TRAILING or SwingUtilities.LEFT)
      private void init(int horizontalTextPosition) {
        listenerList = new EventListenerList();
        addMouseListener(this);
        addMouseMotionListener(this);
        if (getUI() instanceof MetalTabbedPaneUI)
          setUI(new CloseableMetalTabbedPaneUI(horizontalTextPosition));
        else
          setUI(new CloseableTabbedPaneUI(horizontalTextPosition));
       * Allows setting own closeicons.
       * @param normal the normal closeicon
       * @param hoover the closeicon when the mouse is over
       * @param pressed the closeicon when the mouse is pressed
      public void setCloseIcons(Icon normal, Icon hoover, Icon pressed) {
        normalCloseIcon = normal;
        hooverCloseIcon = hoover;
        pressedCloseIcon = pressed;
       * Adds a <code>Component</code> represented by a title and no icon.
       * @param title the title to be displayed in this tab
       * @param component the component to be displayed when this tab is clicked
      public void addTab(String title, Component component) {
        addTab(title, component, null);
       * Adds a <code>Component</code> represented by a title and an icon.
       * @param title the title to be displayed in this tab
       * @param component the component to be displayed when this tab is clicked
       * @param extraIcon the icon to be displayed in this tab
      public void addTab(String title, Component component, Icon extraIcon) {
        boolean doPaintCloseIcon = true;
        try {
          Object prop = null;
          if ((prop = ((JComponent) component).
                        getClientProperty("isClosable")) != null) {
            doPaintCloseIcon = (Boolean) prop;
        } catch (Exception ignored) {/*Could probably be a ClassCastException*/}
        super.addTab(title,
                     doPaintCloseIcon ? new CloseTabIcon(extraIcon) : null,
                     component);
        if (headerViewport == null) {
          for (Component c : getComponents()) {
            if ("TabbedPane.scrollableViewport".equals(c.getName()))
              headerViewport = (JViewport) c;
       * Invoked when the mouse button has been clicked (pressed and released) on
       * a component.
       * @param e the <code>MouseEvent</code>
      public void mouseClicked(MouseEvent e) {
        processMouseEvents(e);
       * Invoked when the mouse enters a component.
       * @param e the <code>MouseEvent</code>
      public void mouseEntered(MouseEvent e) { }
       * Invoked when the mouse exits a component.
       * @param e the <code>MouseEvent</code>
      public void mouseExited(MouseEvent e) {
        for (int i=0; i<getTabCount(); i++) {
          CloseTabIcon icon = (CloseTabIcon) getIconAt(i);
          if (icon != null)
            icon.mouseover = false;
        repaint();
       * Invoked when a mouse button has been pressed on a component.
       * @param e the <code>MouseEvent</code>
      public void mousePressed(MouseEvent e) {
        processMouseEvents(e);
       * Invoked when a mouse button has been released on a component.
       * @param e the <code>MouseEvent</code>
      public void mouseReleased(MouseEvent e) { }
       * Invoked when a mouse button is pressed on a component and then dragged.
       * <code>MOUSE_DRAGGED</code> events will continue to be delivered to the
       * component where the drag originated until the mouse button is released
       * (regardless of whether the mouse position is within the bounds of the
       * component).<br/>
       * <br/>
       * Due to platform-dependent Drag&Drop implementations,
       * <code>MOUSE_DRAGGED</code> events may not be delivered during a native
       * Drag&Drop operation.
       * @param e the <code>MouseEvent</code>
      public void mouseDragged(MouseEvent e) {
        processMouseEvents(e);
       * Invoked when the mouse cursor has been moved onto a component but no
       * buttons have been pushed.
       * @param e the <code>MouseEvent</code>
      public void mouseMoved(MouseEvent e) {
        processMouseEvents(e);
       * Processes all caught <code>MouseEvent</code>s.
       * @param e the <code>MouseEvent</code>
      private void processMouseEvents(MouseEvent e) {
        int tabNumber = getUI().tabForCoordinate(this, e.getX(), e.getY());
        if (tabNumber < 0) return;
        CloseTabIcon icon = (CloseTabIcon) getIconAt(tabNumber);
        if (icon != null) {
          Rectangle rect= icon.getBounds();
          Point pos = headerViewport == null ?
                      new Point() : headerViewport.getViewPosition();
          Rectangle drawRect = new Rectangle(
            rect.x - pos.x, rect.y - pos.y, rect.width, rect.height);
          if (e.getID() == e.MOUSE_PRESSED) {
            icon.mousepressed = e.getModifiers() == e.BUTTON1_MASK;
            repaint(drawRect);
          } else if (e.getID() == e.MOUSE_MOVED || e.getID() == e.MOUSE_DRAGGED ||
                     e.getID() == e.MOUSE_CLICKED) {
            pos.x += e.getX();
            pos.y += e.getY();
            if (rect.contains(pos)) {
              if (e.getID() == e.MOUSE_CLICKED) {
                int selIndex = getSelectedIndex();
                if (fireCloseTab(selIndex)) {
                  if (selIndex > 0) {
                    // to prevent uncatchable null-pointers
                    Rectangle rec = getUI().getTabBounds(this, selIndex - 1);
                    MouseEvent event = new MouseEvent((Component) e.getSource(),
                                                      e.getID() + 1,
                                                      System.currentTimeMillis(),
                                                      e.getModifiers(),
                                                      rec.x,
                                                      rec.y,
                                                      e.getClickCount(),
                                                      e.isPopupTrigger(),
                                                      e.getButton());
                    dispatchEvent(event);
                  //the tab is being closed
                  //removeTabAt(tabNumber);
                  remove(selIndex);
                } else {
                  icon.mouseover = false;
                  icon.mousepressed = false;
                  repaint(drawRect);
              } else {
                icon.mouseover = true;
                icon.mousepressed = e.getModifiers() == e.BUTTON1_MASK;
            } else {
              icon.mouseover = false;
            repaint(drawRect);
       * Adds an <code>CloseableTabbedPaneListener</code> to the tabbedpane.
       * @param l the <code>CloseableTabbedPaneListener</code> to be added
      public void addCloseableTabbedPaneListener(CloseableTabbedPaneListener l) {
        listenerList.add(CloseableTabbedPaneListener.class, l);
       * Removes an <code>CloseableTabbedPaneListener</code> from the tabbedpane.
       * @param l the listener to be removed
      public void removeCloseableTabbedPaneListener(CloseableTabbedPaneListener l) {
        listenerList.remove(CloseableTabbedPaneListener.class, l);
       * Returns an array of all the <code>SearchListener</code>s added to this
       * <code>SearchPane</code> with addSearchListener().
       * @return all of the <code>SearchListener</code>s added or an empty array if
       * no listeners have been added
      public CloseableTabbedPaneListener[] getCloseableTabbedPaneListener() {
        return listenerList.getListeners(CloseableTabbedPaneListener.class);
       * Notifies all listeners that have registered interest for notification on
       * this event type.
       * @param tabIndexToClose the index of the tab which should be closed
       * @return true if the tab can be closed, false otherwise
      protected boolean fireCloseTab(int tabIndexToClose) {
        boolean closeit = true;
        // Guaranteed to return a non-null array
        Object[] listeners = listenerList.getListenerList();
        for (Object i : listeners) {
          if (i instanceof CloseableTabbedPaneListener) {
            if (!((CloseableTabbedPaneListener) i).closeTab(tabIndexToClose)) {
              closeit = false;
              break;
        return closeit;
       * The class which generates the 'X' icon for the tabs. The constructor
       * accepts an icon which is extra to the 'X' icon, so you can have tabs
       * like in JBuilder. This value is null if no extra icon is required.
      class CloseTabIcon implements Icon {
         * the x position of the icon
        private int x_pos;
         * the y position of the icon
        private int y_pos;
         * the width the icon
        private int width;
         * the height the icon
        private int height;
         * the additional fileicon
        private Icon fileIcon;
         * true whether the mouse is over this icon, false otherwise
        private boolean mouseover = false;
         * true whether the mouse is pressed on this icon, false otherwise
        private boolean mousepressed = false;
         * Creates a new instance of <code>CloseTabIcon</code>
         * @param fileIcon the additional fileicon, if there is one set
        public CloseTabIcon(Icon fileIcon) {
          this.fileIcon = fileIcon;
          width  = 16;
          height = 16;
         * Draw the icon at the specified location. Icon implementations may use the
         * Component argument to get properties useful for painting, e.g. the
         * foreground or background color.
         * @param c the component which the icon belongs to
         * @param g the graphic object to draw on
         * @param x the upper left point of the icon in the x direction
         * @param y the upper left point of the icon in the y direction
        public void paintIcon(Component c, Graphics g, int x, int y) {
          boolean doPaintCloseIcon = true;
          try {
            // JComponent.putClientProperty("isClosable", new Boolean(false));
            JTabbedPane tabbedpane = (JTabbedPane) c;
            int tabNumber = tabbedpane.getUI().tabForCoordinate(tabbedpane, x, y);
            JComponent curPanel = (JComponent) tabbedpane.getComponentAt(tabNumber);
            Object prop = null;
            if ((prop = curPanel.getClientProperty("isClosable")) != null) {
              doPaintCloseIcon = (Boolean) prop;
          } catch (Exception ignored) {/*Could probably be a ClassCastException*/}
          if (doPaintCloseIcon) {
            x_pos = x;
            y_pos = y;
            int y_p = y + 1;
            if (normalCloseIcon != null && !mouseover) {
              normalCloseIcon.paintIcon(c, g, x, y_p);
            } else if (hooverCloseIcon != null && mouseover && !mousepressed) {
              hooverCloseIcon.paintIcon(c, g, x, y_p);
            } else if (pressedCloseIcon != null && mousepressed) {
              pressedCloseIcon.paintIcon(c, g, x, y_p);
            } else {
              y_p++;
              Color col = g.getColor();
              if (mousepressed && mouseover) {
                g.setColor(Color.WHITE);
                g.fillRect(x+1, y_p, 12, 13);
              g.setColor(Color.black);
              g.drawLine(x+1, y_p, x+12, y_p);
              g.drawLine(x+1, y_p+13, x+12, y_p+13);
              g.drawLine(x, y_p+1, x, y_p+12);
              g.drawLine(x+13, y_p+1, x+13, y_p+12);
              g.drawLine(x+3, y_p+3, x+10, y_p+10);
              if (mouseover)
                g.setColor(Color.GRAY);
              g.drawLine(x+3, y_p+4, x+9, y_p+10);
              g.drawLine(x+4, y_p+3, x+10, y_p+9);
              g.drawLine(x+10, y_p+3, x+3, y_p+10);
              g.drawLine(x+10, y_p+4, x+4, y_p+10);
              g.drawLine(x+9, y_p+3, x+3, y_p+9);
              g.setColor(col);
              if (fileIcon != null) {
                fileIcon.paintIcon(c, g, x+width, y_p);
         * Returns the icon's width.
         * @return an int specifying the fixed width of the icon.
        public int getIconWidth() {
          return width + (fileIcon != null ? fileIcon.getIconWidth() : 0);
         * Returns the icon's height.
         * @return an int specifying the fixed height of the icon.
        public int getIconHeight() {
          return height;
         * Gets the bounds of this icon in the form of a <code>Rectangle<code>
         * object. The bounds specify this icon's width, height, and location
         * relative to its parent.
         * @return a rectangle indicating this icon's bounds
        public Rectangle getBounds() {
          return new Rectangle(x_pos, y_pos, width, height);
       * A specific <code>BasicTabbedPaneUI</code>.
      class CloseableTabbedPaneUI extends BasicTabbedPaneUI {
        * the horizontal position of the text
        private int horizontalTextPosition = SwingUtilities.LEFT;
         * Creates a new instance of <code>CloseableTabbedPaneUI</code>
        public CloseableTabbedPaneUI() {
         * Creates a new instance of <code>CloseableTabbedPaneUI</code>
         * @param horizontalTextPosition the horizontal position of the text (e.g.
         * SwingUtilities.TRAILING or SwingUtilities.LEFT)
        public CloseableTabbedPaneUI(int horizontalTextPosition) {
          this.horizontalTextPosition = horizontalTextPosition;
         * Layouts the label
         * @param tabPlacement the placement of the tabs
         * @param metrics the font metrics
         * @param tabIndex the index of the tab
         * @param title the title of the tab
         * @param icon the icon of the tab
         * @param tabRect the tab boundaries
         * @param iconRect the icon boundaries
         * @param textRect the text boundaries
         * @param isSelected true whether the tab is selected, false otherwise
        protected void layoutLabel(int tabPlacement, FontMetrics metrics,
                                   int tabIndex, String title, Icon icon,
                                   Rectangle tabRect, Rectangle iconRect,
                                   Rectangle textRect, boolean isSelected) {
          textRect.x = textRect.y = iconRect.x = iconRect.y = 0;
          javax.swing.text.View v = getTextViewForTab(tabIndex);
          if (v != null) {
            tabPane.putClientProperty("html", v);
          SwingUtilities.layoutCompoundLabel((JComponent) tabPane,
                                             metrics, title, icon,
                                             SwingUtilities.CENTER,
                                             SwingUtilities.CENTER,
                                             SwingUtilities.CENTER,
                                             //SwingUtilities.TRAILING,
                                             horizontalTextPosition,
                                             tabRect,
                                             iconRect,
                                             textRect,
                                             textIconGap + 2);
          tabPane.putClientProperty("html", null);
          int xNudge = getTabLabelShiftX(tabPlacement, tabIndex, isSelected);
          int yNudge = getTabLabelShiftY(tabPlacement, tabIndex, isSelected);
          iconRect.x += xNudge;
          iconRect.y += yNudge;
          textRect.x += xNudge;
          textRect.y += yNudge;
       * A specific <code>MetalTabbedPaneUI</code>.
      class CloseableMetalTabbedPaneUI extends MetalTabbedPaneUI {
        * the horizontal position of the text
        private int horizontalTextPosition = SwingUtilities.LEFT;
         * Creates a new instance of <code>CloseableMetalTabbedPaneUI</code>
        public CloseableMetalTabbedPaneUI() {
         * Creates a new instance of <code>CloseableMetalTabbedPaneUI</code>
         * @param horizontalTextPosition the horizontal position of the text (e.g.
         * SwingUtilities.TRAILING or SwingUtilities.LEFT)
        public CloseableMetalTabbedPaneUI(int horizontalTextPosition) {
          this.horizontalTextPosition = horizontalTextPosition;
         * Layouts the label
         * @param tabPlacement the placement of the tabs
         * @param metrics the font metrics
         * @param tabIndex the index of the tab
         * @param title the title of the tab
         * @param icon the icon of the tab
         * @param tabRect the tab boundaries
         * @param iconRect the icon boundaries
         * @param textRect the text boundaries
         * @param isSelected true whether the tab is selected, false otherwise
        protected void layoutLabel(int tabPlacement, FontMetrics metrics,
                                   int tabIndex, String title, Icon icon,
                                   Rectangle tabRect, Rectangle iconRect,
                                   Rectangle textRect, boolean isSelected) {
          textRect.x = textRect.y = iconRect.x = iconRect.y = 0;
          javax.swing.text.View v = getTextViewForTab(tabIndex);
          if (v != null) {
            tabPane.putClientProperty("html", v);
          SwingUtilities.layoutCompoundLabel((JComponent) tabPane,
                                             metrics, title, icon,
                                             SwingUtilities.CENTER,
                                             SwingUtilities.CENTER,
                                             SwingUtilities.CENTER,
                                             //SwingUtilities.TRAILING,
                                             horizontalTextPosition,
                                             tabRect,
                                             iconRect,
                                             textRect,
                                             textIconGap + 2);
          tabPane.putClientProperty("html", null);
          int xNudge = getTabLabelShiftX(tabPlacement, tabIndex, isSelected);
          int yNudge = getTabLabelShiftY(tabPlacement, tabIndex, isSelected);
          iconRect.x += xNudge;
          iconRect.y += yNudge;
          textRect.x += xNudge;
          textRect.y += yNudge;
    }The Listener:
    import java.util.EventListener;
    * The listener that's notified when an tab should be closed in the
    * <code>CloseableTabbedPane</code>.
    public interface CloseableTabbedPaneListener extends EventListener {
       * Informs all <code>CloseableTabbedPaneListener</code>s when a tab should be
       * closed
       * @param tabIndexToClose the index of the tab which should be closed
       * @return true if the tab can be closed, false otherwise
      boolean closeTab(int tabIndexToClose);
    }

  • Inline popup - close icon null pointer issue

    Hi all,
    I have a taskflow which is opened as inline popup dialog. Taskflow is in pageFlowScope.
    The popup has OK, Cancel. On click of OK and Cancel of dialog it returns a value.
    However when I click on Close icon "x" of dialog and return to the calling parent window and try to get the any iterator from the binding container, the iterators are all null.
    I am missing something in my configuration.
    Thanks
    Ajay

    Hi,
    actually clicking teh 'x' does nothing than closing the dialog.
    However when I click on Close icon "x" of dialog and return to the calling parent window and try to get the any iterator from the binding container, the iterators are all null.
    What is the code you use and where and when do you call this code ? And what JDeveloper version are you working with ?
    Frank

  • JTabbed Pane close icon help

    Hi
    I am trying to create a close icon on my JTabbedPane tabs, so i wrote an closeiconTab class extedning Icon and implements MouseListener, whenever a click is observered, i kill the a tab.
    But this method gives me an arrayoutofbound exception error, after debuggin, i realize my implemention goes against the single thread rule for swings. Anyone know a way around this ???
    I've tried this
        public void mouseClicked( MouseEvent e )
            if( _bounds.contains( e.getX(), e.getY() ) )
                 SwingUtilities.invokeLater(new Runnable() {
                     public void run() {
                          _parentTabbedPane.remove( _tabbedComponent );
        }but it still doesnt work

    does the mouse click call the listener? If so, just call the remove method without the SwingUtilities method part.

  • Close icon display for a Tab(ShowdetailItem)

    Hi,
    I am using the PanelTab with multiple ShowDetailItems. I am giving the close icon provision for the showdetail item. But the close icon is coming only in mouse over.
    I need to display the close always(ShowDetailItem).
    Reg,
    Brahma B

    There is a tutorial for JScrollPane:
    http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html
    It came to my mind that JSplitPane is not using JScrollPane for the two components you add. So perhaps the solution would be to "wrap" both your components to their own JScrollPane before you add them to the split pane.
    Then for those scroll panes I would probably use:
    JScrollPane.setColumnHeaderView(myXCloseButtonInAPanel)
    or
    JScrollPane.setCorner(upperRightCorner, myXCloseButton)
    I don't know if that will work, or how it will look like now that you use the scroll pane's scrollbars instead of the split pane's scroll bar. You have to experiment with it. The scroll pane's should be able to resize themself to fit in the split panes areas when you move the divider, and maybe that's not so easy to do. Otherwise you will end up with both a scrollbar from the split pane and a scroll bar from the scroll pane.. yuck.
    Maybe someone else has a better solution?

  • JTree- Seperate ToolTipText for open and close icon

    Hi,
    I want seperate tooltiptext for open and close icon.
    for Open icon, it has to be "click to view subprocesses"
    for close icon, it will be " click to vie process"
    Thanks in advance
    Pankaj

    Use a customized TreeCellRenderer:
        class Renderer extends DefaultTreeCellRenderer {
            public Component getTreeCellRendererComponent(JTree tree,
                                                          Object value,
                                                          boolean sel,
                                                          boolean expanded,
                                                          boolean leaf,
                                                          int row,
                                                          boolean hasFocus) {
                super.getTreeCellRendererComponent(
                                tree, value, sel, expanded, leaf, row, hasFocus);
                setToolTipText(expanded ? "Click to view subprocesses" : "Click to view process");
                return this;
        }

  • Application close icon ('X')

    Greetings all,
    I am new to this forum and relatively new to Java.
    I would like to bind a member function to the application close icon (The 'X' in the upper right hand corner of the applications main window).
    Does anyone know how to do this?
    Thanks.
    JavaRob

    I would like to bind a member function to the
    application close icon (The 'X' in the upper right
    hand corner of the applications main window).
    Does anyone know how to do this?Create a WindowAdapter and override the windowClosing event to call the method you want. Then do
    Window w = ...
    w.addWindowListener(myListener);

  • Setting Close icon (X) for a container

    Hi,
    I just want to know whether it is possible to set close icon (X) for a panel or any other component. Here close icon mean the one which we see on the top right cornet of a IE window.
    Thanks in advance.
    Sapna

    There is a tutorial for JScrollPane:
    http://java.sun.com/docs/books/tutorial/uiswing/components/scrollpane.html
    It came to my mind that JSplitPane is not using JScrollPane for the two components you add. So perhaps the solution would be to "wrap" both your components to their own JScrollPane before you add them to the split pane.
    Then for those scroll panes I would probably use:
    JScrollPane.setColumnHeaderView(myXCloseButtonInAPanel)
    or
    JScrollPane.setCorner(upperRightCorner, myXCloseButton)
    I don't know if that will work, or how it will look like now that you use the scroll pane's scrollbars instead of the split pane's scroll bar. You have to experiment with it. The scroll pane's should be able to resize themself to fit in the split panes areas when you move the divider, and maybe that's not so easy to do. Otherwise you will end up with both a scrollbar from the split pane and a scroll bar from the scroll pane.. yuck.
    Maybe someone else has a better solution?

  • X (Close) icon doesn't work

    hi,
    I have one problem now. I tried to make 'X' (Close) icon work (i.e. the dialog window should be closed whenever clicking 'X' icon). I use:
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    but it does not work. Anybody could help me solve this problem? Thanks a lot.
    Jrabi

    Well, it is a part of a large project.
    import javax.swing.*;
    import com.borland.jbcl.layout.*;
    import java.awt.*;
    import com.klg.jclass.field.*;
    import com.borland.dbswing.*;
    import java.awt.event.*;
    import java.util.*;
    public class CitrixAgent_Wiz extends WizardDialog implements SupportService {
    JPanel basePanel = new JPanel();
    WizardTopPanel topPanel = new WizardTopPanel();
    JPanel contentPanel = new JPanel();
    GridBagLayout gridBagLayout1 = new GridBagLayout();
    CardLayout cardLayout = new CardLayout();
    WizardButtonBar buttonBar = new WizardButtonBar(cardLayout, contentPanel, topPanel);
    JScrollPane jScrollPane3 = new JScrollPane();
    GridBagLayout gridBagLayout7 = new GridBagLayout();
    JTextArea finishLabel = new JTextArea();
    JTextArea finishList = new JTextArea();
    JPanel lastPanel = new JPanel();
    TerminalServicesEnvironmentPanel terminalServicesEnvironmentPanel1 = new TerminalServicesEnvironmentPanel();
    TerminalServicesRemoteControlPanel terminalServicesRemoteControlPanel1 = new TerminalServicesRemoteControlPanel();
    TerminalServicesSessionPanel terminalServicesSessionPanel1 = new TerminalServicesSessionPanel();
    private String[] availableDriveLetters = {"D:", "E:", "F:", "G:", "H:", "I:", "J:", "K:", "L:", "M:", "N:", "O:"};
    private String warning;
    private String warningMessage;
    private String advanced;
    private String defaultUserHomePath;
    private String defaultUserProfilePath;
    public CitrixAgent_Wiz() {
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    try{
    topPanel.setImage((ImageIcon)Global.imageResources.getDialogIcons().get("CitrixCompany"));
    advanced = Global.getString("WIZARD.TERMINAL.1.ADVANCED");
    warning = Global.getString("WIZARD.TERMINAL.1.WARNING");
    warningMessage = Global.getString("WIZARD.TERMINAL.1.WARNINGMESSAGE");
    catch(Exception e){
    System.out.println("Could not get icon " + e.toString());
    setSize(475, 450);
    String provision = Global.getString("WIZARD.COMMON.PROVISIONFOR");
    topPanel.setCreateLabel(provision);
    private void jbInit() throws Exception {
    this.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0); }
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    basePanel.setLayout(gridBagLayout1);
    contentPanel.setLayout(cardLayout);
    jScrollPane3.setBorder(BorderFactory.createLoweredBevelBorder());
    jScrollPane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    finishLabel.setLineWrap(true);
    finishLabel.setWrapStyleWord(true);
    finishLabel.setBackground(new Color(212,208,200));
    finishLabel.setEditable(false);
    finishLabel.setText(Global.getString("WIZARD.TERMINAL.4.FINISH"));
    finishList.setDoubleBuffered(true);
    finishList.setBackground(Color.lightGray);
    finishList.setEditable(false);
    terminalServicesRemoteControlPanel1.requireCheckBox.setSelected(true);
    lastPanel.setLayout(gridBagLayout7);
    this.getContentPane().add(basePanel, new PaneConstraints("jPanel1", "jPanel1", PaneConstraints.ROOT, 1.0f));
    basePanel.add(topPanel, new GridBagConstraints(0, 0, 1, 1, 100.0, 5.0
    ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    basePanel.add(contentPanel, new GridBagConstraints(0, 1, 1, 1, 100.0, 90.0
    ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    contentPanel.add(terminalServicesEnvironmentPanel1, "terminalServicesEnvironmentPanel1");
    contentPanel.add(terminalServicesRemoteControlPanel1, "terminalServicesRemoteControlPanel1");
    contentPanel.add(terminalServicesSessionPanel1, "terminalServicesSessionPanel1");
    contentPanel.add(lastPanel, "lastPanel");
    lastPanel.add(finishLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
    ,GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 10, 2, 10), 0, 0));
    lastPanel.add(jScrollPane3, new GridBagConstraints(0, 1, 1, 1, 100.0, 105.0
    ,GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 10, 0, 10), 0, 255));
    jScrollPane3.getViewport().add(finishList, null);
    basePanel.add(buttonBar, new GridBagConstraints(0, 2, 1, 1, 100.0, 5.0
    ,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    buttonBar.addToActionListener();
    buttonBar.reset();
    public boolean validatePage(){
    int page = buttonBar.getCurrentPanel();
    switch(page){
    case 1: return true;
    return true;
    public void prepareNextPage(){
    int nextPage = buttonBar.getCurrentPanel() + 1;
    if (nextPage == buttonBar.getNumberOfPanels()){
    String environmentResult = terminalServicesEnvironmentPanel1.getReport();
    String remoteResult = terminalServicesRemoteControlPanel1.getReport();
    String sessionResult = terminalServicesSessionPanel1.getReport();
    finishList.setText("" + environmentResult + "\n\n" + remoteResult + "\n" + sessionResult);
    finishList.select(1, 1);
    void jButton2_actionPerformed(ActionEvent e) {
    DirectoryChooser chooser = new DirectoryChooser();
    chooser.show();
    if (chooser.isSuccessfulSelect()){
    String text = chooser.getDirectorySelected();
    void jButton3_actionPerformed(ActionEvent e) {
    DirectoryChooser chooser = new DirectoryChooser();
    chooser.show();
    if (chooser.isSuccessfulSelect()){
    String text = chooser.getDirectorySelected();
    * @return the drive letters available to be mapped
    public String[] getAvailableDriveLetters(){
    return availableDriveLetters;
    * Set the drive letters available to be mapped
    * @param letters an array of drive letters in the format [Character]':'
    public void show(){
    String message = Global.getString("WIZARD.TERMINAL.PROVISION.MESSAGE3");
    PTreeNode node = Global.getCurrentNode();
    super.show();
    public boolean provisionApplication(LicConfig app){
    * @todo provision application contained in LicConfig
    return true;
    public boolean deprovisionApplication(LicConfig app){
    * @todo provision application contained in LicConfig
    return true;
    private String getValue(Hashtable h, String key) {
    if (h.containsKey(key))
    return (String)h.get(key);
    return null;
    public void initPanel(Hashtable properties)
    public JComponent getFirstComponent(){
    int page = buttonBar.getCurrentPanel();
    switch(page){
    case 1:
    return terminalServicesEnvironmentPanel1.logonCheckbox;
    case 2:
         return terminalServicesRemoteControlPanel1.enableRemoteCheckBox;
    case 3:
         return terminalServicesSessionPanel1.endComboBox;
    case 4:
         return null;
    return null;
    public JComponent getLastComponent(){
    int page = buttonBar.getCurrentPanel();
    switch(page){
    case 1:
    return buttonBar;
    case 2:
         return buttonBar;
    case 3:
         return buttonBar;
    case 4:
         return null;
    return null;

  • Hide close icon from taskflow inline popups / process window closure

    Hi OTN,
    I would like to know of there is an opportunity to hide "X" close icon from popup window when I run a taskflow in a popup as an inlineDocument?
    Or what is a preferred way to process user window closure to rollback changes?
    In my current application a user always has Cancel button which sets taskflow return parameter as "Cancel" which is then read by dialog return listener.
    The listener would call Rollback if there is "Cancel" returned.
    But "X" close doesn't set any parameter.
    Maybe I sould set "Cancel" as a default return parameter value? Or the right way is to use finalizer?
    Please, advice me.
    Thanks.
    ADF Fusion Web Application
    JDev 11.1.1.3

    You have to define and apply a custom skin. It is easy, read the documentation here:
    http://download.oracle.com/docs/cd/E14571_01/web.1111/b31973/af_skin.htm#BAJFEFCJ
    You can get detailed description of all the supported skin selectors here:
    http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e15862/toc.htm#ComponentLevelSelectors
    Note, that <tt>af|dialog::close-icon-style {display:none;}</tt> will affect all the popup dialogs, but not only the taskflow popup windows. If you need to apply it only to taskflow popup windows, then use <tt>af|panelWindow::close-icon-style{ display:none; }</tt>. Have a look at Frank's blog post http://blogs.oracle.com/jdevotnharvest/2010/12/how-to_hide_the_close_icon_for_task_flows_opened_in_dialogs.html.
    Dimitar

  • Capture Close icon event for ADF dynamic UI shell

    I am using Oracle ADF dynamic TAB UI shell template to build
    the application.
    I have two option to close Employee TAB on right side , one
    is “Remove Tab” highlighted in Navigation pane and second is close icon in
    right most corner of tab page.
    Now while closing the tab page I want to invoke one method
    or task. In Remove Tab  I am able to do this by managed Bean (writing the
    method into bean and invoke that method in Command link of Navigation pane).
    But here the challenge is to invoke same method while
    closing the Tab by close icon. Therefore I want to capture the event and call
    this method.
    Please let me know if you can share any idea on this.
    When clicked on Remove tab I am getting popup message
    successfully while changing the name SMITHR from RITESH.

    Hi,
    In this thread you have some ideas
    UI Shell - how to allow ADF Library Bounded Task Flow to close itself

  • How to hide close icon in Dialog framework

    JDev 10g.
    Any idea how to hide/disable close icon in a dialog launched by using:
    <af:commandButton     action="dialog:editEmpAngDetails"
                                       partialSubmit="true"
                                       useWindow="true"
                                       windowHeight="..."
                                       windowWidth="..."/>
    Dialog appears as a new browser window, and I want to force user to use one of the Save/Cancel button, in order to perform Commit/Rollback.
    So, I need a way to hide browser close 'X' icon.
    Any idea ?

    Hi...
    I got a further lead in this problem... In the class ADMDialog.h, in the comments described for Create & Modal functions for creating ADM Dialogs, there are some options described for the last parameter of these functions:
    ADMInt32 ADMAPI (*Modal)(SPPluginRef inPluginRef, const char* inName,
                                            ADMInt32 inDialogID, ADMDialogStyle inDialogStyle,
                                            ADMDialogInitProc inInitProc, ADMUserData inUserData, ADMInt32 inOptions);
    Now, there are some values that can be given in that last parameter which define our creation options for the dialog. One of them is  kADMModalDialogHasPaletteSystemControlsOption, which too is defined in the same class (ADMDialog.h) & which, as the comments say, shows a close box at the top right corner of modal dialogs.
    So, I implemented this as,
    sADMDialog->Modal(fPluginRef, "My Dialog", kMyDialog, kADMModalDialogStyle, NULL, NULL, kADMModalDialogHasPaletteSystemControlsOption);
    This compiled just fine, but the dialog appeared without any close icon. Now, what to do?
    Please guide me on this...
    Thanks!

Maybe you are looking for

  • IPhone 4 won't sync to iTunes on iMac

    Recently my iPhone 4 won't sync with iTunes on my iMac. When I connect my iPhone iTunes recognizes it and I'm able to click the sync button. It goes the the sync steps, but at the end it says it can't sync becasue my iPhone is not connected to iTunes

  • Difference in information sent / received using externalisable classes

    I am a little unsure whether this is the right place to post, I am relatively new to Java but trying hard to learn it well. However this is quite a specific problem with a personal (for fun) project I have been undertaking and it is driving me slowly

  • HAL - SAP Connection Adapter

    Does anyone know if it is possible to access SAP from within a HAL integration using a non-dialog SAP user ID? Our integrations currently pull SAP data using a regular SAP Logon ID, so we have to update the password and recreate the executables every

  • FileUpload UI element ...

    Hi guys, I have placed FileUpload UI element into a FileUploadView and binded it to context attributes PdfSource (binary type) and PdfName (string type). Also I have placed a button into the view. Folowing code should be executed after selecting some

  • Invoice Entry Sheets posting from outside

    Hi, We need to post Invoice Entry Sheets for Service PO from external system. Therefore I would like to check with you: - is there any standard inbound idoc process code that posts Invoice Entry Sheets? - what is the standard RFC/FM that posts Invoic