I create a frame with an image with this code: That works fine, but now I want to paint something in that opened frame (on top of the image). I’m quite new in Java, and I’ve allready tried to make a class that extends JFrame, with a paint(Graphics g) method in it, but it wouldn’t work, I onl…
Tag: java
JLabel HTML4 support
My question is if JLabel (java swing) supports html4 and css2. I know, it supports html3.2 but I want newer version. Or is there another way to display html4 on a jPanel. Answer In short: no; HTML 3 only, before CSS. The “HTML” supported by JLabel, JButton, etc, is things like <font color=̶…
JavaFX 2.1 TableView refresh items
I have this common issue, as it appears to be. My table view wont refresh my items after I reset them. I have checked the data and it’s the new one. I tried multiple solution from internet but no success. Can’t reset all the columns because it adds one empty one extra (dont know why) and the resiz…
What is the recommended max level of heap memory usage? Recommended garbage collection time?
I recently found that one of my services was taking a large amount of time in garbage collection because the max heap size was too small. The service was there before I started, so I was unaware of the low heap size. I would like to set an alarm to warn me if it goes back up past a certain
how do i use an image in java gui
Hi im making a Gui programme using a null layout and a setBounds() method for lay out . In the programme I want 25 strings printed out on the screen in random locations . I know that i could do this with a for loop however i have been trying this to no avail. I have been trying this and
Array de-serialization in a Java GUI problems
now I need some help with Serializing my arraylist. Now I have managed to get the serializing aspect working (I think at least), now my problem lays with de-serializing the object. I am making a small address book program. I have a comboBox that stores the addresses with three textboxes above where the user e…
Finding absolute value of a number without using Math.abs()
Is there any way to find the absolute value of a number without using the Math.abs() method in java. Answer If you look inside Math.abs you can probably find the best answer: Eg, for floats:
What’s the best way to check if a String contains a URL in Java/Android?
What’s the best way to check if a String contains a URL in Java/Android? Would the best way be to check if the string contains |.com | .net | .org | .info | .everythingelse|? Or is there a better way to do it? The url is entered into a EditText in Android, it could be a pasted url or it
Change priorityQueue to max priorityqueue
I have priority queue in Java of Integers: When I call pq.poll() I get the minimum element. Question: how to change the code to get the maximum element? Answer How about like this: The Collections.reverseOrder() provides a Comparator that would sort the elements in the PriorityQueue in a the oposite order to …
How do I solve javax.net.ssl.SSLHandshakeException on Heroku?
I faced SSLHandshakeException on Heroku. This app was not SSL app. But this app called a ssl-based web api from inside of the app. Usually, using keytool to adopt SSL cert to JVM solves this kind of problem. But how do I this on Heroku? logs here: Answer When you are making a SSL connection to a server, you s…