I get the dialog for changing the properties of the print job by invoking the PrinterJob's printDialog() method without any parameter. There is a field where the user can change the the number of copies to be printed on the right-bottom of this dialog.
And now I want to disable this field (the spinner). That is only one copy to be printed and the user can't change it.
Are there any ideas for it
I don't think there is any way (or i am not aware of) to modify the native or the cross-platform Java print dialogs (last one might help you a bit). What you could do is maybe display your own dialog (without a spinner field) and under-the-hood do whatever you want (like PrinterJob.setCopies(1)).
More info i found here.
Also, have a look at the Java tutorial on PrinterJobs.
Related
I am able to use WindowsAccessBridge.dll to get access to java window (SwingSet2), and use the dll methods to interact with the controls.
I can iterate the tree (of java controls) using code shown here, and get information from the controls,
and I can do actions like SetText in Text box, or send click action to a button etc.
However, I am finding that the accessibility contexts are not consistent:
The SetText method works perfectly when I use the accessibility context got from the 'setMousePressedFP' method of the dll, after clicking on the text box.
However, I cant use the accessibility context got by iterating the control tree when trying to set text in a text box, although I verified that the other information e.g. size and other properties of the text box is same.
From this doc:
"The functions GetAccessibleContextAt and
GetAccessibleContextWithFocus retrieve an AccessibleContext object,
which is a magic cookie (really a Java Object reference) to an
Accessible object and a JVM cookie. "
However, the accessibility context differs everytime I click on the text box (without restarting the java program). The vmID matches eveytime.
If the AccessibleContext is really a Java Object reference, shouldnt I get the same AccessibleContext number everytime I click on the same control (without restarting the java window) ? and shouldnt that AccessibleContext number also be available in the tree?
Worst part is that the settext method doesnt work when I use the AccessibleContext got from iterating the control tree.
Edit to clarify the question further:
I am clicking on the same text box, so I would expect the windowsaccessdll function to return reference to the same control. As a long value the accessibeContext is different everytime I click, but its ok as the SetText method works everytime with the different long values and I can see the new text set in the text box.
The problem is when I iterate the control tree and the accessibility context got from the tree iteration doesnt work for the SetText method.
More specifically - how does the AccessibleContext compare to a c pointer - the c pointer would always be same when I get it for a specific control. The AccessibleContext appears to be a 8 digit long value that is different by few tens or hundreds based on where the mouse is clicked inside the text box.
Thanks in Advance.
By default In Eclipse when you use a function or create objects it helps with parameters like this:
But once it's done, it'll never show up again. Is there any way to call this parameter helper on code that's already written when I point the cursor on the method?
The Image I uploaded only appears while writing code.
Ctrl + Shift + Space will do the trick. It is named Context information in Key preferences.
Place the cursor just inside the left parenthesis and press Ctrl+Space (Command+Space on Mac) again; Eclipse will show Content Assist again.
When the mouse cursor is in the paranthesis, click Ctrl+Space. It will pop up menu (content assist). If you enter it, it will show the context information as it was at the beginning.
You can't get place holders again once they disappeared. But you can get content assist help as said by #E-Riz
Check this answer What is Eclipse shortcut key to turn on feature that allows when pressing TAB key, for cursor to go to expected position? and also this What's this box around my function input?
i was looking for the same shortcut and didn't find it ;
now i'm using
*ctrl+Arrows to move between words
*alt+shift+arrows to select the world and replace it
JDT-Codemining is a new project (as of Aug 2018) that supports parameter hints, along with many other features, such as:
General
Show references
Show implementations
Show method parameter names
Show method parameter types
Show end statement
JUnit
Show JUnit status
Show JUnit run
Show JUnit debug
Debugging
Show variable values inline while debugging
I have an android Dialog with a 3 numberpickers inside. Changing the 3rd picker triggers a change in the displayed values of the first 2 pickers. However I've noticed when I change the displayed values, and call
setWrapSelectorWheel(false)
it still shows the new values as wrapped visually (I can see the last value above the first one).
If I touch the picker it suddenly snaps into non wrap selector wheel. What's odd is I call
getWrapSelectoWheel()
after setting the displayed values and it returns false... just like I set it. But visually it's wrong.
Any ideas what's going on?
Many thanks!
I found a solution, Daniel was on the right track, however it appears that initializeSelectorWheelIndices is actually a bad thing once you've already set your values. Because of this, you need to call setMinValue and setMaxValue BEFORE you set your values. However, if you already have an array set on your picker, if you call setMaxValue with a higher value than the current array, it will give you a ArrayIndexOutOfBounds exception.
The solution then is to clear the old display values, set your max value, then you can call setWrapSelectorWheel and setDisplayValues:
public void updatePickerValues(String[] newValues){
picker.setDisplayedValues(null);
picker.setMinValue(0);
picker.setMaxValue(newValues.length -1);
picker.setWrapSelectorWheel(false);
picker.setDisplayedValues(newValues);
}
I don't know what version of Android you're running but I would suggest you read the source code for the NumberPicker (v4.2.2). Perhaps you need to trigger a call to the private method initializeSelectorWheelIndices which can be done via a call to some of the public methods.
Although I do think your usage of the picker, by changing the wrapping flag part way through, does seem a little unusual. Don't you want this behaviour to be consistent? In which case make a call to setWrapSelectorWheel once after you've set your min and max values and then leave it alone.
I've verified this behavior as well on kitkat. It's a bug. Couldn't find an existing report so I created a new one here: bug# 98319
Per previous answers I found that making setWrapSelectorWheel(false) the last call after all setup calls will work for most scenarios. In my case I'm dynamically changing limits of the NumberPicker as the user is interacting and I just can't get it to behave 100%. I'm opting to live with the wrap selector.
I have a requirement like this:-
The user shouldn't be allowed to traverse to the Next Page in case he has not entered all the required parameters in the First Page itself. Also, in case he has entered something erroneous he should be displayed the warning and restricted from going to the Next Page. This needs to be implemented using Eclipse Plugin Developement using JFace/SWT.
Check your GUIItem.value() for empty on the Next Page button action or deactivate the button until the required fields have data.
use WizardPage.setPageComplete(boolean complete) method (easy way), or use JFace databinding. Even better if you wire databinding with org.eclipse.jface.databinding.wizard.WizardPageSupport.
Override the ispagecomplete method to return true only when all the values in your wizardpage are complete. When the user edits any value ensure that you have listener on these fields that call getContainer().updatebuttons() This should work for your requirement.
How can I add linux like tab completion to jFileChooser's File Name input field? I'm assuming I need to add a listener to the File Name's text input box to listen for the tab key. But I don't know how to do that. Then once a tab key is hit, I need to look at the directory for files/dir that start with what was inputted. Any ideas on how I can go about doing this?
Emm... I am not pretty sure what the question is but if you want to control is the textfield does contain a file name or something you can simply use JFileChooser as a panel and, as I may remember, there is a way to show/not show its components like "open"/"save"/etc buttons and, of course, replace them with your own; so there should be a way to control its input field I guess. So you need to play around UIManager
For more information you can read this , this and this
If it is not the point... so I still hope you configure your question in a more detailed manner because it is quite unclear :)
Good luck