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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


V.Sreedevi
Java-Swings
1 Answer(s)      6 years and 2 months ago
Posted in : Java Beginners



Advertisement
View Answers

October 14, 2008 at 5:34 PM


Hi,


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


public class ButtonSizeDemo extends JFrame {

private Toolkit toolkit;

public ButtonSizeDemo() {

setTitle("Set button size application");
setSize(300, 200);

toolkit = getToolkit();
Dimension size = toolkit.getScreenSize();
setLocation((size.width - getWidth())/2, (size.height - getHeight())/2);
setDefaultCloseOperation(EXIT_ON_CLOSE);

JPanel panel = new JPanel();
getContentPane().add(panel);

panel.setLayout(null);
panel.setToolTipText("A Panel container");

JButton button = new JButton("Button");
button.setBounds(100, 60, 80, 30);
button.setSize(100,20);
button.setToolTipText("A button component");

panel.add(button);

}

public static void main(String[] args) {

ButtonSizeDemo bs = new ButtonSizeDemo();
bs.setVisible(true);

}
}
-------------------------------------------------

Please visit for more information,

http://www.roseindia.net/java/example/java/swing/

Thanks


Related Tutorials/Questions & Answers:
Java Swings
Java Swings  I am doing one project on java Swings, in this i have created one jframe where i defined some JButtons and Jcombobox's, here i need to insert one JTable with headers(IN CURRENT JFrame only).pls help me urgently
java swings - Java Beginners
java swings   Do you want to add textfields on the JPanel
Advertisements
java swings - Java Beginners
java swings   Hi, I need the code for click the refresh button then list values will be refresh.Please send the code ........... Thanks, Valarmathi
java swings - Java Beginners
java swings   Hi, I need the code for joptionpane with jcombobox. my requirement is click on add button,one joptionpane will come.from the option pane i need to select the combobox values. Please send the sample code
java swings - Swing AWT
write the code for bar charts using java swings.  Hi friend, I am...java swings  I am doing a project for my company. I need a to show.... http://www.roseindia.net/java/example/java/swing/draw-simple-bar
java swings - Java Beginners
java swings   Hi, I already posted the question for three times.... I have two listboxes.If i select first value in the first listbox and moved to second listbox.The next time the same value will not able to move the first
java swings - Java Beginners
java swings   Hi, I have two classes(two tabbed panes). how can i get the one class jtextfield value into another class method. Please send the code as sson as possible. Thanks, Valarmathi  Hi Friend, Try
java swings - Java Beginners
java swings   Hi , I have two listboxes.I want to move one listbox... correct the value and send it to me. This is my java code package...,because place the xml file in the c:/ directly and run the java code
java swings - Java Beginners
java swings   Hi, This is my code. How can i set the jtextfield...", Font.BOLD, 12)); javapathname = new JLabel("Java Path"); javatextpath = new JTextField(33); javatextpath.setToolTipText("Java Installation Path
java swings - Java Beginners
java swings   hi, I posted the same question two times,but i didnt get the reply. Please change the jframe look and feel type of code.please send the code immediately. This is my code package com.zsl.ibm.mqtool; import
Java Swings-awt - Swing AWT
Java Swings-awt  Hi, Thanks for posting the Answer... I need to design a tool Bar which looks like a Formating toolbar in MS-Office Winword(Standard & Formating) tool Bar. Please help me... Thanks in Advance
Java Swings problem - Swing AWT
Java Swings problem  Sir, I am facing a problem in JSplitPane. I want the divider in the splitpane to be customized. I have a splitpane with Horizontal orientation and here, there lies the divider between left component and right
java swings
java swings  how can we use the shared locks of dbms in java? I am working on a mini project which is based on the eamcet councilling .i am struck with a problem where if a student select a college and a branch and sees
java swings
java swings  Hi, I have one class file using three panel methods,the three methods is used for three tabs.then how can i set the background image.Please send the sample code for me. I already posted two questions,but i didnt get
java swings
java swings  hi... I am having multiple swing forms.. when i click on a button another form is going to opening but it is opening as different form... Now i want it to be open dynamically instead separately.... Is there any
java swings
java swings  Hi, I need a sample code for once click the exit tab the frame window will be closed. Instead of button close i need tab close option.Please send the sample code immediately.......?Its very urgent........ Thanks
java swings
java swings  Hi, I need the sample code for how to set the background image using jframe and also set the jtext field and jlable boxes under the bachground image. Please send the code immediately,its very urgent.Please send me
File format validation and text field validation in java swings
File format validation and text field validation in java swings   i am reading a jpg image file throuh jfilechooser in java swings,when we press... 'please select jpg file only' plz give me the code in swings. Please
Java Swings - Java Beginners
Java Swings  hi , I am doing project using netbeans. I have a combobox . I want to add items in that combobox from a method.For this i found... code: http://www.roseindia.net/java/example/java/swing
Java swings - Swing AWT
Java swings  i have the following class .In that class i has two panels,panel1and panel2.panel1 contains an image.i want drag it in panel2(gray background).but i dont want to remove the image from panel1.i want
java swings - Java Beginners
java swings  hi, I send two questions ,but i didnt reply .please reply me back. I need the jfiledialog select option is only for directory... c:/valar/ only. This code is only for c:/valar/some.txt,pdf... import
java swings - JavaMail
java swings  Hi sir,i am doing a project on swings,i don't have any...://www.roseindia.net/java/example/java/swing/GrideComponents.shtml http://www.roseindia.net/java/example/java/swing/AbsCoordinate.shtml http://www.roseindia.net
java swings - Java Beginners
java swings  Hi, I need the code for how can i set the joptionpane color(background and foreground). can i set the delay time for joptionpane display. Please send the code .its urgent. Thanks, Valarmathi
java swings - IDE Questions
java swings  I'm developing a java desktop database application using NetBeans 6.5 and using mysql as database,When I create the table and link with my program it automatically gives the front end;can I change the look and feel
java swings - Java Beginners
java swings  Hi, I have two list boxes.From the first listbox i have some value ,i can select the value from the first listbox and it is moved... send the question so many times. Please send the answer. This is my java
java swings - Java Beginners
java swings  Hi, I have two list boxes.From the first listbox i have some value ,i can select the value from the first listbox and it is moved to the second listbox using add button and the value is moved into one by one
java swings - Java Beginners
java swings  Hi, I need only directory selection filedialog. This code is only for text file selection ..ie, c:/valar/file.txt or c:/valar/file.pdf,file.html.... but i need c:/valar only import java.awt.*; import
java swings - Java Beginners
java swings  Hi , This is my java code.Please change the code as swing look and feel.... Please change the code and send it quickly its very urgent. package com.zsl.ibm.mqtool; import java.awt.Color; import
java swings - Swing AWT
java swings  hi everyone, can we make a chain of frames with JSplitpane and run a shell script in any one of those frames
java swings - Java Beginners
java swings  hi, can i set the delay time for joptionpane. I need the sample code. And i need the Refresh jbutton sample code. ie i have two listboxes.I need to move the value from first listbox into second listbox.then
Java Swings - Java Beginners
Java Swings  Hi, I am sending example button program. Please check it and give answer. I have an urgent requuirement with this. //The sample program import javax.swing.*; class ButtonSizeTest extends JFrame { JButton
 

 

 

DMCA.com