I am using the below library JDateChooser, which is a Date Picker GUI which we can put into Netbeans pallet.
http://plugins.netbeans.org/plugin/658/jdatechooser-1-2
However this do not display any dates. Dates are empty. Below is the image.
I do not have to post the code here, because I did nothing other than dragging and dropping the GUI element. Can someone please tell me why this is happening?
JDateChooser from vadimig doesn't seem to work with Nimbus, seems to work okay for Windows look and feel, you'd have to test it with the other system looks feels.
Either change the component you are using or change the look and feel you are using
The problem is the width of the component, just increase that value.
If your DateChooserCombo is called chooserDate, it must be like this:
Dimension size = chooserDate.getCalendarPreferredSize();<br>
size.width += 90;<br>
chooserDate.setCalendarPreferredSize(size);<br>
Related
I am currently trying to get into JavaFx and started writing a program similar to Microsoft Word or Pages on OS X. I had to realize that the TextArea is really limited when it comes to style, so I was wondering if there is a component that is editable (as in you can write on it) and is able to change font size/color dynamically (size and color are defined with a choicebox on the UI.
I read a little but about binding style-types or setting css rules, but as far as I know there is no way to access Java components (choicebox) or even variables from the css style sheet, so it wouldn't be dynamical.
What I mean by dynamically change font size/color:
Type a character into the TextArea.
Double the font size.
Type another character, that now appears twice as big as the first one, that is still displayed in its original size.
I'm having a hard time explaining myself, if you have any questions, please ask and I'll try going into further detail. Thanks
EDIT: Something that might be important is the fact that I am using Scene builder to create my UI.
EDIT 2: Could I cheat my way around it using a Highlighter with the same color as my background?
I have a JTable in a JScrollPane but I'd like to change the look of the ScrollBar to something a bit better looking; a 'custom design'. Maybe put an image that a user can drag instead of the default thick blue bar. Is this even possible?
The main thing I'd like to do is change the thickness of the bar. My application uses a small window and the ScrollBar looks too thick.
Any help will be much appreciated.
Edit:
Thanks for the responses so far. I just found this; answers my answer, in part: java scrollbar thickness
Unfortunately I cannot provide a sample at the current moment, but you should definitely look into this
The BasicScrollBarUI class allows you to modify different features of a typical JScrollBar, such as various different colors, sizes, and shadow effects. This should be what you are looking for. Basically the idea is that you are supposed to override the installDefaults method and just modify the protected fields to your liking.
But, if you want to get fancy, I would highly suggest looking into JavaFX due to the amount of customizability it supports, one being CSS styling (which should be very helpful to you).
I am trying to add a tooltip to my ToggleButton to explain to the user what's going to happen if they press it. The problem is, my explanation is too long and the tooltip cuts it off with "..." (the ellipsis string, was it?) Anyway, when I set the max/pref width via a TooltipBuilder like in this example:
this.watched = new ToggleButton("Watched?");
Tooltip tooltip = TooltipBuilder.create().wrapText(true).text(
"Rather than specifying individual images, you can make this source \'watched\',which means that every" +
" time this gallery is viewed, all the images in this directory will be listed.").build();
tooltip.prefWidth(50);
watched.setTooltip(tooltip);
I get this result:
My attempts to set the width via maxWidth(double), maxWidthProperty().set(double), prefWidth(double), and prefWidthProperty().set(double) have been ignored.
Is there any way to overcome this?
In my code, I was setting wrapText(boolean) before setting the width. It seems like JavaFX doesn't like this so much. I changed it to look something like this:
TooltipBuilder.create().prefWidth(300).wrapText(true).<other properties>.build();
This gives me a successful wrap!
In javaFx 2.2 use this:
Tooltip toolTip = TooltipBuilder.create().text(string).prefWidth(500).wrapText(true).build();
I am looking for a component for Swing that would do the same thing that Windows 7 date and time pickers do (or be even better). They look so:
And have following features I need:
you cannot enter an invalid value (value is ignored as you type and not when you leave the field)
it allows continuous updating of the field until the first change made by user (take a look on the time setting in Windows 7)
you can select and change at once only one position - not the whole text at once (so colons and points cannot be removed)
up and down buttons
calendar button (but it's rather optional for me)
I have tried JSpinner with a DateEditor but it doesn't have this features. JXDatePicker only adds the calendar button.
Generally I am looking for a nice way to let user enter date and time in a powerful and simple way. Windows 7 solution seems to be quite good.
Thank you!
best and free DatePickers around are JXDatePicker and JCalendar, in both cases are there focus about correct implementations of Date and Focus workaround, and excelent Renderer and Editor for JTree / JTreeTable / JTable
to your needs ---> all these funcionalities are implemented by default, not clear from your questions exactly whats wrong, I'm Win7 and JXDatePicker and JCalendar but I never saw these issues,
in both cases you have to implementing own workaround for SpecialDays as hollydays (and etc),
I'm fairly confident that I have done my research before coming to you for help, but it's possible I have overlooked something.
I'm writing a java UI using the Nimbus l-a-f. I wish to change the background colour of a JSpinner on state-change, ie, when either the up or down button is pressed the background colour of the textfield within the jspinner changes colour to signify that the value has been altered.
I am aware this is possible using OTHER lookandfeels but not as easy with Nimbus, eg:
((JSpinner.NumberEditor)jSpinner1.getEditor()).getTextField().setBackground(color.yellow);
I have also looked into actually changing the colour theme of the UI manager, but I only want to change the colour when an action occurs, not just overall by default.
here or here
Is this at all possible and where do I start?
Failing this, I was hoping to just change a button's colour:
jButton.setBackground(Color.yellow);
This is easy enough but since the default colour is a painted gradient, how do I change it back to that?
Really hope someone out there knows or can help.
Much appreciated in advance!
Yes, it is possible. See this example (i.e. SpinnerDemo4) from The Java Tutorials for more detail. And yes, I did set the LaF to Nimbus when testing the code therein.