/*By clicking on the button you can change your windows backgraound as your wish*/
package p1;
import java.applet.*;
import java.awt.event.*;
import java.awt.*;
public class SetBackground extends Applet implements ActionListener {
Button b1,b2,b3,b4;
String s="Please click the button for new Background",s2;
Font f1,f2,f3;
public void init() {
f1 = new Font("Arial",Font.BOLD,18);
f2 = new Font("Forte",Font.PLAIN,24);
f3 = new Font("Elephant",Font.ITALIC,28);
b1=new Button("Blue");
b2=new Button("Green");
b3=new Button("Cyan");
b4=new Button("Red");
add(b1);
add(b2);
add(b3);
add(b4);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
}
public void paint(Graphics g) {
g.setFont(f1);
g.drawString(s,30,40);
g.setFont(f3);
g.drawString(s2,150,250);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String k=e.getActionCommand();
if(k.equals("Blue")) {
setBackground(Color.blue);
s2="This is Blue Color Background";
}
if(k.equals("Green")) {
setBackground(Color.green);
s2="This is Green Color Background";
}
if(k.equals("Cyan")) {
setBackground(Color.cyan);
s2="This is Cyan Color Background";
}
if(k.equals("Red")) {
setBackground(Color.red);
s2="This is Red Color Background";
}
}
}
-
Featured
5. C program to create a TCP socket in which multiple client can communicate to each other through a single server
Her under these version of our post we are going to create a socket program in which two client can communicate to each other through a single server . Just it mean that we are creating a socket program for a simple chat like facebook , messenger and other with any coast. lets see the… Read more
-
Different Types of Patterns in shell script
Welcome back!!!! Her in this version of our post we are going to see some tricky patterns in linux shell script or bash programming. I hope the code I have made for this pattern program is surly written in easy way for beginner as well as professional. This post included some of the most tricky… Read more
-
6. C program to create a TCP socket in which three clients communicate to each other through a single server.
In our previous post we have seen how two client can communicate to each other through a single server. But now upgrading the same concept we are going to see how three client can communicate to each other . In these post I am going to show you a TCP socket in which two client… Read more
-
4. A c.program to create TCP program through which a client send an integer and the server will reverse the number and forward it to the client.
4.2 CLIENT CODE FOR THE ABOVE SERVER PROGRAM Please leave your comment share and subscribe our site if you get some thing good.
-
3. A c.program to create a TCP socket through which a client sends an array and the server sorts an array and forward it to the clients.
A client code for the above server
-
A c.program to create a TCP socket through which a client will send two integer to the server and server will add the two integer and forward the sum to the client.
1.2 SERVER CODE (SERVER.c) 1.2.1 Now it’s time to proceed to client code (CLIENT.c) please leave your comment if get some thing using useful.
-
Socket Programming
Here we are going to deal with some basic TCP socket programming using c Under this version of my post I am going to provide you some important socket codes with explanation hoping that reader has some concept of computer network as prerequisite so that easily understand can the code. 1.A simple TCP program in… Read more
-
A Java Program To display diffrent window background using Frame class
-
A Java Program to display diffrent windows Background using an applet class
-
A Java program to constraint your password with letter,special character,number for varification
Follow My Blog Get new content delivered directly to your inbox.