Michael Peremsky

Greenhorn
+ Follow
since Nov 07, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Michael Peremsky

After rewriting the code everything is working as expected. No crunch time this week. The load code is a lot cleaner. There were a couple of minor tweaks to the handlers, a couple of lines.

1 year ago
Thanks for the comments.


@Stephan
Thanks for asking for a demo app, it showed that there may be a bug somewhere within my code.

I ended up creating a quick demo with only 2 combo boxes (with integers) and it seemed to work as expected. I will have to revisit my code in this example.

@Lou Hammer
1) I looked at spinners, but the minutes are in uneven increments 0,30,45. I didn't think that spinners supported that.
3) I am doing this in an Initialize method. [@FXMLprotected void initialize()] FYI, it is recommended not to implement the Initializable interface.

NOTE This interface has been superseded by automatic injection of location and resources properties into the controller. FXMLLoader will now automatically call any suitably annotated no-arg initialize() method defined by the controller. It is recommended that the injection approach be used whenever possible.


1 year ago
So, I have a defined dialog (anchorpane) where a radio button activates either a choice box or a group of combo boxes. The group of combo boxes define +/- Hour and  minute.

When the values are saved, say + 09 00 and I exit the dialog, then reenter the dialog. If I change the hour, (the minutes clear as intended), then if I select the same minutes 00 the combobox never sees the event. I added onKeyPressed, onKeyReleased, onAction, ChangeListener, but nothing will trigger.

This only happens when you re-enter the dialog, you change the hours and re-select the same minutes. If I select different minutes it works fine. I am at a loss as to why the listener is not being called. I know that when the hour is changed that the minutes combobox is being emptied and the selected index is being reset to -1. Then, the box gets filled with new values. I then select the new minutes 00, but no action is triggered.

1 year ago
Resolved. Not sure what was wrong, perhaps naming was off. But it is now loading the text properly.
1 year ago
I thought that by tying the fxid to the object in the fxml, it was supposed to create an instance of the object on the load.



Is this not the case? Again, it has been over 5 years.

If I created an object



would I then need to reassign it to the fxml object? How exactly?

1 year ago
It has been over 5 years since I've worked with JavaFX. This seems like such a simple thing, yet I am not sure what I am missing. I am just trying to set the value of a text field, but I am getting a null pointer exception. It is being called after the loader, so I am not totally sure what I am missing.



Caused by: java.lang.NullPointerException: Cannot invoke "javafx.scene.text.Text.setText(String)" because "this.txtHeader" is null
1 year ago
We have a form that has the following definition (the important part is the enctype)



By using this format, FF and IE can upload files and pass encoded characters properly, but Chrome has sporadic issues.

Using the below works in FF and Chrome, but breaks encoded characters in IE.



We need to be able to receive encoded characters and upload files in FF, Chrome and IE. However, I am unable to find a form "signature" that works for all three. I thought I had read somewhere that there may be a configuration setting somewhere to set the encoding instead of having to do it on the form. I am not even sure why struts would mess with the encoding on the form to begin with. We do not have an option of upgrading to a more recent version of struts.

Thanks for any possible suggestions.
4 years ago
I found the problem. I had copied the code in the controller from another class. I did not realize I had a "new AnchorPane" in the code. Removing this worked

;
7 years ago
As a side note. If I take the fxml code from the window I am loading into the CENTER pane and copy it to the initial BorderPane it works as I expect it to. The anchorpane will fill the CENTER pane and resize with it. As it stands, loading the CENTER pane seperately 1) does not fill the pane and 2) does not resize with it.
7 years ago
I am creating an app that has a main BorderPane with a menubar in the TOP. I want to change the CENTER content when a specific menu option is selected. However, when I do this, the AnchorPane that I load into the CENTER pane is not resizing to fill the CENTER pane. It keeps it's preferred size. I have tried setting it to USE_COMPUTED_SIZE, but that does not resize it to fill the CENTER pane. I also tried to add an HBOX as a wrapper around the AnchorPane (I am fairly new to JavaFX UI design) which also did not work.



I load the pane to set in the CENTER using the following call from the main class:



And the actual controller for the AnchorPane being loaded to the CENTER pane.



I do not know a lot about JavaFX layouts. I am more of a backend guy, so I am at a bit of a loss here.
7 years ago
In the past I had asked how to create a label to be printed. From that I learned how to create an Image object with the text and graphics I need for printing. Since then I have run into issues of actually printing the object. I am missing some pieces of knowledge and am looking for help to fill them in, not necessarily looking for someone to give me an answer (although examples are good). The logic of the program is as follows:

1. A user selects one or more records to create a label for. These selected records are kept in a list object (e.g. List <MyRecord> recordsToPrint;)
2. I display a dialog for the user to select the printer to use
3. I display a dialog for the user to select which label on the sheet to start printing from (6 labels per sheet)
4. I create an Image for an item in the list to be printed
5. STUCK HERE

Issue 1:
This is where I get stuck. I can create an image for the label (1 object from the List) to be printed. The graphics object I use to create the image is a new Graphics object (from a BufferedImage object).
I return the BufferedImage to the method that the printing dialogs were shown from. But I do not know how to print a BufferedImage. I have seen code where the object is saved as an Image file (e.g. png file) and the file is sent to the printer. However, I do not know how to print the BufferedImage object I currently have.

Issue 2:
If I have X labels to create/print from the List<MyRecord> how do I print the labels in such a way that they will start printing with Label Y ob the label sheet and continue on to the next label, and start at label 1 on the new sheet when it hits the end of the page. I know that I can count where I am on the page and reference based on how many objects are in the list, but do I loop through the list creating a label for each object and calling print on that object or am I supposed to create one giant image with all the labels (this seems wrong and could be memory intensive) and print that way?





7 years ago
Thanks guys I will look into those 2 options. I really appreciate the quick response.
8 years ago
Hi everyone,

I am creating an application that needs to print out labels for file folders (like in a doctors office). The label need to have a barcode (may be optional), text (normal and rotated) and colored blocks. Similar to the image below.

The problem I am having is that I have no idea where to start to make this happen. I read some tutorials on the print services and was getting buried in technical details of selecting the printer. After selecting the printer, I need to create the print job. Now, this is where I am stuck. I have no idea how I am to make this "object" to be printed. Am I somehow supposed to make a BufferedImage and send that to the print job or do something else? I have never had to create an image or a print job in Java before and am stuck on this point. If creating an image is the best way to go, can anybody point me to a decent tutorial on how to create images?

I realize this is a bit open ended, but I need help getting pointed in the right direction. 3rd party software (that requires a license or paying for) is not an option. I did see the Barbeque code from apache to create barcodes, I saw that that can be sent to a PNG, GIF, etc. But, even if I could do that, it would not be part of the rest of the image/label that has text and other colored areas.

Any help getting pointed in the right direction would be greatly appreciated, I am on a bit of a time crunch.

8 years ago
I realize it was a bit open ended which is why I hesitated posting, but I did not know how to narrow it down. But you guys have given me something new to look in to.

Thank you
8 years ago
Hello all, I am new to JavaFX and have been through ~50 youtube tutorials on how to "build" JavaFX applications. However, every example I can find uses simple, one scene examples and/or a pop up screen. I want to create a desktop application that changes scenes depending on what menu choice is selected. If I am adding a client, I want the main scene to be an add page, if running a report, it needs to show the report page, etc.

I believe that the norm is to have a single controller for each FXML scene. But. how to I manage moving from one scene to the next? Is the Main class the location that handles all the scenes and switches between them? Any examples or links to sites with this type of information would be greatly appreciated.

8 years ago