Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSF-Questions Hide Close Button in Java Applet

Have Programming Question? Ask it here!
 
 
 


Azhar Ushmani
Hide Close Button in Java Applet
1 Answer(s)      6 years and 6 months 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


Advertisement
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.




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
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 - 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
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
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
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
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
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
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
Show Hide Text Javascript - Java Beginners
Show Hide Text Javascript  Please tell me how to show hide text using Java Script
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
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 Applet   How to add Image in Java Applet? what is getDocumentBase
How to hide and show some field on a radio button click
How to hide and show some field on a radio button click  This is my... and cheque number label and textbox to be invisible when by cash radio button is clicked.and they should be visible when by cheque radio button is clicked. I have
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
how can i close a frame. - Java Beginners
how can i close a frame.  Hi, My question is how can we close... and in that table is displayed and one button is added to that frame............my target is when i click on that button, a new frame is coming and updated table
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 applet  What tags are mandatory when creating HTML to display an applet
java applet
java applet  If i insert in database from applet this work, but from applet.html don't
Java applet
Java applet   How do I go from my applet to another JSP or HTML page
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
Hide buttons in Java Swing
Hide buttons in Java Swing In this section, you will learn how to hide buttons using java swing. For this, we have created three buttons, A, B and C. We have performed an action on C. When you click the button 'C', buttons A and B
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
java - Applet
java  what is applet
Hide/remove titlebar of JInternalframe - Java Beginners
Hide/remove titlebar of JInternalframe  i am designing a account management application using java. so to give good look i want to hide/remove...); rtb.setVisible(true); rtb.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE
java - Applet
java  how to communicate to my servlet through applet.   ... this information to the servlet in the normal way. The applet pretends... is concerned, the applet is just another HTTP client. For more infomation
java applet
java applet   I want code to implement (1) user will enter how many nodes (2)it should allow that no. of clicks and circle should be displayed at that position
HIDE BUTTON iPHONE
HIDE BUTTON iPHONE Basically,buttons are used to give an action... of isEqualToString: , basically it is a comparing string. To hide the button we... and a button. And on the button action, we have written a code that will hide
Java Basic - Applet
Java Basic  My Applet Programs are Compiling as well as Running properly. But when I close the Applet window I am getting an Error Message as: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException and also 10
java applet
java applet  Web page that accepts a matrix as input and computes its transpose. The web page should have two text boxes and a submit button labbeled... of the web page, Submit button should be clicked. Once clicked, a number of text boxes
java applet
java applet  Web page that accepts a matrix as input and computes its transpose. The web page should have two text boxes and a submit button labbeled... of the web page, Submit button should be clicked. Once clicked, a number of text boxes
Java file close
Java file close This section demonstrates you the use of close() method.... You can done this using the method close(). This method automatically flush out the stream. It is necessary to close the stream after performing any file
Tree Root Hide in Java
Tree Root Hide in Java       In this section, you will learn to hide the root node of  a JTree.  Description of the Program: The following program helps to hide the root
Applet
Applet  I have a java applet that has a button. On clicking the button it should disappear and another applet should appear. How to write this code???? Also in login applet after successful login it should display admin applet
how can i close particular frame in swings - Java Beginners
when clcking close button. let us assume that we got three frames as output... on second frame close button, it should only get close....iam trying this in swings...how can i close particular frame in swings  Hi, I want to know
java - Applet
java  1.An applet program to draw a line graph for y=2x+5.[for suitable values of x & y] 2. An applet program to draw following shapes (1)cone... java.applet.Applet; public class CubeExample extends Applet { Stroke
Write an applet program to transfer the content of the text field into the component on clicking a button
Write an applet program to transfer the content of the text field into the component on clicking a button  Write an applet program to transfer the content of the text field into the component on clicking a button
java applet prog
java applet prog  applet to display scrolling text from right to left in an applet window using thread. text should be accepted by html parameter
Java applet
Java applet  what are types of applets
 

 

 

DMCA.com