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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Hemant Yadav
AWT
1 Answer(s)      4 years and 2 months ago
Posted in : Java Beginners


How to set size of button in awt?


Advertisement
View Answers

November 15, 2010 at 12:51 PM


Hi Friend,

You can use setPreferredSize(new Dimension(40,15)); to set the size of Button in awt.

Here is an example:

import java.awt.*;
import java.awt.event.*;
class ButtonSize extends Frame{
    ButtonSize(){
        Label lab=new Label("Enter Name: ");
        final TextField text=new TextField(20);
        Button b=new Button("Hello");
        Panel p=new Panel();
        b.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
                String name=text.getText();
        System.out.println(name);

            }
        });
        p.add(lab);
        p.add(text);
        p.add(b);
        b.setPreferredSize(new Dimension(40,15));     
        add(p);
        pack();
        setVisible(true);
    }
    public static void main(String[] args){
        new ButtonSize();
    }
}

Thanks



Related Tutorials/Questions & Answers:
AWT
AWT  How to set size of button in awt
awt
Java AWT Applet example  how to display data using JDBC in awt/applet
Advertisements
awt
JDBC and AWT to display data  how to display data using JDBC in awt/applet
awt
JDBC in awt applet  how to display data using JDBC in awt/applet
awt
JDBC in awt  how to display data using JDBC in awt/applet
AWT & SWING
AWT & SWING  What is diffennce between AWT & SWING
AWT programmes - Swing AWT
AWT programmes  I need few programs for menus in AWT. how to open a filed dialog window, and how to save a image in the save window when we press... has all AWT programms which must open,save and make changes to a particular
awt in java
awt in java  using awt in java gui programming how to false the maximization property of a frame
Java AWT
Java AWT  What interface is extended by AWT event listeners
awt jdbc
awt jdbc  programm in java to accept the details of doctor (dno,dname,salary)user & insert it into the database(use prerparedstatement class&awt
awt - Swing AWT
awt  dear sir my proble is , i have applet code which is stock market chart this code made using "AWT" . in this chart one textbox when user.../java/awt/ Thanks
Java AWT
Java AWT  What is meant by controls and what are different types of controls in AWT
awt swings - Swing AWT
awt swings  hello sir, My requirement is to insert captured image from cam onto a frame and from that place i hve to save it in the database(MySql).its urgent sir.it is a part of my project..if code is available
java awt calender
java awt calender  java awt code for calender to include beside a textfield
JAVA AWT BASE PROJECT
JAVA AWT BASE PROJECT  suggest meaningful java AWT-base project
AWT-swings tutorial - Swing AWT
AWT-swings tutorial  hello sir, i am learnings swings and applets.. i want some tutorials and some examples related to swings.. thank you sir..waiting for your answer.  Hi friend, I am sending you a link
AWT Tutorials
AWT Tutorials  How can i create multiple labels using AWT????   Java Applet Example multiple labels 1)AppletExample.java: import javax.swing.*; import java.applet.*; import java.awt.*; import
Java AWT event hierarchy
Java AWT event hierarchy  What class is the top of the AWT event hierarchy?  The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy
awt list item* - Swing AWT
awt list item*  how do i make an item inside my listitem not visible  Hi friend, import java.awt.*; import java.awt.event.... information. http://www.roseindia.net/java/example/java/awt/ Thanks
java - Swing AWT
What is Java Swing AWT  What is Java Swing AWT
Basic Diffence between Swing-AWT - Swing AWT
Basic Diffence between Swing-AWT  What is Basic Diffence between Swing-AWT
AWT code for popUpmenu - Swing AWT
AWT code for popUpmenu  Respected Sir/Madam, I am writing a program in JAVA/AWT.My requirement is, a Form consists of a "TextBox" and a "Button... for more information. http://www.roseindia.net/java/example/java/awt/pop
AWT
AWT Image
AWT Image  I have loaded two images using toolkit in java.one is concentric rectangle and other is concentric circle.kindly someone send me the source code of interchanging the inner most rectangle with the inner most circle
awt - Java Interview Questions
awt  what is the difference between awt and swings  Hi friend, These are basically the main differences between awt and swing. 1.swing components sits on the top of AWT components and do the wiork. 2.AWT
AWT basics
AWT basics Are you looking for the AWT Basics to help you learn AWT quickly? Here we have provided you the links to our AWT tutorials. AWT stands.... Now a day?s developers are using Swing components instead of AWT to develop
Swing and AWT Problem - Swing AWT
Swing and AWT Problem  hi sir i have a problem i know from one Jframe we can send values to another Jframe. so in my project i have one fame containing three textfields CODE: String a=TNa.getText().toString(); String b
query - Swing AWT
java swing awt thread query  Hi, I am just looking for a simple example of Java Swing
another frame by using awt or swings
another frame by using awt or swings  how to connect one frame to another frame by using awt or swings
java awt package tutorial
Java AWT Package In Java, Abstract Window Toolkit(AWT) is a platform... programming language, the AWT is also platform-independent. A common set.... The implementation of the user interface elements provided by the AWT is done using
SWINGS - Swing AWT
more information,Examples and Tutorials on Swing,AWT visit to : http://www.roseindia.net/java/example/java/awt/ http://www.roseindia.net/java/example/java
Advertisements
 

 

 

DMCA.com