Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Hisham Younis   on Aug 24 In Java Category.

  
Question Answered By: Jim Williamson   on Aug 24

/*
* <applet code="ResizeMe" width="200" height="200"></applet>
*/
import java.awt.*;
import java.awt.event.*;
import java.applet.*;

public class  ResizeMe extends applet  {

final int  inc = 25;
int max  = 500;
int min = 200;
Dimension d;

public void paint(Graphics g) {
d = getSize();
g.setColor(Color.black);
g.drawLine(0,0,d.width,d.height);
g.drawLine(0,d.width,d.height,0);

g.drawString(d.width + " x " + d.height, 10, 20);
}

public void processMouseEvent(MouseEvent evt) {
int w = (d.width+ inc)>max?min:(d.width+inc);
int h = (d.height+ inc)>max?min:(d.height+inc);
resize(w,h);
}
}

Share: 

 

This Question has 11 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Applet Or get search suggestion and latest updates.


Tagged: