How to get JTextFields to look "good".....?

sup, I cant seem to get my JTextFields to be displayed at the right height(as tall as the characters) in ANY window size.... they just fill up the entire panel top to bottom. what layout should I use?
thanks
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Calculator extends JFrame implements ActionListener {
private static final int WIDTH = 300;
private static final int HEIGHT = 200;
private static final int CHAR_PER_LINE = 10;
private JTextField text1, text2, result;
public static void main(String[] args) {
Calculator demo = new Calculator();
demo.setVisible(true);
public Calculator() {
setSize(WIDTH, HEIGHT);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Calculator");
Container content = getContentPane();
content.setLayout(new GridLayout(3, 1));
JPanel row1 = new JPanel();
row1.setLayout(new BoxLayout(row1, BoxLayout.X_AXIS));
JLabel label1 = new JLabel("Number 1:");
row1.add(label1);
text1 = new JTextField(CHAR_PER_LINE);
row1.add(text1);
content.add(row1);
JPanel row2 = new JPanel();
row2.setLayout(new BoxLayout(row2, BoxLayout.X_AXIS));
JLabel label2 = new JLabel("Number 2:");
row2.add(label2);
text2 = new JTextField(CHAR_PER_LINE);
row2.add(text2);
content.add(row2);
JPanel row3 = new JPanel();
row3.setLayout(new BoxLayout(row3, BoxLayout.X_AXIS));
JLabel label3 = new JLabel("Result:");
row3.add(label3);
result = new JTextField(CHAR_PER_LINE);
row3.add(result);
content.add(row3);
JMenu operMenu = new JMenu("Oper");
JMenuItem m;
m = new JMenuItem("Add");
m.addActionListener(this);
operMenu.add(m);
m = new JMenuItem("Sub");
m.addActionListener(this);
operMenu.add(m);
JMenuBar mBar = new JMenuBar();
mBar.add(operMenu);
setJMenuBar(mBar);
public void actionPerformed(ActionEvent e) {
String command = e.getActionCommand();
int number1 = Integer.parseInt(text1.getText().trim());
int number2 = Integer.parseInt(text2.getText().trim());
if (command.equalsIgnoreCase("Add"))
result.setText(Integer.toString(number1 + number2));
else if (command.equalsIgnoreCase("Sub"))
result.setText(Integer.toString(number1 - number2));
else
result.setText("Error in GUI");
}

Get rid of Boxes! As has already been said this ui begs for a GridBagLayout. Even if you just comment out setting the layout of the three panels the textfields' sizes are good.
Cheers
DB

Similar Messages

  • How to get the same look as flash for borders?

    Hi i have selected circle and filled the circle with some color. now i want to have border around the circle so i have saelected stroke from the edit menu and applied with one pixel. how ever it is not giving a solid look as in flash. in photoshop the border looks like disolved and transparent. is there a way to get the same look as flash?

    Look at the image. i have described everything there in the image itself. even when we use layer style it is the same problem. is there a way to resolve this? the text in the image is as below.
    if u carefully observe the circle pointed there is a slight gap between the border and the filled color. This is not good. i dont want any gaps between the border and the filled color. I have used bucket to fill the circle and used stroke from edit menu to get the border for the circle.

  • How to make my websites look good in iPhone and iPad?

    I have problem to make my website in iWeb look good in webbrowsers in iPhone or iPad... The background (JPEG-file)are dublicating several times!
    But that's not a problem for all my different sides, thou it was build in the same way. Here's the site (try to looka at it in a webbrowswer in any handheld
    divice): http://www.clavius.se

    That's the way Mobile Safari handles backgrounds.
    Why not use a normal background with proper text boxes.
    Anyway, remove your background in iWeb and paste this code in a HTML Snippet :
    <script language="JavaScript" type="text/javascript">
    <!--
    parent.document.body.style.backgroundImage='url(http://www.clavius.se/entresida.jpg)';
    parent.document.body.style.backgroundRepeat='no-repeat';
    parent.document.body.style.backgroundPosition='50% 0%';
    // -->
    </script>
    where the background file (entresida.jpg) is OUTSIDE the Site folder iWeb creates.
    BTW, here's how I make iPad friendly websites with iWeb :
         http://www.wyodor.net/mfi/

  • How to get a cinematic look?

    I just did a small 4 minute movie in FCE 4 and would like to get a cinematic look. There's actually a function on my camera (Canon HF 100) to get this type of look along with using a frame rate of PF24 but I didn't use it.
    Is there a certain video filter I can use to try to obtain this type of look?

    Good thing you didn't use the 24p mode on your camcorder, because FCE doesn't work with 24p footage.
    Try looking over this thread and see if it's of any use:
    http://discussions.apple.com/thread.jspa?messageID=8938482&#8938482

  • Need help with getting images to look smooth (without the bitmap squares) around the edges. When I transfer the image from pictures, it sets itself into the InDesign layout, but with square edges. I need to find out how to get it to look smooth?

    Need to find out how to get my images transferred into an InDesign layout without the rough edges, as with a bit map image, but to appear with smooth edges in the layout. I can notice it more when I enlarge the file (pic). How can I get it to appear smooth in the finished layout. Another thing too that I noticed; it seems to have effected the other photos in the layout. They seem to be
    pixelated too after I import the illustration (hand drawn artwork...)? Any assistance with this issue will be greatly appreciated. Thanks in advance.

    No Clipboard, no copy & paste, as you would not get the full information of the image.
    When you paste you can't get the image info from the Links panel, but you can get resolution and color info either via the Preflight panel or by exporting to PDF and checking the image in Acrobat.
    Here I've pasted a 300ppi image, scaled it, and made a Preflight rule that catches any image under 1200ppi. The panel gives me the effective resolution of the pasted image as 556ppi. There are other workflow reasons not to paste—you loose the ability to easily edit the original and large file sizes—but pasting wouldn't cause a loss in effective resolution or change in color mode.

  • How to get the original look of firefox 4 with 'firefox button' on top then bookmarks lane following with address bar..?

    i have been using firefox 3.6.16 and just upgraded to version 4 last night. actually the problem is this, in my browser the 'firefox button' and all tabes are shown in the same lane on top.
    what i want is to get the default look of firefox 4 with firefox button on top and all the tabs appearing on beneath this button..(not in same lane)
    am i having due to any preference setting or else? please help

    If the Firefox window is maximized, it will display the tabs in the same line as the Firefox button, it only displays them on a separate line on a non-maximized window.

  • How to get more professional look?

    I know of and have read in other threads of things that can be done in pre-production and shooting to achieve a more professional look.
    I was wondering if any pros out there have advice for the amateurs like me in terms of post-production. What can I do in FCP to give my DV footage a more professional appearance? eg - filters, etc or techniques?
    I appreciate the advice!

    I assume that professionals often look at an amateur
    production and say "if they only would have..." or
    whatever. THAT's the information I'm looking for.
    Yes. Here's my take. I'm a film editor who's had the privilege to work on $100 movies to $100 million movies.
    STORY is king. If your story is working, and crafted well, and paced properly, you can get away with almost whatever you want. For instance, when I cut scenes, I cut for performance... I don't toss out takes because the glass of water was full in take one but empty in another. 9 times out of ten, even the seasoned filmmakers I'm working with never see the continuity errors because the performances are working.
    Occasionally I work with first time directors, helping them with their first short. I see two main mistakes. First, they think that if someone knows how to operate Final Cut or an Avid, that they are an editor. This is simply not true. I know how to use a chisel, but there is no way in **** I could sculpt the David. Editing is the same: knowing what buttons to push is the least important part of editing. Knowing how to tell a story well is EVERYTHING. In fact, I know one Oscar winning editor who spent many years never touching the equipment at all. She chose the cut points, and had her assistants do the physical cutting.
    The second main mistake amateur filmmakers make, IMO, is that they are not vicious enough when cutting their material. Every single frame of film you project should be conveying new information to the audience. If it's not, get it out. I once did a fixit job on a film for a first time director. The film was pretty funny, but he had shot all these long panning and dolly shots as establishing shots for scenes. I told him we should take them out, and at first he balked because one dolly shot in particular had been so difficult to set up and film. But the audience doesn't care about that. All they know is that they are watching a ten second camera move with nobody talking and no jokes in it. When we went through and pulled all this stuff out, it was like a completely different film. The director was overjoyed. Plus, without all this junk in the film, when you did choose to sit in a shot and have nothing happen for a few seconds, it then meant something. In a way, it was giving new information, even though nothing was happening.
    That's my two cents worth. I haven't seen you're project, but I'd suggest watching it through again and question every shot, every line of dialog, every pause you have in there. Ask yourself "What new information is this element telling? Why do I have it in? Do I need it? Have I already told this story point?" etc. I suspect if you tighten the story you're telling so there are no wasted frames, people may not care as much about the handycam look.
    Dual 2Ghz G5, ibook G4, 1.6 Duo Mini   Mac OS X (10.4.7)  

  • How to get the cinematic look with FCE 4?

    I have an hdr-sr 10 camera with avchd and am using FCE 4.
    How or what are the steps I need to take to get that film or cinematic look? Is there a special combination of filters I need to use? Is there a setting on the camera I need to use as well?
    Mike

    Light the scene carefully.
    Turn off detail enhancement on the camera.
    Never zoom; move the camera instead--using a home-made dolly, for example.
    Try to set up your shots to decrease depth of field,
    by setting your aperture to the smallest number (f1.8)
    and keeping your optical zoom maxed out--if possible.
    Use zebra stripes; never overexpose.
    Shoot multiple takes from different angles.
    Get your microphone close to the talent.
    Turn off auto-focus and auto-exposure.
    Turn on Progressive Shutter Mode.
    Use a tripod to make sure your establishing shots are rock steady.
    Edit without dissolves, unless you're showing the passage of time.
    Check out whether these filters will work with FCE4:
    http://pistolerapost.com/pluginz/index.html
    Go to Ken Stone's site, and scroll down to Film Look:
    http://www.kenstone.net/fcphomepage/fcp_homepageindex.html
    When shooting, wear a beret.

  • IDVD quality update... how to get the best looking photo images on your TV

    To get the best quality photo slideshow (that looks the best on my TV)
    1) create the slideshow with music in "Photo to Movie" program
    2) send it to IDVD from "Photo to Movie"
    3) create the menu in iDVD
    4) make a disc image from iDVD (file - save as disk image) save on the desktop
    5) burn DVD at x2 in disc utilities on a Verbatim DVD-R disc
    ???? Any other suggestions to get a better quality product !!
    * special thanks to SDMacuser for all your help and prior posts.
    Cheers
    iMAC 5,1,Intel Core 2 Duo,2.16GHz   Mac OS X (10.4.8)  
    iMAC 5,1,Intel Core 2 Duo,2.16GHz   Mac OS X (10.4.8)  

    in search of the best looking photoslide show DVD to view on a TV..... a couple more questions
    if I understand some of the recent posts to get a clear picture:
    Question #1
    I need to import all of the photos into photoshop CS (or a similar product) and resize them to 1280 x 960 (4:3)ratio then open iDVD and import them.
    If I am doing Ken Burn effects then resize them to 2560 x 1920 and use "Photo to Movie" to create the slideshow then import into iDVD (to get a cool menu)
    can you just bring the images in from iphoto (in the same format that they were imported from the camera)?
    I am using a Nikon D70 6.0 megapixel
    Question #2
    If I burn the disc in iDVD... it is not as good as using Disk utility or Toast because of the burn speed (2X) ... is this correct?

  • How to Get Prints that Look like what I see on my Monitor

    I am giving CDs with Xmas card images for clients to take to their local printer and print their Xmas cards. But they are getting different results than what I saw on my monitor -- often much darker. Is there something I can do to be sure that what the lab prints is the same as the image I saw on my monitor???? I have a PowerMac G5 with a 17" monitor, which I calibrated with a Monaco colorometer....I am using Photoshop CS2.

    make sure to select the ICC profile, give your clients a list of prefered printers that do color adjustment in lab for a modest fee, I like delta quest imaging and Millers, Pro color is ok, and dont even think about white house custom color they dont know color from their A**. Use a standard Profile and Gamma with all your images for consistancy, you will want to send Great Mcbeth Color charts to the lab and have them tell you what color space they are printing in. Most labs I have seen seem to be printing in Adobe RGB 1998 but many still use Adobe SRGB which may be why alot of your images may apear more saturated contrasty and darker. Also low quality labs will not check their chemisty often so I have noticed problems especialy with the fujifilm 390 mini lab and lesser models where the chemistry varys in just 1 degree and all the images look way to magenta or way too cyan!
    also keep note on the type of paper they will be printing your photos on, fijifilm paper is not going to last as long, I have heard rumers that because it is thinner it is more suseptable to oxidation and eventual fading.
    Personaly I refuse to allow any of my clients to print anything themselfs because if they end up printing it at wallmart or taking it to proex ritzcamera or wolfcamera and messing it up they arn't going to know it was the labs fault they are going to assume it was your fault and thats your reputation on the line.

  • How to get rid of Open Goods Receipts and PO's that were never invoiced

    Hi we use SAP Business one 2007A PL:08. I need to learn a way to delete all the open good receipts and purchase orders that were never invoiced. How do I do it?
    Please let me know!!
    Thanks

    Purchase orders do not have any accounting entries, so Right Click> Close will close the document.
    The same action will also close a GRPO, but this will create an accounting entry as the Goods Receipt created a debit to stock and a credit to the allocation account.  The closing entry will clear the allocation account & credit a cost of sales account which is determined in the account determination. I think it is discounts received account from memory.

  • How to get a "film" look with video

    I'm hoping someone can help me find a thread from the archives that I had seen recently, but now cannot find.
    The process that was described included "doubling" the video track, then offsetting V2 by one frame (?) then de-interlacing....or something like that.
    If that sounds familiar to anyone, and if you could point me in the right direction, I'd appreciate it. I can't remember if it had been a thread in the "FCE" discussions or "Pro Video" section, but I can't seem to find it in my searches.
    Thanks in advance for any help or suggestions.
    Gary

    Thanks. I checked out the web site, and although it only refers to FCP, I assume "Film Effects" is compatible with FCE HD v3 as well.
    I appreciate the info.
    Gary

  • HOW TO GET GOOD RES/LOW SIZE QUICKTIME - PLEASE HELP!

    Hi,
    I'm making music videos and am trying to make good quality Quicktimes for streaming on the web, with the lowest file size possible.
    The lowest I can get a 4 minute video is around 30MB, but I checked out some videos at www.flatnosegeorge.com and they're good quality as well as small file sizes (around 10MB). How do they do this..?! By contrast one of my videos (at www.tokyodragons.com) is 30MB and doesn't look as good quality!
    The settings I'm using are these:
    Video Settings: Sorenson Video 3
    Qual: High
    Motion: 25 Frames
    Key Frame Every: 250
    Lomit Data Rate to: 1100
    Sound Compressor: MPEG Audio 4
    44,100
    16 Bit
    Stereo
    Any ideas on how to get it to be good res at a lower file size..?
    Many thanks,
    Mark Locke

    H.264 video codec?
    Also, dropping the frame rate should massively effect filesize and you might not even notice the difference when viewing. If your original sequence is 25 fps try halving it to 12fps.

  • How to get this kind of film look?!

    How to get the film look like in this video:
    I shoot on the canon 60d with multiple lenses.
    Thanks.

    Thanks for the answers, finally I've got the result. May be it'll be useful for other people:
    So i've used one popular magic plugin for adjusting look with default presets  and lowered fps with default effect "Posterize time".
    Good luck

  • How To Get That Muted Yellow Colour Look

    Guys I saw a thread here yesterday were someone was asking how to get the same look as an image he linked to.  On the flickr Photoshop Support group, similar questions are asked several times a week, all looking for that distressed yellow tint affect so beloved by wedding photographers nowadays.  It drives me crazy, and not just with how often it was asked, but why so many people would want to ruin a decent photograph.  So you can image how happy I was to find this issue of the What The Duck cartoon:

    Thank you SO much! I needed that laugh here on a Monday morning.
    Also; I always suspected that was how it was done.
    --OB

Maybe you are looking for

  • Getting class not found error running java application using OIM libraries

    Hi, I have created a java application in which I access OIM libraries to fetch user list and then assign user roles. As i run the application it generates exception and program crashes. However, I am using the same libraries in OIM adapters and it is

  • Not Updating in Central SLD

    Hello, Upon performing our daily system checks, one of the item is to monitor the sending of SLD data of the installed systems in the System Landscape to the Central SLD which in our case is the XI box. Four of our systems having Java stack did not u

  • MyAccount registration and login support 24/7

    If you have trouble registering or logging in to MyAccount, try our Live Chat support team, these guys are there 24/7 and are specialized on these tasks, so they're pretty good at it Consumer Link: http://livechat.telstra.com/TCOM:ContactUsnlineServi

  • Mail comes in, only mail on same ISP goes out

    I'm not sure if something changed on my mail preferences or if this is a ISP problem. I can send email to people on the same ISP, but no one else. Never had any problems for the last 3 years until now. Also, would like to know how to get previous ISP

  • How to use COPA to delete Order status "ORRQ"

    Dear Gurus When I use Tcode: COPA to store a process order, the system returns "0 order stores", why was that? Prequisition: 1, The order status with ORRQ, TECO 2, The customizing of Order-dependent parameter have selected "order record required" Ple