By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,202 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

class files layout? round java button possible?

P: n/a
hi

I have 2 questions..

1) I am a little confused about how i should layout my java files..ie, how
it's normally done..i have a heep of classes in one file...mostly JPanel
and a button class i made, as well as a class that extends frame...is it
proper technique to put each class in it's separate file, and make it
public? or should i just leave it in one file, as all the classes are
components for one form?

2) also, i need a round button...i get the impression java doesn't support
round buttons...is this true?

thanks
Joseph
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Joseph" <ka****@bigpond.com> wrote in message
news:xv******************@news-server.bigpond.net.au...
hi

I have 2 questions..

1) I am a little confused about how i should layout my java files..ie, how
it's normally done..i have a heep of classes in one file...mostly JPanel
and a button class i made, as well as a class that extends frame...is it
proper technique to put each class in it's separate file, and make it
public? or should i just leave it in one file, as all the classes are
components for one form?
Yes, 1 class per .java file is the norm. If you need more structure you can
use packages.

2) also, i need a round button...i get the impression java doesn't support
round buttons...is this true?


You could code your own. Someone has probably done this already. Try
searching google.

John
Jul 17 '05 #2

P: n/a
John wrote:
"Joseph" <ka****@bigpond.com> wrote in message
news:xv******************@news-server.bigpond.net.au...
hi

I have 2 questions..
2) also, i need a round button...i get the impression java doesn't support
round buttons...is this true?

You could code your own. Someone has probably done this already. Try
searching google.


I know of examples of how to design a button "Decorator". Honnestly
when i had to do it i just overloaded JButton and redid the paint method
to look like (i'me typing this, do your own coding :) ):

public JMyButton(){
super();
this.setBorder( BorderFactory.createEmptyBorder() );
}
public paint( Graphics g ){
super(g);
Graphics2D gr = (Graphics2D) g;
gr.drawEllipse( this.getX(), this.getY().... ) etc etc etc..
}

John

Jul 17 '05 #3

P: n/a

"Joseph" <ka****@bigpond.com> wrote in message
news:xv******************@news-server.bigpond.net.au...
hi

I have 2 questions..

1) I am a little confused about how i should layout my java files..ie, how
it's normally done..i have a heep of classes in one file...mostly JPanel
and a button class i made, as well as a class that extends frame...is it
proper technique to put each class in it's separate file, and make it
public? or should i just leave it in one file, as all the classes are
components for one form?

2) also, i need a round button...i get the impression java doesn't support
round buttons...is this true?

thanks
Joseph


Any Swing application that uses the Aqua Look and Feel has round buttons. As
others have said you can slo code your own.

Silvio Bierman

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.