ja20
- Create a JSP page to accept a number from a user and display it in words: Example:
123 – One Two Three. The output should be in red color. [15 M]
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
- Write a java program to blink image on the JFrame continuously
import javax.swing.;
import java.awt.;
import java.awt.event.*;
public class BlinkingImage extends JFrame {
private ImageIcon icon;
private JLabel label;
public BlinkingImage() {
super("Blinking Image");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300, 300);
// Load the image
icon = new ImageIcon("image.jpg");
label = new JLabel(icon);
add(label, BorderLayout.CENTER);
// Timer to toggle visibility
Timer timer = new Timer(500, new ActionListener() {
boolean visible = true;
public void actionPerformed(ActionEvent e) {
label.setVisible(visible);
visible = !visible;
}
});
timer.start();
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new BlinkingImage().setVisible(true);
}
});
}
}