Solved

how to create a nice buttons

Posted on 2004-03-25
6
204 Views
Last Modified: 2010-03-31
HI i have been looking for a how to create a different kind of button  much for example with round corners no the default button with a color in the background
thank you
0
Comment
Question by:dentrita
6 Comments
 

Accepted Solution

by:
pradeepbkumar earned 50 total points
ID: 10684542
Hi,
The best way to create a Button with good look and feel is to write ur own CSS. I could help u out with the CSS in the following code snippet. Take a look at it.

Example 1:
.Button {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: 10px;
      background-color: #E4E9FC;
      padding-top: 1px;
      padding-right: 1px;
      padding-bottom: 1px;
      padding-left: 1px;
      border-color: #474747 #B3B7C6 #777A83 #6699CC;
      border-style: ridge;
      border-top-width: 1px;
      border-right-width: 1px;
      border-bottom-width: 1px;
      border-left-width: 1px;
      font-weight: bold;
}

Example 2:
.ButtonRed {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: 10px;
      background-color: #FF6633;
      padding-top: 1px;
      padding-right: 1px;
      padding-bottom: 1px;
      padding-left: 1px;
      border-color: #474747 #B3B7C6 #777A83 #6699CC;
      border-style: ridge;
      border-top-width: 1px;
      border-right-width: 1px;
      border-bottom-width: 1px;
      border-left-width: 1px;
      color: #FFFFFF;
      font-weight: bold;

}

Put these snippets into ur Styles.css file and refrresh the page.


Also one more alternative would be to use ready made images of ur choices.. u will get them from any search engine.

Hope this was useful...

Regards,
Pradeep
0
 
LVL 15

Expert Comment

by:Javatm
ID: 10685017
Hi Friend;

JButton b = new JButton();

// Set the button color . . .
b.setBackground(Color.blue);

// Add picture to button . . .
ImageIcon i2 = new ImageIcon("your path/picture2.gif");
b.setIcon(i2);

// Customize the buttons your way . . .
b.setPressedIcon(createImageIcon("sample2.gif"));
b.setRolloverIcon(createImageIcon("sample3.gif"));
b.setDisabledIcon(createImageIcon("sample4.gif"));
b.setMargin(new Insets(0,0,0,0));

Hope that helps . . .
Javatm
0
 
LVL 3

Expert Comment

by:oraelbis
ID: 10685158
Try use skinable look and feel, there are many diffrent skins for all elements, not only for buttons.
see:

https://skinlf.dev.java.net/
http://www.l2fprod.com/
http://www.shudo.net/java/skinlf/

0
 
LVL 3

Expert Comment

by:oraelbis
ID: 10685160
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 10688426
If you have JAVA JDK then you have excellent examples too:

look for the file      E:\j2sdk1.4.2_03\demo\jfc\SwingSet2\SwingSet2.jar

In my case it's on partition E: and it's version 1.4.2_03.

Run it with   javaw -jar <path>

If you like the demo's, click for the source code.

;JOOP!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now