Results 1 to 9 of 9
  1. #1
    unhurt is offline Member
    Join Date
    Oct 2007
    Posts
    21
    Rep Power
    0

    Question weird looking shape JButton is it possible?

    hi, im want to make a non rectangular shape button is it any possible? shapes like pentagon, maybe slanted on the side of maybe a 'L' shape button
    if by using graphic and draw will it still have the same look and feel of a JButton and a function of a JButton?? how is it done?

  2. #2
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

  3. #3
    unhurt is offline Member
    Join Date
    Oct 2007
    Posts
    21
    Rep Power
    0

    Default

    ah, my bad for not searching the forums first lol, and THANKS for the link

  4. #4
    unhurt is offline Member
    Join Date
    Oct 2007
    Posts
    21
    Rep Power
    0

    Default

    hey JavaBean do u know why as i can't run the applet on the web or compile and run the .java file from

    Lightweight Components
    under round button

    i keep getting this

    J:\Java\test>javac ExampleApplet.java
    ExampleApplet.java:35: cannot find symbol
    symbol : class RoundButton
    location: class actual.ExampleApplet
    RoundButton button1 = new RoundButton("Button 1");
    ^
    ExampleApplet.java:35: cannot find symbol
    symbol : class RoundButton
    location: class actual.ExampleApplet
    RoundButton button1 = new RoundButton("Button 1");
    ^
    ExampleApplet.java:38: cannot find symbol
    symbol : class RoundButton
    location: class actual.ExampleApplet
    RoundButton button2 = new RoundButton("Button 2");
    ^
    ExampleApplet.java:38: cannot find symbol
    symbol : class RoundButton
    location: class actual.ExampleApplet
    RoundButton button2 = new RoundButton("Button 2");
    ^
    ExampleApplet.java:41: cannot find symbol
    symbol : class RoundButton
    location: class actual.ExampleApplet
    RoundButton button3 = new RoundButton("Java is Cool!");
    ^
    ExampleApplet.java:41: cannot find symbol
    symbol : class RoundButton
    location: class actual.ExampleApplet
    RoundButton button3 = new RoundButton("Java is Cool!");
    ^
    6 errors

    as long as i have the
    package actual;
    and
    import actual.*;

    what am i suppose to do to run them??

  5. #5
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    The compiler can not find RoundButton class. Remove package instruction from RoundButton class, place both codes in the same directory and try to compile. It should work..

  6. #6
    unhurt is offline Member
    Join Date
    Oct 2007
    Posts
    21
    Rep Power
    0

    Default

    well i comment on the package and i got this

    J:\Java\test>java RoundButton
    Exception in thread "main" java.lang.NoSuchMethodError: main

    i did put them all in the same directory, im just missing the picture they mention in exampleapplet

    background = parentApplet.getImage(parentApplet.getCodeBase(), "actual/images/scott.jpg");

    am i doing this right? i try running in appletviewer app.html but nothing

  7. #7
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    You can download the image too. Append that relative path to the path of the applet and download image with your browser.

    You will not run RoundButton, it is an auxiliary class. You will run applet class using appletviewer.exe! But appletviewer uses html as parameter so you will need to download html file and modify it to point to the local path...

    I recommend you to create a very simple swing application using that RoundButton. Just write your JFrame with a regular JButton. Once yo uare sure that it is working, place RoundButton to the same directory, replace JButton words with RoundButton, recompile and rerun to see the result. That might be easier for you if you did not develop an applet before.
    Last edited by JavaBean; 11-02-2007 at 01:18 PM.

  8. #8
    unhurt is offline Member
    Join Date
    Oct 2007
    Posts
    21
    Rep Power
    0

    Default

    i change all the JButton into the RoundButton, it works but is the result produce this way and running it through the applet any different? im getting a line drawn round circle and the text inside it looks crude lol, i haven try the thread u provided fully yet, am getting down to things now.
    so in the end i just want to know, can i still get the same look and feel of a standard JButton? with the same gradiant colour, emboss and able to get actionlistener ??

  9. #9
    JavaBean's Avatar
    JavaBean is offline Moderator
    Join Date
    May 2007
    Posts
    1,270
    Rep Power
    10

    Default

    I did not use that class. I dont know the result.

    can i still get the same look and feel of a standard JButton? with the same gradiant colour, emboss and able to get actionlistener ?
    That should be possible but you might need to hack the source code of JButton..

Similar Threads

  1. Help with Move Shape
    By romina in forum AWT / Swing
    Replies: 2
    Last Post: 12-09-2010, 03:25 AM
  2. need help, weird question kinda.
    By carlos123 in forum New To Java
    Replies: 6
    Last Post: 01-22-2008, 03:19 AM
  3. implementing shape
    By sidkdbl07 in forum Java 2D
    Replies: 1
    Last Post: 01-12-2008, 06:42 PM
  4. Weird data output
    By Shaolin in forum New To Java
    Replies: 12
    Last Post: 12-11-2007, 04:27 PM
  5. How to change shape of JButton
    By FaRuK in forum AWT / Swing
    Replies: 1
    Last Post: 05-19-2007, 12:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •