Â
Not So Very Active Forums
Following are some other forums that could also be visited. However, they are not very active in the sense that not many discussion threads could be found which implies that not many visitors are there on these sites. Interestingly enough, Oracle Java forums fall in this list:-).
Last updated: 3rd May, 2024 Have you ever wondered why some machine learning models perform…
Last updated: 2nd May, 2024 The success of machine learning models often depends on the…
When working on a machine learning project, one of the key challenges faced by data…
Last updated: 1st May, 2024 The bias-variance trade-off is a fundamental concept in machine learning…
Last updated: 1st May, 2024 As a data scientist, understanding the nuances of various cost…
Last updated: 1st May, 2024 In this post, you will learn the concepts related to…
View Comments
please help me to add 3 buttons in my application for each animated gif file. When I click a button the curresponding file should be display. Can you help any whay my working code as below....
import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.*;
import java.awt.event.*;
public class Animation {
public static void main(String args[]) {
JLabel imageLabel = new JLabel();
JLabel headerLabel = new JLabel();
ImageIcon ico = new ImageIcon("Icon1.png");
JButton click = new JButton(" ",ico);
JFrame frame = new JFrame("JFrame Animation");
JPanel jPanel = new JPanel();
jPanel.add(click);
//Add a window listner for close button
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
// add the header label
headerLabel.setFont(new java.awt.Font("Comic Sans MS", Font.BOLD, 16));
//headerLabel.setText("Animated Image!");
jPanel.add(headerLabel, java.awt.BorderLayout.NORTH);
//frame.getContentPane().add(headerLabel, java.awt.BorderLayout.NORTH);
// add the image label
ImageIcon ii = new ImageIcon("Arnab.gif");
imageLabel.setIcon(ii);
jPanel.add(imageLabel, BorderLayout.CENTER);
frame.getContentPane().add(jPanel, java.awt.BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
}