The Artima Developer Community
Sponsored Link

Java Answers Forum
buttons help

1 reply on 1 page. Most recent reply: Jul 29, 2003 12:13 AM by KR F

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
sriram

Posts: 11
Nickname: scorpkris
Registered: Jul, 2003

buttons help Posted: Jul 28, 2003 9:28 PM
Reply to this message Reply
Advertisement
hi!!! help needed
if u want to add rectangular buttons, we can write
add(newJButton("send"),newRectangle(2,0,2,1));
similarly can i write the same kind of code to make a round button too?

what is the syntax or procedure?

bye!!!


KR F

Posts: 10
Nickname: kr
Registered: Jul, 2003

Re: buttons help Posted: Jul 29, 2003 12:13 AM
Reply to this message Reply
You can set the current drawing to drawOval() and
fillOval() which work similarly, but you might want to enlarge the button so that it becomes a circle rather than an oval, such as

Dimension size = getPreferredSize();
size.width = size.height = Math.max(size.width, size.height);
setPreferredSize(size);


try Oval with specific coordinates
add(newJButton("send"),newOval(2,0,2,1));

Look at
http://developer.java.sun.com/developer/TechTips/txtarchive/1999/Aug99_PatrickC.txt
This tutorial is ok, but you would have to adapt the file to be an applet

Flat View: This topic has 1 reply on 1 page
Topic: Does not Equal Operationq Previous Topic   Next Topic Topic: I am having a hard time running a jar file.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use