JCheckbox change the text position - swing

How do i change the position of the text in JCheckbox.
I want the text to be on the left of the check box and not as default on the right.
i been over the jcheckbox, jtooglebutton and jabstractButton api few times.

jCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
It's actually inherited from AbstractButton, but you can find this also for JLabels (in this case, it's relative to the icon you may use in the label).
Now this is assuming you want just a particular change on this one component. If your goal is to reverse the direction of all components in your application (for example for a right to left reading), you should probably look into component orientation, with the setComponentOrientation and applyComponentOrientation methods.

If you are trying to do this within Netbeans IDE select HorizontalTextPosition and change to leadingJCheckBoxProperties

Related

Separate label from textbox

Is there a way to separate a label from a textbox?
I found that this is supposed to work :
Select the controls
Arrange tab
Remove layout
But the remove layout button is always disabled... Probably cause it's only when you use the tabular or stacked option
Is there any other way to do it, or am I doing something wrong?
Please, don't tell me that I have to copy/paste the label and delete the original one.
Thank you
To move a text box (or any control) independently from its label is to click and drag the control using the large grey box in the top left of the control. This allows you complete freedom of placement between the control and label.
Remove layout only works if you use either tabular or stacked.
Use the square at the top right to move them separately, and select only the label to delete the label.
Just select the one you want to use only, and it can be controlled separately. Also: width, height, top, and left in the properties tab are your friends.
Use remove layout if you can select that little cross.
Use the align buttons to tidy up this mess.
I do not use Access much so I find letting Access create all the labels is quicker, when separating the label from the data I use the following method.
Click the label
Ctrl+C to copy label
Delete to remove label
Ctrl+V to paste label back to form
Drag from top left to roughly the location you want
If you have a column of labels then do the cut/copy/paste/reposition for all of them first, then use the method Fionnuala shows to align all to right.
If the labels are too far to the left or right the use the cursor keys to move.
Again use Fionnuala method to align the rows.
If you find they do not align as expected then Ctrl+Z to step back.
If Remove Layout is not available, select Stacked, which will make Remove Layout available, and then select Remove Layout.
This also keeps things where they are, so less re-aligning afterwards.
I think I've got the right answer. Select the Label and send click "Send to back" on Arrange Tab. Label will be detached. Now move it anywhere as required.

SSRS 2008 and Dynamic Positioning of Text Boxes

I'm trying to produce a pay check. I will allow the user to setup the position of the items according to their check style.
From my research, it seems that the position of text boxes in SSRS is static and not dynamic. There is no "expression" option for Top/Left. I thought a way to get around this might be to make the text boxes large and overlapping and then set the padding top/left based on expressions to the positions that user has selected. However, it seems that similar to HTML, the text boxes either float around the higher level text boxes or simply drop out of view.
This would be simple if there were a way to tell SSRS not to be concerned with the order of the text boxes and simply display them overlapping, however I don't feel that there is.
Given that, what other options to I have for dynamically positioning text boxes in an SSRS 2008 report? I'm moving right along with this project but I've hit this stumbling block.
SSRS gives you a lot of options for dynamic formatting but Size and Location are fixed. You cannot change this. Overlapping of textboxes does not work in the soft-break renderers like HTML and Excel but does work in hard-break renderers like PDF or TIFF. Have you tried your padding technique and output the report as PDF?
I'm not sure what are going to do in your report, But in similar cases I usually use Space character to position a text. For instance,
IIf(Len(Fields(YourColumn.valu)) > 10, Fields(YourColumn.valu), "    ")
Note that you have to ensure it can implemented in your case or not. I'm not sure that it is helpful but as long as the location and width properties are fix this is the only option
Note 2 : I'm using Unbreakable Space character instead of simple Space so that SSRS render it without any problem

Is there any way to force the dropdown (select) arrow control to be on the right?

I am using direction:rtl in a select element. It does exactly what I need which is:
expand the options to the left when dropdown is open
options text is right aligned
Question: Is there any way to force the arrow control to be on the right?
Reason why I need the select like this:
I need those because the dropdown is located on the right edge of a page and if I expand it to the right (as default), the options text won´t show up completely. The options text are very long.
I don't think there's good way to manipulate the control. If you want to customize, you should make your own.
Or, you can use something already made by someone like jQuery selectBox. You may can customize it.
I don't know if this is possible in your situation but if you can put direction:rtl on the whole page, the select will probably expand to the left, thus making your question a moot point.

Hide arrow in standard dropdown?

Is there a a way to hide the arrow in a standard dropdown select fieldset?
Fiddle link
I have an autocomplete system where you fill in the organisation number of a company and it finds the info based on a database. I'd like to have the select box, but without the arrow..
I need it to do this as it's a double function form, either you can fill in your ORG nr or just manually type it in, pretty simple, probably used all over the internet.
Thanks :)
Kyle,
Usually autocomplete systems use input text elements instead of a select element. This creates what you are trying to achieve. Google is a classic example of this.
If you want, you can take a look at jQuery's autocomplete plugin to get another example and some code ideas, or whatever. http://docs.jquery.com/Plugins/Autocomplete
It's not easy, but you can fake it by putting a button above a Select that has its size property set to a value greater than 0.
Have the Select hidden and positioned absolutely under the button. Clicking the button shows the list. Selecting the list changes the text on the button and re-hides the Select.
This way you need a text box, because you cannot type anything in <select> tag.
And put an onclick event to this box to open autocomplete with all possible values.

Qt Widget Overlays

How do I overlay widgets in Qt?
I want to create some widgets and place them out-of-layout, but rather tweak their size and position when some other widget's geometry is changed.
Something like the buttons on the screenshot:
You just need to create your QPushButton (or any QWidget), indicate its parent QWidget and then display it.
Don't add it to the parent layout else you will not be able to move it as you want.
Don't forget to indicate its parent else it will be displayed as independant QWidget.
In these conditions your QPushButton will be considered as child of the QWidget but not member of the parent's layout. So it will be a "floating" child and you must manage it's behaviour when resizing parent's QWidget.
If you want a unified behaviour for all overlay buttons, you should subclass QLayout and redefine members bahaviour.
If they're child of a widget without a layout, you should be able to move them around as you please, I think.
I needed a widget like this for a project I'm working on, so I took Patrice advice and wrote this code (Python) PyQt4 Widget Overlay