Article View: borland.public.jbuilder.java.swing
Article #9958JButton borders
From: George Lefter
Date: Sun, 19 Dec 1999 00:00
Date: Sun, 19 Dec 1999 00:00
21 lines
1156 bytes
1156 bytes
hello. how can i draw a rectangle exactly on a button's border/edges?
the code below draws the rectangle above and in the left of the button..
how should i change the line g.drawRect(..) ?
thank you
public class myFrame extends JFrame {
static JButton b1;
public void paint(Graphics g) {
g.drawRect( b1.getX(), b1.getY(), b1.getWidth(),
b1.getHeight() );
}
public static void main(String s[]) {
b1= new JButton("A Button");
Container p= this.getContentPane();
p.setLayout(null);
p.add(b1);
b1.setBounds( 100, 100, 75, 30);
...
}
}
Technical Details
Message-ID:
<385C6336.DFBE63B1@void.art.ro>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,c49df965457840ee,start X-Google-Attributes: gid111d45,public From: George Lefter <giku@void.art.ro> Subject: JButton borders Date: 1999/12/19 Message-ID: <385C6336.DFBE63B1@void.art.ro> X-Deja-AN: 562534816 Content-Transfer-Encoding: 7bit Organization: Another Netscape Collabra Server User X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing