Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Button not showing unicode

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    5
    My Mood
    Stressed
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Button not showing unicode

    I am trying to display an arrow on a button using Unicode , but all I am getting is (...)
    it only works when ever I remove the setPreferredSize. Is there any other way to have it displayed??
    code:
    JButton backSpace = new JButton("\u2190");
    		backSpace.setPreferredSize(new Dimension(25, 25));


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,170
    My Mood
    Hungover
    Thanks
    141
    Thanked 599 Times in 514 Posts

    Default Re: Button not showing unicode

    You're making the button too small to show the text.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,469
    My Mood
    Mellow
    Thanks
    151
    Thanked 609 Times in 596 Posts

    Default Re: Button not showing unicode

    I believe the elipses indicates the button size is not large enought to display the desired character. Shrink the character or increase the size of the button or whatever is restraining it to be too small.

  4. #4
    Junior Member
    Join Date
    Oct 2013
    Posts
    5
    My Mood
    Stressed
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: Button not showing unicode

    I have changed the font size, but all it does is shrink the (...)

    --- Update ---

    Works, I made the button transparent and now it show the arrow
     JButton backSpace = new JButton(keys[16]);
    		 backSpace.setOpaque(false);
    		 backSpace.setContentAreaFilled(false);
    		 backSpace.setBorderPainted(true);
    		 backSpace.setBorder(new LineBorder(Color.RED, 2));
    		 backSpace.setPreferredSize(new Dimension(25, 25));
    		 backSpace.setForeground(Color.RED);

  5. #5
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,170
    My Mood
    Hungover
    Thanks
    141
    Thanked 599 Times in 514 Posts

    Default Re: Button not showing unicode

    I think it has more with setting the border than it does the transparency.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. [SOLVED] how can i convert unicode to string?
    By atrixes in forum Java Theory & Questions
    Replies: 4
    Last Post: January 3rd, 2013, 07:53 PM
  2. Replies: 3
    Last Post: March 6th, 2012, 02:50 AM
  3. combobox unicode problem
    By trexi in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: January 18th, 2011, 10:06 AM
  4. java and unicode ...
    By abesha in forum Java Theory & Questions
    Replies: 2
    Last Post: November 15th, 2010, 10:25 AM
  5. Use of Unicode 5.1 in MySQL DB with Java
    By Desert Fox in forum JDBC & Databases
    Replies: 2
    Last Post: November 12th, 2008, 07:29 AM