Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

Hide Close Button in Java Applet

Ads

 
 

Share on Google+Share on Google+

Azhar Ushmani
Hide Close Button in Java Applet
1 Answer(s)      9 years ago
Posted in : Java Server Faces Questions

I have an applet while running it is displyaing minimize, maximize and close button. I want to hide the close... button or close button. Java Applet Code - Show and Hide Buttons on Applet

Ads
View Answers

February 23, 2008 at 5:15 PM


Java Applet code to display minimize and maximize button on Applet and code for hiding any button or close button.

Java Applet Code - Show and Hide Buttons on Applet

You have to create two different files for it first is frames.java and second is frames.html.

Java file will contain all the Java Applet Code and in HTML define html code.

1. frame.java code

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

public class frames extends Applet implements ActionListener {
TextField input,output;
Label label1,label2;
Button b1;
JLabel lbl;
int num, sum = 0;
Frame window = new Frame("This is the calculation frame!");
Button btn = new Button("Create new Frame to hide close button");

public void init(){
add(new Label("Please Click"));
add(btn);
window.setLayout(new FlowLayout());
window.add(new Label("This is the Frame."));
label1 = new Label("please enter number : ");
window.add(label1);
label1.setBackground(Color.yellow);
label1.setForeground(Color.magenta);
input = new TextField(5);
window.add(input);
label2 = new Label("Sum : ");
window.add(label2);
label2.setBackground(Color.yellow);
label2.setForeground(Color.magenta);
output = new TextField(20);
window.add(output);
// input.addActionListener( this );
b1 = new Button("Add");
window.add(b1);
b1.addActionListener(this);
lbl = new JLabel("This is the Swing Applet Example. ");
window.add(lbl);
window.setBackground(Color.yellow);
}

public void actionPerformed(ActionEvent ae){
try{
// num = Integer.parseInt(ae.getActionCommand());
num = Integer.parseInt(input.getText());
sum = sum+num;
input.setText("");
output.setText(Integer.toString(sum));
lbl.setForeground(Color.blue);
lbl.setText("Output of the second Text Box : " + output.getText());
}
catch(NumberFormatException e){
lbl.setForeground(Color.red);
lbl.setText("Invalid Entry!");
}
}

public boolean action(Event evt, Object whatAction) {
if((evt.target instanceof Button)){
String buttonLabel = (String) whatAction;
if (buttonLabel == "Create new Frame to hide close button"){
window.resize(300,200);
window.show();
return true;
}
}
return false;
}
}

2. frame.html code
<HTML>
<BODY>
<applet code = "frames" width = "260"height = "200"></applet>
</BODY>
</HTML>

Try this code, it will show the desired output.



Ads









Related Tutorials/Questions & Answers:
Hide Close Button in Java Applet - Java Server Faces Questions
Hide Close Button in Java Applet  I have an applet while running...... button or close button. Java Applet Code - Show and Hide Buttons on Applet ... for hiding any button or close button.Java Applet Code - Show and Hide Buttons
How to Hide Button using Java Swing
How to Hide Button using Java Swing  Hi, I just begin to learn java programming. How to hide the button in Java programming. Please anyone suggest... Programming application how to hide the buttons using Java Swing. Please Visit
Advertisements
Setting the close button operation for the frame in Java
Setting the close button operation for the frame in Java... will learn how to implement the close button of any frame or window in java application. By default the close button of the frame is not in working state. If you
Browser Back Button Disable/Hide/Invisible using Java Script
Browser Back Button Disable/Hide/Invisible using Java Script  Dear Sir, Please Help..., Q: How to Write Code For Browser Back Button Disable/Hide/Invisible using Java Script without Page Reload/Refreshing. anyone
Java Applet - Adding a Button to Decrease a Total
Java Applet - Adding a Button to Decrease a Total  Hello everyone... java.applet.*; public class Final extends Applet implements ActionListener { public int testone = 0; public void init() { Button one = new Button
JavaScript Hide Button
JavaScript Hide Button...; In this section, you will learn how to hide the button using JavaScript... the page you will get the button. On clicking the button, the function hide
java applet - Applet
java applet  I want to close applet window which is open by another button of applet program. plz tell me!   Hi Friend, Try... { String st=""; private Button open, close; Frame window; public
JFrame Close On Button Click
in Java and close this frame by clicking on a button . In this example we...JFrame Close On Button Click In this section we will discuss about how to close frame on click on the button. This example explains you how a frame can
Hide text by clicking button
Hide text by clicking button In this tutorial, we will discuss about hide/show text by clicking on button. In the below example, there are two buttons : hide and show .The "hide " button is used to hide text and "show
Not getting desired output while button is pressed in java applet program
Not getting desired output while button is pressed in java applet program ... T1 and T2 get subtracted and comes in T3 after we press the button.../// import...*; import java.awt.Font; public class abc extends Applet implements ActionListener
Write an applet that prints "Lear Java it is useful" at the current cursor position whenever the mouse left button is clicked.
Write an applet that prints "Lear Java it is useful" at the current cursor position whenever the mouse left button is clicked.   Write an applet that prints "Lear Java it is useful" at the current cursor position whenever
Hide/Show paragraph by button click
Hide/Show paragraph by button click In this tutorial, we will discuss about how to hide/show paragraph by clicking on button using jQuery. In the below... to hide Paragraph</button> <button id="butt2">Click
Toggle hide/show by clicking same button
Toggle hide/show by clicking same button In this tutorial, we will discuss about how to toggle hide/show by clicking button. In the given below 2 example, there is button ,by clicking on it, the paragraph will hide/show . In first
how to hide and unhide folders in java
how to hide and unhide folders in java   i want to hide folder along with its contents and unhide later
How to close a frame on action event of a button from a different class ?
How to close a frame on action event of a button from a different class ?  How to close a frame on action event of a button from a different class... initialized. For each frame there is a class. now I want to close the frame (which
java applet problem - Applet
java applet problem  i was doing a program using java applet. I want... for add,multiply,divide,minus and a clear and exit button to clear the textboxes and to exit from the applet respectively.Now i want to display a message when
java applet - Applet
java applet  wants to creat address bar on my java applet.  Hi Applet don't provide a facility to create a address bar directly. You just create a text box. In this text box if you enter any http address
Java Applet
Java Applet   How to add Image in Java Applet? what is getDocumentBase
loading Java Applet - Applet
loading Java Applet  Hi, I use the archive tag to download my applet into the Browser It takes too long to load. Can I do it in several steps... control the loading within the applet? thanks
java - Applet
java  how to connect database table with scrollbar in java applet
java - Applet
java  how to connect database table with scrollbar in java applet
java - Applet
java  what is applet?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/example/java/applet/ Thanks
java applet
java applet  Creation of Applet for Personal Details Form When.... The applet must include the following validations: ? The FirstName, Address1... format, and should be later than the current date. Create an OK button
java applet
java applet  why java applet programs doesn't contain main method
java applet
java applet  why java applet programs doesn't contain main method
java - Applet
java  i have button browse button in my applet form.when i click on browse button i have to go to file storage box(what ever files stored in my... in the mail).i have display that file path in my applet form.am learner please send me
Show Hide Text Javascript - Java Beginners
Show Hide Text Javascript  Please tell me how to show hide text using Java Script
Java applet
Java applet  What tags are mandatory when creating HTML to display an applet
Java applet
Java applet   How do I go from my applet to another JSP or HTML page
java applet
java applet  If i insert in database from applet this work, but from applet.html don't
Java Applet
Java Applet  Hi, What is Java Applet and how it can be useful in development of Java programs? Can anyone tell me the url to learn Java Applet? Thanks   Hi, See the tutorial at: Applications and Applets Thanks