Make label with any image (gif and other)

Hi or Hello I come to ask for help to make it succeed in finishing my code.

So here is almost this morning I have a problem with the IconImage for gifs. I was looking for a lot of solution on the internet but each time a different thing was wrong and so at 5 hours (and some day in real life) I decided to ask for help

What I want to do is:

  • Load an image that it is a gif, jpeg etc … coming from a URL (but it is only the gif that I do not arrive but it must work with the others)

  • Put it in a JLabel in IconImage (although it suits me if it is not in the icon of the label as long as it is in the label)

  • Make it auto resize by taking all the space of the label but keeping its ratio

  • And finaly make this.add (label)

I already managed to do it with any type of image but the gifs was freeze to the first image

I search other solution but i don’t find any who work for me
etc ….

So if some could show me how to do since zero (I still have the urls ..)

what is illegal start in java netbeans?

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                         
    // TODO add your handling code here:
    new return_table().setVisible(true);

I am using netbeans..this is just a small part of my code but I’m getting an error at the start of this code. Its saying illegal start of expression. I think its because of a bracket at the start of my program that is not ended anywhere. I tried to end it but its giving me more errors. Can you please tell me how to remove this error?

@ConfigurationProperties works in controller annotated class but not in component class

I have created a WebserviceCredentials class for config as below and used @autowired for WebserviceCredentials in a @component class it does not work (shows null values) , but when used in @restcontroller class it works, appreciate your help

public class WebserviceCredentials {

    private String webserviceEndpoint;
    private String username;
    private String password;

    public String getwebserviceEndpoint() {
        return webserviceEndpoint;
    public void setwebserviceEndpoint(String webserviceEndpoint) {
        this.webserviceEndpoint = webserviceEndpoint;

    public String getUsername() {
        return username;
    public void setUsername(String username) {
        this.username = username;
    public String getPassword() {
        return password;
    public void setPassword(String password) {
        this.password = password;


Atomicity – Lock Vs atomic Vs binary-semaphore – Performance

Monitor = mutex(lock) + condition variable

Each Java object has a monitor, holding above principle.

synchronized key word claim a monitor(lock + conditionvar) of an object. For atomicity, conditionvar is not required, lock(mutex) suffice.

To maintain atomicity, Java provides Lock , atomic package and binary semaphore.

For atomicity, Which approach is better in terms of performance?

Mirth — Dynamically Change Polling Time on Channel

I am working on automating a channel in mirth 3.3.1. I have 3 channels for ease of use I will label them primary and secondary. I have a 3rd channel built to monitor the primary and secondary channels.

The primary will send data downstream to an application I do not need to start the secondary until the downstream application has completed processing.

All my current configuration works, however, we have no way of verifying that processing is complete with the downstream app. What I am trying to accomplish is after the primary channel has processed its last message is to change the source poll setting time of the secondary channel.

The script will need to:

//Ensure channel is stopped
//Set Secondary channel Poll Time to 2 hours from now
//Redeploy secondary channel
//Start secondary channel

This will allow time for the downstream app to process and then run other data through the secondary channel.

I can complete everything except changing the polling time on the FileReader channel (secondary). I can not locate the correct JAVA Package to complete this on the web. And it may not be possible, but wanted to take another approach if possible.

Can someone help me achieve the output of this picture?

Below I have posted a link the desired output of the program I am supposed to make. However, I am a bit stuck on how to proceed with actually starting it. I am new to coding and this is an assignment for my programming class in college. Any help would be appreciated. The language used for this course is in Java.

Replace FCM Notification With Programmatically Created Notification

I have switched over to using FCM for my application. When my app is open, I handle the messages manually and if the Fragment which contains the message list isn’t displayed, then I have the code display a Notification. To display the Notification I use the function:

public void notify(int id, Notification notification)

The problem I am encountering is if my application is in the background, FCM displays a Notification. I even set the tag parameter on the server so only one Notification will be displayed for the application. If the user opens the application without clicking on the Notification, and then received a message, a separate Notification is displayed, which is not what I want. I switched to using the function:

public void notify(String tag, int id, Notification notification)

And using the same tag as the server uses for the FCM message still produces a second notification. Is there a way the Notification I create programmatically can replace the Notification created by FCM?

How do I stop my Thread

in my little quiz application I created a Thread including a handler that is linked to my progress bar.
I am not quite sure how to stop the thread at the present position (e.g. 50% progress bar timer) after I clicked an answer button?

This is my code for the Thread so far:

private Thread thread = new Thread(new Runnable() {
    public void run() {
        while (progressStatus < 100) {
   Runnable() {
                public void run() {
        } Runnable() {
            public void run() {

                questionLabel.setText("Times Up");


Firebase Database – Unable to retrieve nested data

I’m unable to retrieve the data which is nested inside “Leagues” and “Season”.

In the database below, I cannot retrieve “FootballLeague”, “CricketLeague” under Leagues – but I’m aware my implementation for this may be wrong and still working on it.

But more importantly, I cannot retrieve Season 2016/2017 points and results.

I am able to access the data that is not nested, such as Email and Username without problems

"Users" : 
    "User1" : {
      "Email" : "",
      "Last_login" : "5:15pm",
      "Username" : "Test",
      "Leagues" : {
        "FootballLeague" : "True",
        "CricketLeague" : "True"
      "Season" : {
         "2016-2017" : {
               "Points" : 5
               "Results" : 2

The following class is what I’m using to store data as objects:

public class Users {

private String Username;
private String Email;
private String Last_login;
private LeaguesJoined Leagues;
private thisSeason Season;

public Users() {


public String getUsername() {
    return Username;

public void setUsername(String username) {
    Username = username;

public String getEmail() {
    return Email;

public void setEmail(String email) {
    Email = email;

public String getLast_login() {
    return Last_login;

public void setLast_login(String last_login) {
    Last_login = last_login;

public LeaguesJoined joined_Leagues() {
   return Leagues;

    public void set_joined_Leagues(LeaguesJoined leagues) {
    Leagues = leagues;

public static class LeaguesJoined {

    public LeaguesJoined() {

    private String League_name;

    public String getLeague_name() {
        return League_name;

    public void setLeague_name(String league_name) {
        League_name = league_name;


public static class thisSeason {
private String Points;
private String Results;

    public thisSeason() {

    public int getthisSeason_results() {
        return Results;

    public void setthisSeason_results(int resultsin) {
        Results = resultsin;

    public int getthisSeason_points() {
        return Points;

    public void setSeason_points(int Pointsin) {
        Points = Pointsin;

Here is part of my Java class where I access the Database:

    List<Users> usersList= new ArrayList<Users>();
DatabaseReference fbDB = FirebaseDatabase.getInstance().getReference();

        fbDB.child("Users").addValueEventListener(new ValueEventListener() {
        public void onDataChange(DataSnapshot dataSnapshot) {

            if (dataSnapshot.exists()) {

                for (DataSnapshot ds : dataSnapshot.getChildren()) {
                    Users C = ds.getValue(Users.class);

                    System.out.println(C.getUsername()); //Example


        public void onCancelled(DatabaseError databaseError) {



I get a null object reference error.

Also, worth noting that the children under Leagues keep getting added, they’re not two fixed booleans.

Having issue with form not posting to servlet

I am currently attempting to have this form. Post to a servlet, the servlet is mapped appropriately and all of my other forms with nearly identical. Why is this one in particular not working?

`     <form action="rentoutadmin" method="POST">
                <input type="hidden" name="id" placeholder="Year" value=
           <%=rs.getInt("id") %>>
                <input type="text" name="User_Name" placeholder="User Name">
                <input id="submit" type="submit">

My web.xml-


and lastly my servlet, I wont include the code to spare you the reading. however the servlet name is AdminRentOutServlet. I’m not sure what exactly I’m doing wrong in this form post.