*
The moose likes Applets and the fly likes How can i restrict applet to be resized Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "How can i restrict applet to be resized" Watch "How can i restrict applet to be resized" New topic
Author

How can i restrict applet to be resized

Deepak Gavkar
Greenhorn

Joined: Feb 23, 2013
Posts: 11
I don't want to allow user to resize the applet while running. I used setSize(x, y); method but didn't worked and getting problem with setResizable(false); method.
Simple program i have written for testing but not working please help me out anyone. Thanks in advance.

My program code given below :

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class Great extends Applet implements ActionListener
{
Label l1,l2,l3;
TextField t1,t2,t3;
Button b1,b2;
public void init()
{
setLayout(new GridLayout(4,2));
l1=new Label("First Number : ");
add(l1);
t1=new TextField(10);
add(t1);
l2=new Label("Second Number : ");
add(l2);
t2=new TextField(10);
add(t2);
l3=new Label("Result : ");
add(l3);
t3=new TextField(10);
add(t3);
b1=new Button("Compare");
add(b1);
b2=new Button("Clear");
add(b2);
b1.addActionListener(this);
b2.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
int n1,n2;
n1=Integer.parseInt(t1.getText());
n2=Integer.parseInt(t2.getText());
if(n1>n2)
{
t3.setText("The first value is greater");
}
else
{
t3.setText("The second value is greater");
}
}
if(ae.getSource()==b2)
{
t1.setText("");
t2.setText("");
t3.setText("");
}
}
}

/*<applet code="Great.class" height=200 width=350></applet>*/
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41038
    
  43
The code doesn't open a new window, so what could the user even be resizing?


Ping & DNS - my free Android networking tools app
Deepak Gavkar
Greenhorn

Joined: Feb 23, 2013
Posts: 11
Ulf Dittmer wrote:The code doesn't open a new window, so what could the user even be resizing?


Actually, But i want to disable resizing for the running applet cause when you try to resize it the components are misplaced and GUI is not good. I think you get it what i actually want to do.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41038
    
  43
Actually, I don't get it. Again:

The code doesn't open a new window, so what could the user even be resizing?


The last line with the applet tag suggests you're running this through appletviewer, which would be a scenario that you don't need to worry about.
Deepak Gavkar
Greenhorn

Joined: Feb 23, 2013
Posts: 11
Ulf Dittmer wrote:Actually, I don't get it. Again:

The code doesn't open a new window, so what could the user even be resizing?


The last line with the applet tag suggests you're running this through appletviewer, which would be a scenario that you don't need to worry about.


Hmm..Thanks for replying buddy.. ....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i restrict applet to be resized
 
Similar Threads
applet problem
Calculator Problem
Help
validating awt textfields
validating awt textfields