JOptionPane.showConfirmDialog: Tabbing between options creates wrong result
In JOptionPane.showConfirmDialog, when pressing <tab> to move between options and then pressing <Enter> I always get a returned zero (0) no matter which button is in focus. Is this a (known) bug or am I stupid?
I run the following code.
import javax.swing.*;
public class TabOptions
public static void main (String [] args)
int n = JOptionPane.showConfirmDialog (null, "Use <Tab> to shift option-button, then press <Enter>. " +
"I'll write the returned value to sdt out.");
System.out.println ("Returned value: " + n);
}
import javax.swing.*;
class TabOptions
public static void main (String [] args)
UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);//<--------------------
int n = JOptionPane.showConfirmDialog (null, "Use <Tab> to shift option-button, then press <Enter>. " +
"I'll write the returned value to sdt out.");
System.out.println ("Returned value: " + n);
}
Similar Messages
-
Tabbing between options on a pop up box
Can anyone tell me if there is a keyboard shortcut that allows me to switch between...erm... finding this hard to explain....
Ok if I want to restart themac I hold eject and ctrl and the restart, Sleep, cancel, and shutdown are shown with shutdown highlighted in blue, but I can't find a keyboard short cut to tab back to cancel, or restart etc so end up reaching for the mouse... I'm sure it's really obvious but it's driving me nuts.
Can anyone shed some light.
TaA son of Mr.E wrote:
Can anyone tell me if there is a keyboard shortcut that allows me to switch between...erm... finding this hard to explain....
Ok if I want to restart themac I hold eject and ctrl and the restart, Sleep, cancel, and shutdown are shown with shutdown highlighted in blue, but I can't find a keyboard short cut to tab back to cancel, or restart etc so end up reaching for the mouse... I'm sure it's really obvious but it's driving me nuts.
Can anyone shed some light.
Ta
Truthfully you lost me on that "erm" thing.
It's best to do our "erming" before posting and then post a concise and exact question with technical details and not so much other stuff.
These are user-to-user forums and we are all unpaid volunteers who wish to read salient and terse posts quickly and try to assuage the issue.
I am sure you understand. -
"TAB" between options....
I'm new to mac, and I used to cycle options on my PC keyboard hitting the TAB key, or going backwards with TAB+SHIFT keys. How can I do that on a mAc??? I CAN`T FIND A WAY TO DO IT!!
PLEASE HELP!!!!!
ThanksApple/Command - Tab
Shift-Apple/Command Tab
This info is also readily available to you by accessing your Mac's own built in Help files from the Help menu -
a) Switching between tab groups would improve my workflow. Like Alt+(Shift+)Tab to switch to next/prev Tab. Cmd+Shift+W/R wold be another possible option beside the Cmd+Shift+E for Panorama.
b) When searching in Panorama Tabbing between results would be great.CTRL+SHIFT+E got me to the tabs group "menu" so you could pick which tab you wanted. it's all explained here:
http://support.mozilla.com/en-US/kb/what-are-tab-groups#w_how-do-i-switch-between-tab-groups
I hope this is what you were looking for. -
JOptionPane.showConfirmDialog "NO" button acting as "YES" on MAC using TAB
JOptionPane.showConfirmDialog "NO" button acting as "YES" on MAC using TAB
Ya , I am asking question ? Why "NO" is acting as "YES" button in case of JOptionPane.showConfirmDialog on MAC using TAB.
i.e,
I clicked on some button, then showConfirmDialog is opened, By default the focus is on "YES" button. Now I pressed TAB button and changed to the focus to "NO" button.
If press ENTER key --> acting "YES"
If press SPACE key -> acting as "NO"
Why ?
What should I do to make it correct ?
Am I need mention set (Key,value) pairs for UIManager in case of MAC.
Please suggest ? -
I normally have several applications running at the same time, some of them are running 24/7/365.
When accessing the applications its easier to alt+tab between them. On the occasions that I can actually get Firefox to open and stay open it always freezes and remains immovable on the screen after switching to another program.
Firefox goes black except for the border and the close button at the top right. The other buttons disappear. Even after waiting for a period of time it does not clear.
The freeze can occur either on the first switch or second switch. However, it always happens.Have also since found out that to start FF4 in safe mode you just hold shift whilst double-clicking the icon. We only find these things out after the event, murphy's law!
-
Content Search Web Part displaying wrong Results for anonymous Users.
HI Forum Group,
I am getting Wrong results for my content search web part. The requirement is to show the News Description for the selected news item.
I have a catalog site which stores News like
News1
News2
News3
as Items. and i have connected this catalog in publishing site which is anonymous. In the publishing site created one page "News.aspx"added search results webpart which shows all the news item. Added one page "Description.aspx" to show
description to show the selected news item.
When ever user selects any news from news.aspx page it will redirected to description.aspx with the selected item ID
The "Description.aspx" the search results page gets the data based on the URL by QueryString parameter as shown below
The problem is, if i multiple items to open in tabs all the items are showing the data same as the first selected item, though the article ID is different.
Thanks
SithenderHi,
Thank you for your feedback on how you were successful in resolving this issue.
Your solution will benefit many other users, and we really value having you as a Microsoft customer.
Have a nice day!
Best Regards,
Lisa Chen
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Problem w/JOptionPane showConfirmDialog
Okay, I have a JOptionPane.showConfirmDialog on a JInternalFrame that works for the most part, but is doing something weird. When a user clicks the Cancel option or closes the JOptionPane, I want it simply to go away. Instead, it will pop up again, and if the user click Cancel or closes the window, it will go away, but it will take the JInternalFrame with it, which I don't want it to do. I have the code pasted below, and it should work the way I have it coded, but it don't. Anyone help??int result = JOptionPane.showConfirmDialog(CustomFrame.this, getTitle() +
" has been changed. Would you like to save?", "Save File?", JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE);
switch(result)
default:
break;
case JOptionPane.YES_OPTION:
save();
break;
case JOptionPane.NO_OPTION:
dispose();
break;
case JOptionPane.CANCEL_OPTION:
break;
}Now this is being triggered from the internalFrameClosing method of the InternalFrameListener interface that is implemented on a private class in my JInternalFrame constructor. And like I said, all other aspects of it work fine and when it's supposed to, but with the Cancel option or closing the JOptionPane (which would trigger the default: option from the switch construct, correct?), I want it to go away. It will pop up a second time, then go away with the JInternalFrame. Any suggestions? Thanks a lot. I'm using JDK 1.4.1 for the Macintosh (15" iMac G4).
JamesOkay, I have a JOptionPane.showConfirmDialog on a JInternalFrame that works for the most part, but is doing something weird. When a user clicks the Cancel option or closes the JOptionPane, I want it simply to go away. Instead, it will pop up again, and if the user click Cancel or closes the window, it will go away, but it will take the JInternalFrame with it, which I don't want it to do. I have the code pasted below, and it should work the way I have it coded, but it don't. Anyone help??int result = JOptionPane.showConfirmDialog(CustomFrame.this, getTitle() +
" has been changed. Would you like to save?", "Save File?", JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE);
switch(result)
default:
break;
case JOptionPane.YES_OPTION:
save();
break;
case JOptionPane.NO_OPTION:
dispose();
break;
case JOptionPane.CANCEL_OPTION:
break;
}Now this is being triggered from the internalFrameClosing method of the InternalFrameListener interface that is implemented on a private class in my JInternalFrame constructor. And like I said, all other aspects of it work fine and when it's supposed to, but with the Cancel option or closing the JOptionPane (which would trigger the default: option from the switch construct, correct?), I want it to go away. It will pop up a second time, then go away with the JInternalFrame. Any suggestions? Thanks a lot. I'm using JDK 1.4.1 for the Macintosh (15" iMac G4).
James -
Simple query with like return wrong result
Hi,
I run simple query with like.
If I use parameter I get wrong results.
If I use query without parameter results are ok.
My script:
ALTER SESSION SET NLS_SORT=BINARY_CI;
ALTER SESSION SET NLS_COMP=LINGUISTIC;
-- drop table abcd;
create table abcd (col1 varchar2(10));
INSERT INTO ABCD VALUES ('122222');
insert into abcd values ('111222');
SELECT * FROM ABCD WHERE COL1 LIKE :1; -- wrong result with value 12%
COL1
122222
*111222*
select * from abcd where col1 like '12%'; -- result ok
COL1
122222
I use Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
and query run in Oracle SQL Developer 3.1.07.Hi,
welcome to the forum.
When you put some code please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
SELECT ...
{noformat}{noformat}
You should specify exactly how you run your code.
If I run this statement in SQL Plus:SQL> ALTER SESSION SET NLS_SORT=BINARY_CI;
Session altered.
SQL> ALTER SESSION SET NLS_COMP=LINGUISTIC;
Session altered.
SQL>
SQL> -- drop table abcd;
SQL> create table abcd (col1 varchar2(10));
Table created.
SQL>
SQL> INSERT INTO ABCD VALUES ('122222');
1 row created.
SQL> insert into abcd values ('111222');
1 row created.
SQL>
SQL> SELECT * FROM ABCD WHERE COL1 LIKE :1;
SP2-0552: Bind variable "1" not declared.
SQL>
I got this error. So I wonder how you set value 12%
Please specify exactly how you run your test as we cannot reproduce your problem.
Regards.
Al -
Difference between Invoice created date and billing date.
Hi Gurus,
I opened the Billing Document in display mode(T.Code:VF03).In header data I found two tabs one is Created On and another one is Billing Date. Here in the billing document the both dates were different.
Please let me know the difference between Created On date and Billing Date.
your afforts are highly appriciated.
JYothi.Dear Jyothisd,
Invoice created date : Invoice created date is nothing but the date on which you have created the invoice.
Billingdate:Billing date is the date on which you suppose to do the billing for respective customer. Tease billing dates will be proposed to invoice from sales order if it is order related or else actual goods issue date is proposed to billing document as a Billing date if particular billing document is delivery related.
If you want you can change the Actual billing date the result is invoice created date.
Please revert if you want any further clarifications
Thanks&Regards -
Tooltip for a JOptionPane.showConfirmDialog??
I can't get this to work, any ideas on how to reference the OK & Cancel buttons of the "JOptionPane.showConfirmDialog" and create a custom tooltip for each??
// --------- test to see if the current file was modified and give an option to save first.
if (changed)
// ----- display pop-up alert --------------------------------------------------------------
int confirm = JOptionPane.showConfirmDialog(null,
"Click OK to discard current changes, \n or Cancel to save before proceeding.", // msg
"Unsaved Modifications!", // title
JOptionPane.OK_CANCEL_OPTION, // buttons displayed
// JOptionPane.ERROR_MESSAGE
// JOptionPane.INFORMATION_MESSAGE
// JOptionPane.PLAIN_MESSAGE
// JOptionPane.QUESTION_MESSAGE
JOptionPane.WARNING_MESSAGE,
null);
// -- set the tool tip for the buttons here -- ??????
// public Point getToolTipLocation( MouseEvent event);
// public JToolTip createToolTip( );
// toolTipText
// Point getToolTipLocation( MouseEvent MOUSE_CLICKED);
JOptionPane.getToolTipLocation(OK_OPTION, Click to discard current changes."")
// OKButton.setToolTipText("Click to discard current changes.");
// CancelButton.setToolTipText("Click to save the current file.");
if (confirm != JOptionPane.YES_OPTION)
{ //user wants to save changes
try {
// save the file
catch(Exception e) {}
} // close "if (changed)"
// ----- display pop-up alert --------------------------------------------------------------The renderer code has this structure:
public class MyRenderer extends DefaultTreeCellRenderer {
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean isSelected, boolean isExpanded, boolean isLeaf, int index, boolean hasFocus) {
JTextPanel pane = new JTextPanel();
pane.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0));
if (data instanceof MyDataObject) {
MyDataObject myObj = (MyDataObject)data;
JLabel label = new JLabel();
label.setIcon(myObj.getIcon());
label.setText(myObj.getInfo());
label.setToolTipText("MyTooltip");
pane.add(label);
return pane;
Thomas Wiedmann -
Positioning JOptionPane showConfirmDialog
Hi,
Is it possible to tell the exact position of where a JOptionPane showConfirmDialog is displayed upon execution? Help please!
Thanks, JamesWith a little bit of work, you can do anything in Java!
In your case, I would suggest using an instance of JOptionPane rather than one of the static methods. The JOptionPane constructors are similar to the static methods in terms of the arguments they take (be careful, though, of mixing up the order of the message and option types). You can then use the createDialog() method to create the JDialog to display the JOptinPane in. Once you have the JDialog, you can use its getLocation() method to find out where it is. Your code might look something liek this:
import javax.swing.*;
public class OptionTest extends Object {
public static void main(String[] args) {
JOptionPane optionPane =
new JOptionPane("Hello, World!", JOptionPane.PLAIN_MESSAGE,
JOptionPane,YES_NO_CANCEL_OPTION);
JDialog dialog = optionPane.createDialog(null, "Greetings");
System.out.println(dialog.getLocation());
dialog.setVisible(true);
Object value = optionPane.getValue();
if (value != null && value instanceof Integer &&
((Integer)value).intValue == JOptionPane.YES_OPTION) {
// do something
Hope this helps.
Shaun -
JOptionPane showConfirmDialog title obscured
Hi there,
I am using JOptionPane.showConfirmDialog to popup a question to the user, but the title is quite long and is abbreviated in the dialog. Is there any way I can force the popup to size itself so the full title is visible, or at least allow the user to resize it?Have you tried creating an instance of a JOptionPane using a constructor and setting its size before calling setVisible?
// create an instance of JOptionPane with the selected options
JOptionPane window =
new JOptionPane(message, messageType,
optionType, null, options, null);
// get an instance of the dialog
JDialog dialog = window.createDialog(parent, title);
dialog.setSize (500,200);
// display the dialog
dialog.setVisible(true); -
Text entry fields not able to tab between 2 fields
Hi there,
I have placed 2 text entry fields that are for username & a password, I on publish/preview, I type the username and go to hit the TAB key to move to the password field but nothing happens & cursor does not move to the other field...
I did try a quick search for this question as I thought it must of happened before to others, but could not find what I needed..the answer ;-)
Kind Regards
Rossco
DOH! I just found some more information on tabbing between these fields, so will check that out fisrt........must be Friday (over here)Hi There,
Welcome to Adobe Forum.
Have you tried using the shortcut option assigned as "Tab" in the action properties of the text entry box as shown in the following image:
Thanks
Loveesh -
I can no longer tab between cells in a table with pages 5.0.
I use pages everyday for filling in my work booking sheets. I need to have them synching to the cloud, so I can access the client information while on the road.
My booking sheet is basically a large table with many cells for name, address, phone number, etc. In pages 4.3 I could enter some information into the cell, hit the tab button, and it would go straight to the next cell in the table. This was a quick and easy way for me to fill out my forms on the computer.
Well, since the update, the tab button only moves the cursor over in the same cell, as opposed to the next cell. It is VERY rare to need to tab in a cell, as opposed to going to the next cell.
I did figure out that I could Option+ Tab to move to the next cell, but it is very hard to change my procedure of tabbing after all this timing doing it the other way.
Am I just missing a preferance to tab between cells, instead of inside a cell?
Thanks
DaveOption-tab makes sense and can be done with the left hand's thumb/forefinger.
Using tab was always arse-backwards as it defeated the use of tab within the table cell.
Best to use both for what they always do:
Option tab or an arrow key (singular) to jump cells
tab to jump to the next tab in the text wherever it is within or without cells.
The contrary precedence was set by Microsoft and was a bad idea. In good UI you do not have shortucts reverse roles such that you need to pay excessive attention to the context.
Peter
Maybe you are looking for
-
Can't open iWeb after upgrading to iLife 11 (Domain.sites2.)
I just upgraded my iLife package from 09' to 11' just a few days ago. Since then I haven't been able to open up iWeb (09'). I realize that the iLife 11 upgrade shouldn't have harmed iWeb 09', but it's the only change/add that I have done to my machin
-
How can I set up two factor login on ASDM?
I would like to have our users enter two separate passwords to be able to run ASDM (similar to user and enable passwords on the CLI). How do I do that?
-
Prevent .pdf files from automatically downloading in e-mail
How do you prevent .pdf files from automatically downloading in an e-mail message with an Exchange account?
-
User read & write permissions greyed out in sharing
Hi I am trying to access a Fat32 formatted HD plugged into a Macbook running lion from a Macbook Pro running Mavericks. When i go into system preferences and sharing I am able to see the External HD and share it but the read and write options for the
-
Where is the slice tool located in photoshop cs6?
I've looked under crop. I have a creative cloud subscription.