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

 
 


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

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 Pages:
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
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
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
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
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
how to close JSF application..?
how to close JSF application..?  how to close jsf appliaction using command button with help of java code
applet - Applet
*; import java.awt.*; public class CreateTextBox extends Applet implements...); add(text,"center"); Button button = new Button("Hello"); button.addActionListener(this); add(l); add(text); add(button
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
difference - Applet
with title bar and close button. It contains Panels. Whereas a panel is a region... as JFC?s (Java Foundation classes). 2) AWT components use native methods Swing components use the methods that are written in Java. Therefore AWT is heavy
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
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
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 button - Java Beginners
(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(applet...java button  i want to make form with checkboxes, after this i need button thich will open new pop-up page, where will be shown only this checkboxes
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  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
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
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
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
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
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
Applet
Applet  Draw the class hierarchy of an Applet class. Also explain how to set background and forground colors in java
applet
applet  applet to open new tab not working.here's my code import...*; public class NewURL extends Applet implements ActionListener{ public void init(){ String link_Text = "google"; Button b = new Button(link_Text
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
applet
applet  what is applet in java   An applet is a small program that can be sent along with a Web page to a user. Java applets can perform... the following link: Applet Tutorials
Applet
Applet  Write a Java applet that drwas a line between 2 points. The co-ordinates of 2 points should be passed as parametrs from html file. The color of the line should be red
Applet Graph
Applet Graph  hai, iam new to java plz help me.. 1..i have a table... columns-names by using check box and click on graph button, 3..then i have to get a graph between those columns in a applet plz send me the code thank u
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
Web programming guidence - Applet
) Java but not having good knowledge. I wish to host a simple web site... in each button. And also please give me the guidence for developing web...("www.roseindia.net")); frame.getContentPane().add(new LayoutDemo("www.roseindia.net/java
core java - Applet
core java  how can draw rectangle in applet. when i pressed in mouse button the rectangle's size will also increase
Swings - Applet
to call that class in applet. is it possible. or otherwise is there any way to deploy java class in browser. Give an example... Thanks in advance...  Hi... extends Applet{ CountCharacters c=new CountCharacters(); Label l1,l2,l; TextField
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
Swing - Applet
Swing  Hello, I am creating a swing gui applet, which is trying... showing the result, and thee will be a button hihc the user will click... = new JPanel(); JButton button = new JButton("Calculate"); panel.add
applet - Applet
in Java Applet.",40,20); } } 2) Call this applet with html code...: http://www.roseindia.net/java/example/java/applet/ Thanks....  Hi Friend, Try the following code: 1)Create an applet
UINavigationController hide navigation bar
UINavigationController hide navigation bar  HI, How to hide the navigation bar of UINavigationController? I have to hide navigation bar of UINavigationController on the click of a button. Thanks   Hi, Use following
Applet - Applet
, Applet Applet is java program that can be embedded into HTML pages. Java applets... in details to visit.... http://www.roseindia.net/java/example/java/applet...Applet  what is the concept of applet? what is different between
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
Java Programming - Applet
Java Programming  Write an applet that accepts a string as input... Applet implements ActionListener { Label l1,l2,l3; TextField text; Button b... = new Button("Reverse"); b.addActionListener(this); p.add(l1); p.add(text
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
core java - Applet
core java   Namaste sir , how can draw a line in Applet. I want when I press mouse button and moves any way then show the line . i, working jdk1.5.0_17 version. without use Canvas and Frame. like this: when press mouse button
how can i hide and show tables
how can i hide and show tables  hai, i am creating a form which the code is included below i want to hide the tables initially and after i click go... which is having a table consists of database data and a Go button. Using
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
Applet - Applet
------------------------"); g.drawString("Demo of Java Applet Window Event Program"); g.drawString("Java...Applet   Namaste, I want to create a Menu, the menu name is "Display... java.awt.event.*; public class menu2frame extends Applet implements WindowListener
need a login applet in java
need a login applet in java  i'm java beginner. Can some java master teach me how to write a login applet? combine with my coding import... java.text.*; import java.awt.event.*; public class BoatRental extends Applet implements
need a login applet in java
need a login applet in java  i'm java beginner. Can some java master teach me how to write a login applet? combine with my coding import... java.text.*; import java.awt.event.*; public class BoatRental extends Applet implements
java application/applet - Java Beginners
java application/applet  In this project, the student has to develop and submit a program for a Java application / applet which contains a set of GUI components as detailed below. 1. The Java applet page/application models
java - Applet
java  what is applet

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.