JButton question, with clarification

here is what i want for my JButton:
| 1 |
and here is what is happening:
| ... |
the reason I think what is happeneing is happening is because the size of the button is too small, so it is not displaying the "1" inside it.
the trivial solution of increase the size of the button to allow the label to display is useless for me. I need the size to be 32x32 pixels.
how do i FORCE the label to display. i have tried messing with the fonts, with the layout, everything.
plz help.
thnx.

All you need to do is set the border to a minimal size, i.e.
     Dimension d = new Dimension (size, size);
          but.setPreferredSize (d);
          // but.setSize (size, size);
          Insets i = new Insets (1,1,1,1);
          but.setMargin (i);
Here is my whole test program:
import java.awt.*;
import javax.swing.*;
public class ButtonTest extends JPanel {
JButton but = new JButton ("1");
public ButtonTest (int size) {
     Dimension d = new Dimension (size, size);
          but.setPreferredSize (d);
          // but.setSize (size, size);
          Insets i = new Insets (1,1,1,1);
          but.setMargin (i);
add (but);
public void printSize () {
     Dimension d = but.getSize();
     System.out.println ("width = " +
                              d.width + " height = " + d.height);
public static void main (String [] args) {
JFrame frame = new JFrame ("Border Test");
Integer s = new Integer (args[0]);
ButtonTest ats = new ButtonTest(s.intValue());
frame.getContentPane().add("Center", ats);
frame.pack();
//frame.setSize (100, 100);
frame.setVisible (true);
ats.printSize();

Similar Messages

  • How do I reset my apple id security question with out a rescue email

    How do I reset my apple id security question with out a rescue email?

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (101013)

  • Basic questions with respect to ABAP WebDynpro Application

    Hi All,
    I have two basic questions with respect to an ABAP WebDynpro application :
    a) If an ABAP WebDynpro application has been developed, how could it be made available to the end user?
    b) Can an ABAP WebDynpro application be developed in ECC or is it only applicable for version 4.6c?
    Thanks & Regards,
    Sushanth Hulkod

    Sushanth Hulkod wrote:
    > a) If an ABAP WebDynpro application has been developed, how could it be made available to the end user?
    >
    > b) Can an ABAP WebDynpro application be developed in ECC or is it only applicable for version 4.6c?
    a) If an ABAP WebDynpro application has been developed, how could it be made available to the end user?
    Answer - By providing direct link of the WD application created in SE80, creating iView for webdynpro abap application in the portal environment and  NWBC environment
    b) Can an ABAP WebDynpro application be developed in ECC or is it only applicable for version 4.6c?
    Answer - Yes it can be developed in ECC. Webdynpro ABAP is introduced in NW 2004s (SAP NetWeaver 7.0 or ECC 6.0)
    Thanks,
    Chandra

  • I cannot purchase anything at the itunes store because I am being ask for my security questions, but I don't remember them. How do you change you security questions with out knowing them?

    I cannot purchase anything at the itunes store because I am being ask for my security questions, but I don't remember the answers. I tried going to appleied.apple.com but I won't allow me to change my security answerswithout answering the original questions. How do you change you security questions with out knowing them? I need help.

    Welcome to the Apple Community.
    Start here, and reset your security questions, you will receive an email to your rescue address, use the link in the email and reset your security questions.
    If that doesn't help or you don't have a rescue address, you might try contacting Apple through iTunes Store Support

  • How do you resets your apple I'd security question with out calling apple

    How do you resets your apple I'd security question with out calling apple

    See Kappy's great User Tips.
    See my User Tip for some help: Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities https://discussions.apple.com/docs/DOC-4551
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Send Apple an email request for help at: Apple - Support - iTunes Store - Contact Us http://www.apple.com/emea/support/itunes/contact.html
    Call Apple Support in your country: Customer Service: Contacting Apple for support and service http://support.apple.com/kb/HE57
     Cheers, Tom

  • I need some more interview question with answer on modeling,reporting.

    i need some more interview question with answer on modeling,reporting.

    Hi,
    You may find tons of topic about interview question. Please try to search forums before opening a post next time.Take a look at the link below.
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=bwinterviewquestions&adv=true&adv_sdn_all_sdn_author_name=
    Regards,
    ®

  • HT201303 Have forgotten my apple I'd security questions with respective answers

    Have forgotten my apple I'd security questions with respective answers

    Forgotten security questions - https://discussions.apple.com/message/18402551
    More involved forgotten question issues - https://discussions.apple.com/thread/3961813
    Frequently asked questions about Apple ID - http://support.apple.com/kb/HE37

  • Trying to teach self Java-question with arrays

    I have a question with arrays. I have a simple inventory program that I am writing(very simple). I have declared and created my array. Is this the time I should build a new class outside of my main in order to hold my array? I am still trying to sort through classes and when to create them. My thought is that because it is a hierarchy I should have a new class. For example, Albums is at the top and then there are specific types of albums, like TributeAlbum, PremiereAlbum, etc. Do I need a class for each of these? When I create the class, do I use the same name as the array?
    More info, just in case: My original class is AlbumInventory. I have created an array to hold 25 TributeAlbums which has 4 instance variables.
    Question 2: Why can I not refer to an album variable like TributeAlbums[0].itemNumber?
    Thanks in advance for your input.
    Denise

    I have a question with arrays. Okay.
    I have a simple
    inventory program that I am writing(very simple). I
    have declared and created my array. Is this the time
    I should build a new class outside of my main in
    order to hold my array? In an OO language classes are usually a good idea.
    I am still trying to sort
    through classes and when to create them. My thought
    is that because it is a hierarchy I should have a new
    class.This sounds a bit confused. You should have a new class when it is appropriate to do so.
    For example, Albums is at the top and then
    there are specific types of albums, like
    TributeAlbum, PremiereAlbum, etc. Do I need a class
    for each of these? Not sure. Why is the type not an attribute of the Album class? This (attribute) seems at first glance to be the way to do it.
    When I create the class, do I use
    the same name as the array?
    ? I am going to say no but I'm not following what you are really asking here.
    More info, just in case: My original class is
    AlbumInventory. I have created an array to hold 25
    TributeAlbums which has 4 instance variables.
    Can you please post some of your actual formatted code? It would also be helpful to know what the attributes for an Album are as you have them.

  • HT1911 I am not answering the security question with the answer APL wants.  What do I do?

    I am not answering the security question with the answers APL wants.  What do I need to do to get past the security questions to reset my password?

    Welcome to Apple Support Communities
    Hold Power and Home buttons for 10 seconds until your iPad restarts, and you will be able to use it again. After doing this, open Settings > iCloud > Storage & Backup, and make a manual backup

  • HT5576 E-mail to Kdnci Alveamcunnina change their security questions with Apple Can I change the email link Barsaalh change the email to the main email with Apple

      E-mail to Kdnci Alveamcunnina change their security questions with Apple Can I change the email link Barsaalh change the email to the main email with Apple

    Contact Apple and ask the account security team for assistance: http://support.apple.com/kb/HT5699.

  • Architecture/Design Question with best practices ?

    Architecture/Design Question with best practices ?
    Should I have separate webserver, weblogic for application and for IAM ?
    If yes than how this both will communicate, for example should I have webgate at both the server which will communicate each other?
    Any reference which help in deciding how to design and if I have separate weblogic one for application and one for IAM than how session management will occur etc
    How is general design happens in IAM Project ?
    Help Appreciated.

    The standard answer: it depends!
    From a technical point of view, it sounds better to use the same "midleware infrastructure", BUT then the challenge is to find the lastest weblogic version that is certified by both the IAM applications and the enterprise applications. This will pull down the version of weblogic, since the IAM application stack is certified with older version of weblogic.
    From a security point of view (access, availability): do you have the same security policy for the enterprise applications and the IAM applications (component of your security architecture)?
    From a organisation point of view: who is the owner of weblogic, enterprise applications and IAM applications. In one of my customer, application and infrastructure/security are in to different departments. Having a common weblogic domain didn't feet in the organization.
    My short answer would be: keep it separated, this will save you a lot of technical and political challenges.
    Didier.

  • How do I reset my security questions with out having to select a new apple id or a new password?

    How do I reset my secrit questions with out having to select a new apple id or a new password when I'm at the itunes store.

    You will be able to reset them via:
    appleid.apple.com
    If you do not know your password contact Apple's expresslane:
    expresslane.apple.com

  • Stupid JButton Question

    Really 2 questions
    1) Ive noticed in the tutorials a high level object in which JButton objects are placed all implement ActionListener, and correspondingly implement
    public void actonPerformed(ActionEvent e)
    somewhere
    Ive been going over some code I wrote a while ago (I forgot how to do all this stuff for my new app from then till now) and I noticed I was always doing
    someButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    executeSomeMethod();
    I realize that if all the buttons invoke independent methods it is probably better to use the second method.
    In the application I am currently developing the buttons are used to select parameters for the method invoked. Im thinking the first method might be better -- I am asking if this is the case, and if it is best to follow the tutorials (I was thinking they might be a bit old, so maybe are out of date)
    This leads up to question 2).
    The buttons select which items to remove from an internal list. Each button ids an item. How do I identify the button when the actionPerformed method is invoked? I know about setActionCommand().
    Q 2a is: Is there a better way to id the button? Each Button is associated with a Card (as in a poker deck), so the cards/buttons are IDd by a byte for suite, and a byte for value. I would like to avoid comparing strings if possible.
    Thanx in advance.

    // Action Command can be anything
    JButton[] but = new JButton[totalButtonCount]; // an array could be used (Vector = best)
    for(int x = 0; x < but.length; x++) {
        but[x] = new JButton(buttonText);
        but[x].setActionCommand("but " + x); // a string with the current index
        addButton(but[x], location);
    // So when parsing
    public void actionPerformed(ActionEvent e) {
       Object source = e.getSource();
        if(source instanceof JButton) {
             JButton but = (JButton) source;
            for(int x = 0; x < totalButtonCount; x++) {
                 if(but.getActionCommand().equals(but[x].getActionCommand) );
                     fireButtonAction(but.getActionCommand());
    } Is this of any help?
    ICE

  • How do i reset my apple ID questions with my email not working

    I forgot my apple ID question answers and my reset info email does not work anymore...
    PLEASE HELP        

    Alternatives for Help Resetting Security Questions and/or Rescue Mail
         1. If you have a valid rescue email address, then use this procedure:
             Rescue email address and how to reset Apple ID security questions.
         2. Fill out and submit this form. Select the topic, Account Security. You must
             have a Rescue Email to use this option.
         3. This is the only option if you do not already have a valid Rescue Email.
             These are telephone numbers for contacting Apple Support in your country.
             Apple ID- Contacting Apple for help with Apple ID account security. Select
             the appropriate country and call. Ask to speak to the Account Security Team.
         4. Account security issues almost always require you to speak directly to an
             Apple representative to securely establish your identity as the account holder.
             You can set it up so that Apple calls you, either immediately or at a time
             convenient to you.
                1. Go to www.apple.com/support.
                2. Choose Contact Support and click Contact Us.
                3. Choose Other Apple ID Topics and choose the appropriate topic for
                    your issue.
                4. Follow the onscreen instructions.
             Note: If you have already forgotten your security questions, then you cannot
             set up a rescue email address in order to reset them. You must set up
             the rescue email address beforehand.
    Your Apple ID: Manage My Apple ID.
                            Apple ID- All about Apple ID security questions.

  • How can I make a fill-in-the-blank question with partial score?

    I need to make an evaluation test with some questions. Some of them is a fill-in-the-blank question and it has to have partial score.
    I have:
    4 fields (text entry boxes) with: retain text, validate user input;
    also checked include in quiz, with points, add to total and report answers;
    an action that disables the 4 fields when the student is on review mode (otherwise it would be possible to change the answer after submitting the answers);
    Problems:
    I can't give feddback to the student: if i turn on success/failure captions the student will see them while answering, if i turn them off he wont know what's the right answer. I tried to use a shape to hide captions but the captions are always in front of the shape;
    When reviewing the test something happens and the second time we see the results slide it assumes that the fields in the FIB question are empty;
    Notes: it will be used in Moodle, as a scorm package
    What can I do?

    I have a test with some questions (multiple choice, FIB, matching, etc). I have just one button to submit all the answers, and after submiting the student can see his score and review the test to know where he failed. He can't answer again. However, he can change the answer multiple times before submiting.
    "if i turn on success/failure captions the student will see them while answering" - before submitting
    "if i turn them off he wont know what's the right answer" - after submitting
    My results page is the default. I didn't use any variable. When i go to the results page after reviewing the test all the entry boxes are "wrong".

Maybe you are looking for

  • Songs cannot be updated please help!

    I am receiving an error message every time I plug in my iPod. It says...Songs on the ipod "The Pod" cannot be updated because all of the playlists selected for syncing no longer exist. I only started getting problems once my itunes library surpassed

  • Opening File Opens Window Full Screen

    When ever I open a file in Illustrator CS5, the window full sizes on me. How can I make Illy not open the window all the way when I open a file? Thanks for any help or advice on this, Paul

  • Ios 8 com.apple.snapshot.battery.maxCapacity error

    I use to check my battery max capacity via com.apple.snapshot.battery.maxCapacity in ios 7 and the maximum capacity of battery is 1300 to 1355 but when I update to ios8 the number stuck at 1400, is it the bug of ios8 ? any one have an idea to solve i

  • How do I insert an image into the body of a Yahoo email using Firefox?

    I've tried copy and paste from Photobucket, but that doesn't work. I'm asking how to have the image appear in the body of the email, not as an attachment.

  • PHOTOSMART C8100 SERIES ALL IN ONE PRINTER, SCANNER, COPIER

    I HAVE HAD THIS PRINTER FOR A WHILE NOW BUT AFTER A SHORT WHILE OF BEING ABLE TO PRINT WIRELESSLY AND SCAN THINGS TO MY COMPUTER IT STOPPED AND I HAVE TO PUT IN A USB TO PRINT OFF AND IT WONT SCAN TO MY COMPUTER.  I HAVE AN APPLEMAC PRO....ANY SUGGES