I have a combo box. After selecting an item in combo box new JDialog opens.
When i use JDK 1.6_06, I am able
to click on buttons in JDialog
properly.
When i use JDK 1.6_24,
then i need to click anywhere in
JDialog first. Then only clicking on
button works. Firstly i thought this
is some issue with the focus. But
component works fine with JDK
1.6_06. But its a issue only with JDK 1.6_24.
I tried to google it. But didnt find any answer. Does anybody have any idea?
I don't know about the java versions - but putting dialog.setVisible(true) in SwingUtilities#invokeLater solved this issue some time back for me. YMMV.
#All: Aplogize for late reply. I was trying out different scenarios. And i have found that issue is with the threading. It seems that combo box is not yet finished its work, and jdialog is opened. And after that combo box tries to finish its work, so the focus is lost to the parent window. I tried opening dialog in thread:
new Thread() {
public void run() {
// open dialog here
}
}.start();
And it works fine. Now i am planning to open dialog using SwingWorker:
SwingWorker worker = new SwingWorker() {
#Override
protected Object doInBackground() throws Exception {
// TODO Auto-generated method stub
// open dialog here
return null;
}
};
This is also working. Hope this is the right way. Please let me know, if I am doing a right thing.
Related
The game controller button B is, by default, quitting the app and navigating back to the tvOS home screen. At first I thought this was intuitive, but quickly realized that's what the Nimbus MENU button (dead middle of the controller) is for, and that I actually want to use button B in-game.
Setting a change handler for button B works, but the app still quits when the button is released.
GCControllerButtonValueChangedHandler buttonBHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) {
NSLog(#"B");
};
I had the same issue.
The solution was to have my main ViewController inherit from GCEventViewController instead of UIViewController.
By default, when using GCEventViewController, the MENU button will not return to the menu. In this case, if you want it to be able to return to the menu with the original behavior you can simply set controllerUserInteractionEnabled to YES.
see the documentation for this class here :
https://developer.apple.com/library/tvos/documentation/GameController/Reference/GCEventViewController_Ref/index.html
edit : apple dev forum helpep me fix this issue : https://forums.developer.apple.com/message/57926#57926
hope this helps,
I too had the issue, related to Unity, but I think this rather hacky solution can help.
Deriving from GCEventViewController one can override several methods, one of them is:
- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
returning or handling presses without calling super removes all calls to the internals.
I am using a Combobox component for a category dropdown in my application. But on loading the page, if I click on the category dropdown the UI freezes. There are no errors in the console. I have this code in my commit properties.
if (_categoriesChanged)
{
_categoriesChanged = false;
categoryCombo.dataProvider = categories;//If i comment out this line, everything works normal
setSelectedCategory();
}
I have similar usage of combobox elsewhere in the application and I have no issues.
Also this doesn't happen if I put a breakpoint and go step by step (hence can't debug too).
Anyone with any idea?
I'm currently using CodeMirror and here is the code I have:
cm.setOption("extraKeys", {
'Ctrl-T': function() {
insertTitle();
return false;
}
});
The main idea is to execute the function insertTitle when the user presses Ctrl+T.
The issue is that, instead of executing this function, Chrome opens a new tab (default behaviour).
I tried to replace Ctrl-T by Ctrl-A but it didn't work.
I also tried with or without return false but it does not change anything.
Is there a way to prevent the Chrome default behavior ?
Chrome does not allow scripts to capture some keys. Ctrl-T appears to be one of them (Ctrl-N and Ctrl-W are others). There's nothing CodeMirror can do about this.
I'm making a chrome extension that uses pageAction.
I can set when it shows whether I want it to have a popup or handle the click myself.
What I want to do is handle the click myself, but with certain scenarios I don't want to process the normal code, and want to show the user a message. Preferably with a popup.
But it seams I can either make the pageAction have a popup or have an onClick. But not both.
I can show an alert, but that is ugly.
Currently, there is no "neat" or official way to handle both. You can just do either. But there are some work arounds that some Google extension product have done.
First of all, set it up to show the popup. And within your pageAction popup, you can have the initialization code to be something like this:
Page Action Popup:
function init() {
if (getClickBehaviour() == 'popup')
handlePopup();
else
openPage();
}
function getClickBehaviour() {
return localStorage['CLICK_BEHAVIOR'] || 'popup';
}
function openPage() {
chrome.tabs.create({url: 'http://google.ca'});
window.close();
});
}
init();
Then you can let your options, set the click behavior. If you want different behaviors on each click, you can do that too.
As you noticed, we are closing the popup right after for the "default" behavior that we don't want the popup to show. That is currently the only way to implement different behaviors.
I haven't tested this myself yet, but have you tried setting the popup to the empty string when you want to handle the click (chrome.pageAction.setPopup('')) and to your popup when you want to show a message. I'm not perfectly sure if the onClicked event handler gets called in that case (where the popup is dynamically set to the empty string), but it's worth looking into.
As far as I know, there is generally no way to programmatically open a popup window for a page or browser action. (Which is too bad, I would love this functionality; but you can imagine some of the annoyances if this were possible.)
I have created a JDialog to be opened when I click on the edit button of my JFrame, it is being opened properly and does'nt have any issue, but when I took this code on the windows ce 5.0 device this dialog is being opened twice. hat is i am clicking only once on the edit button but the dialog is appearing twice, I want there should be only one dialog appear on edit button click.
ok I have got the solution
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting() == false) {
List lsm = (List) e.getSource();
showDialog();
lsm.clearSelection();
}
}