Solved

how to create a nice buttons

Posted on 2004-03-25
6
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

626 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